@@ -17,10 +17,12 @@ struct Supersaw : Module {
1717 };
1818 enum InputId {
1919 VOCT_INPUT ,
20+ NOISE_DUR_CV_INPUT ,
2021 INPUTS_LEN
2122 };
2223 enum OutputId {
2324 SIGNAL_OUTPUT ,
25+ NOISE_OUTPUT ,
2426 OUTPUTS_LEN
2527 };
2628 enum LightId {
@@ -46,9 +48,11 @@ struct Supersaw : Module {
4648 configParam (FINE_2_PARAM , -0.02 , 0.02 , 0.0 , " Fine 2" );
4749 configParam (FINE_3_PARAM , -0.02 , 0.02 , 0.0 , " Fine 3" );
4850 configParam (NOISE_DUR_PARAM , 0.0 , 0.001 , 0.0 , " Noise duration" );
51+ configInput (NOISE_DUR_CV_INPUT , " Noise duration CV" );
4952 configParam (NOISE_MIX_PARAM , 0.0 , 0.5 , 0.0 , " Noise mix" , " %" , 0.0 , 100.0 );
5053 configInput (VOCT_INPUT , " 1 V/Oct" );
5154 configOutput (SIGNAL_OUTPUT , " Signal" );
55+ configOutput (NOISE_OUTPUT , " Noise" );
5256 }
5357
5458 void process (const ProcessArgs& args) override {
@@ -62,6 +66,8 @@ struct Supersaw : Module {
6266 float fine2 = params[FINE_2_PARAM ].getValue ();
6367 float fine3 = params[FINE_3_PARAM ].getValue ();
6468 float noise_dur = params[NOISE_DUR_PARAM ].getValue ();
69+ float noise_dur_cv = inputs[NOISE_DUR_CV_INPUT ].getVoltage () / 10000 .f ;
70+ noise_dur = clamp (noise_dur + noise_dur_cv, 0 .f , 0 .001f );
6571 float noise_mix = params[NOISE_MIX_PARAM ].getValue ();
6672
6773 for (int c = 0 ; c < channels; c++) {
@@ -94,6 +100,7 @@ struct Supersaw : Module {
94100 out += noise;
95101 outputs[SIGNAL_OUTPUT ].setVoltage (clamp (out * 5 .f , -10 .f , 10 .f ), c);
96102 }
103+ outputs[NOISE_OUTPUT ].setVoltage (last_noise * 5 .f );
97104 }
98105};
99106
@@ -133,11 +140,15 @@ struct SupersawWidget : ModuleWidget {
133140 addParam (createParamCentered<RoundSmallBlackKnob>(Vec (x, y), module , Supersaw::NOISE_DUR_PARAM ));
134141 x += dx;
135142 addParam (createParamCentered<RoundSmallBlackKnob>(Vec (x, y), module , Supersaw::NOISE_MIX_PARAM ));
136- x -= dx;
143+ x += dx;
144+ addInput (createInputCentered<PJ301MPort>(Vec (x, y), module , Supersaw::NOISE_DUR_CV_INPUT ));
145+ x -= dx * 2 ;
137146 y += dy;
138147 addInput (createInputCentered<PJ301MPort>(Vec (x, y), module , Supersaw::VOCT_INPUT ));
139- x += dx * 2 ;
148+ x += dx;
140149 addOutput (createOutputCentered<PJ301MPort>(Vec (x, y), module , Supersaw::SIGNAL_OUTPUT ));
150+ x += dx;
151+ addOutput (createOutputCentered<PJ301MPort>(Vec (x, y), module , Supersaw::NOISE_OUTPUT ));
141152 }
142153};
143154
0 commit comments