Sonic-pi: [Feature] Controlling a sample parameter with a wave

Created on 2 Oct 2014  路  3Comments  路  Source: sonic-pi-net/sonic-pi

What

Control the pan of a sample with the values of a sin-wave.
This would be simple in Overtone but I'm not sure such a facility exists in Sonic-pi.

Example

sample :amib_choir :pan sine_wave

Why?

Simple and powerful way to vary a parameter overtime.

Feature Request language

Most helpful comment

One way of achieving this is using Ruby like @josephwilk suggested. However taking advantage of threads can make it not affect the current composition:

with_fx :pan, pan: -1 do |fx|
  sample :foo
  at do
   reset
    loop do
      control fx, pan: Math.sin(tick)
      sleep 0.125
    end
  end
end

However, we need to have a nice way of killing the thread when the FX synth is no longer playing, so more work is needed to be able to first achieve it and then make it simple syntactically.

All 3 comments

While experimenting it occurred to me this is possible using, you know Ruby :)

n = 0
loop{
with_fx :pan, pan: Math.sin(n) do
  sample :ambi_choir
end
n+=1
}

True, but that loop would crap out on the RP. Of course, you could put the with_fx outside of the loop, but then you'd be sending loads of control messages which is also expensive on the RP. Would be nice to have all this in server land.

One way of achieving this is using Ruby like @josephwilk suggested. However taking advantage of threads can make it not affect the current composition:

with_fx :pan, pan: -1 do |fx|
  sample :foo
  at do
   reset
    loop do
      control fx, pan: Math.sin(tick)
      sleep 0.125
    end
  end
end

However, we need to have a nice way of killing the thread when the FX synth is no longer playing, so more work is needed to be able to first achieve it and then make it simple syntactically.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MegumiSoft picture MegumiSoft  路  7Comments

dislegal picture dislegal  路  4Comments

NathanMEvans picture NathanMEvans  路  5Comments

emlyn picture emlyn  路  4Comments

emlyn picture emlyn  路  7Comments