Learn creative coding writing simple programs

131. plot, free and rrand

In this episodes we discover how we can play several sounds and stop them one by one, without resorting to stopping all sounds at once. We achieve this by storing synths in different variables, and then calling .free on those variables. That means that if we have synths a and b playing, we can call a.free and b.free independently to stop one or the other.
Then we find out that we can replace calls to the .play method with calls to .plot. What this does is to show us a graphical representation of the sound, instead of playing it through the speakers. This can help us understand the sound properties. When the plot windo is visible there are different key shortcuts we can use, the most interesting ones are +, - and n. Pressing n normalizes the height of the graph, which is useful when comparing different plots.
Finally we take a look at .rand and .rrand, methods that let us to generate random numbers. 10.rand gives us integer numbers between 0 and 10, 10.0.rand returns numbers with decimals in the same range, and 10.rrand(20) provides random numbers between 10 and 20. These methods let us generate sounds with random frequencies and volumes.

Tags: supercollider, plot, free, rrand, rand

Code editor

You can make changes to the code below. Then
Reference
Below you can ask and answer questions related to this video. If your question is unrelated to the video, please post it at the Processing Forum as I'm unable to help with all of your programs and still have enough free time to eat and sleep :)
comments powered by Disqus