Closed kybr closed 5 years ago
Controller has a shiftGain
method you can use to do this, although the effective control change rate is not terribly high. See: https://github.com/ddf/Minim/blob/master/examples/Advanced/Controller/shifting/shifting.pde
If you are going to teach Minim to students I would recommend introducing them to Minim's UGen framework for anything more advanced than just playing audio files. It provides classes similar to the kind of nodes you'd find in Pd and Max, which you can patch together into a sythesis graph programmatically. There is a Line UGen for doing exactly what you describe. See: http://code.compartmental.net/minim/index_ugens.html
Dear @ddf and @kybr,
I really find the [line~] an important feature.
I am working with 4 FilePlayers and have used UGen Gain .setValue
method to change the gain of each individual FilePlayers, but this still produces a "click" sound. I was looking for something like the .shiftGain
method for chancing each FilePlayers gain individually in a smooth way.
I tried to use the Line UGen but I cannot understand how it works, and how to patch it with the FilePlayer/Gain.
For the Gain, you have a very good tutorial where we patch the filePlayer to the Gain and then to the Output.
filePlayer.patch(gain).patch(out);
But for the Line UGen, I do not know how to patch everything together. In Line example we have the following:
Line freqControl;
freqControl.patch( midi2Hz ).patch( tone.frequency );
@gasparramoa To use a Line
to control the level of the Gain
UGen, you'd patch the Line
to the gain
property of the Gain
UGen and then activate
the Line
to smoothly change the gain from one value to another. Something like this would smoothly change the gain from -80dB to 0dB over 1 second:
Line gainControl = new Line();
gainControl.patch(gain.gain);
gainControl.activate(1, -80, 0);
It definitely reads strangely to write gain.gain
especially since Gain
has a setValue
method, but unfortunately that's what we wound up with.
Dear Damien,
Thank you very much for the quick reply and great answer!
I did not know I had to patch the Line
to gain.gain
. That did the job!
Have a great day and thank you once again!
Start
minim/examples/Advanced/Controller/getSetGain/getSetGain.pde
and wiggle the mouse left and right quickly. You'll hear clicks that are artifacts of large jumps in gain. (This is much easier to hear if you useSineWave
instead ofSawWave
.) Instead of a sudden jump in gain, a call tosetGain
should trigger a process that slides the gain from the current value to the requested value a given period of time (a linear ramp). In Pd and Max, we use the [line~] object to accomplish this. As far as I can tell, Minim does not have anything like [line~]. Please correct me if I'm wrong.This video explains the phenomenon and solutions in Pd:
https://www.youtube.com/watch?v=I9db3hmA96U
I can't justify teaching student Minim unless there's some way to address this problem.
Thanks.