I think Supercollider offer some great possibilities but for me it is to complex to be creative with the tool. For that reason I like to work in Sonic Pi. However one thing I really like in Supercollider is the creative possibility to use dynamic variables, and I was just wondering if anyone knew of similar possibilities in Sonic Pi. It could be used for a number of applications. Eg if one had a variable declared as:
value = SineWave(1).range(0,1)
This would output values from 0 to 1 in a sine cycle of 1 second. This could be used with effects e.g:
live_loop :q1 do
with_fx :reverb, mix: value
play :C
sleep 1
end
Or with play:
live_loop :q1 do
play :C, amp: value
sleep 1
end
Or maybe to change the tone itself:
value = SineWave(1).range(100,1500)
live_loop :q1 do
play hz_to_midi(value),sustain: 60
sleep 100
end
Oh I see. I don’t think that Sonic-Pi can output continuous values right now, but the software is really good at faking it so I definitely see a few ways to achieve this. Here is a very short example. I am sure that you can try to play with this (line) operator to do what you are thinking about:
live_loop :sin do; tick
with_fx :level, amp: (line 0, 1, steps: 10).mirror.look do
play :c4, release: 0.1
sleep 0.1
end
end
EDIT: another example changing frequency (beware, it’s loud):
live_loop :sin do; tick
with_fx :level, amp: (line 0, 1, steps: 10).mirror.look do
a = (line 400, 600, steps: 20).mirror.look
play hz_to_midi a
sleep 0.1
end
end
You may be able to refine this using the slide values, but I never really played with this!
I have been playing around with line now and I see many potential creative uses for this. Thanks for pointing me in that direction
Are there other functions like this I should know about? I asume using line without the mirror part would simulate a saw tooth wave, but maybe there are other ones I have missed?
Yes. There is a bunch of them and a bunch of methods to make it even more precise. Some of them are rarely used but you may find yourself using them some day. Like @samaaron said, everything is detailed in the doc.
Many thanks for the advise Sam Aaron and Bubo! I really like playing with these kinds of constructs and I look forward to dive in and understand how they work. Just one follow up… In 8.4 under the constructors it says Take a look at their respective documentation for more information. Do you know where I can find this additional documentation? Thanks again so much
It’s in the Lang section of the built-in help system. You can also hit C-i when the cursor is over the function name you’d like to see the documentation of