Learn creative coding writing simple programs

132. Change volume and pitch with SinOsc.kr

Classes that generate sound in SuperCollider (like SinOsc) often have .ar (audio rate) and .kr (control rate) methods. The .ar method uses more cpu power and it is used for generating sound. The .kr method uses less cpu power and is used to control properties of other oscillators.
For humans, hearing is normally limited to frequencies between about 20 Hz and 20,000 Hz. In recent episodes we have listened to frequencies between 60 and 600 Hz, inside the audible range. That's why we used .ar.
In this episode we want properties to change slowly, up to 1 time per second (or 1 Hz). That's below the audible range, so we use .kr instead.
In this episode we combine several sine oscillators. One at audio rate to generate sound, and several at control rate to control the pitch and the volume of the sound (making the volume and the pitch go up and down).

If it sounds confusing, don't worry, I will review all concepts again in the next episodes.

Tags: supercollider, control rate, kr, sinosc

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