Hey SP community, I am trying to create the effect of a piano sustain pedal, using the sustain option. But when I use the following code (which is sustaining every note for 3 beats, and sleeping for 1 beat between notes), the successive notes sound weird & muffled…
play :E4, sustain: 3
sleep 1
play :E4, sustain: 3
sleep 1
play :E4, sustain: 3
sleep 1
play :E4, sustain: 3
sleep 1
So yeah, how do I create the effect of sustain pedal without muffling the successive notes?
Thanks for replying! I thought my post was gonna get forgotten…
I think your solution doesn’t run into the muffling issue because the piano synth is pretty short to begin with, so it can’t be sustained beyond 1 beat… For e.g. try sustaining this for 3 beats, it sounds the same as when you sustain for 1 beat
@musicninja This is an interesting question. At first I thought it was triggering Sonic Pi’s global limiter, which can be bypassed with set_mixer_control! limiter_bypass: 1. But that has no effect!
I think the issue here is that the default synth (:beep / :sine) is such a pure sound that each subsequent “beep” at the same pitch partially cancels the ones that are playing, depending on their phase relationship: Wave interference - Wikipedia
When I run this code, I hear the “muffling” effect only with the :beep synth, not with :blade. Is that what you hear too?
3.times do
use_synth (ring :beep, :blade, :zawa).tick(:a)
4.times do
tick
play (ring :c4, :c4).look,
sustain: 3, amp: 0.5 #, pan: (ring -1, 1).look
sleep 1
end
end
You can also remove the “muffling” effect by uncommenting the pan: option (since the left and right channels don’t interfere with each other) or by changing the second :c4 to a different note, like :d4.
Hi @pashultz, to be honest I’m still trying to internalize the new functions I learned from your code - tick, ring, look… Hold on. I’ll try the full code in a bit and get back with the results!
Appreciate your inputs though, and I think your theory on wave interference is spot on <3
Ok, I used the :blade synth, that didn’t muffle, interesting…
But not sure what you are trying to accomplish in the above code - why are you cycling b/w 3 different synths? and why are you cycling b/w :c4 and :c4 in the inner loop? Instead you can just say play :c4
Definitely! I just whipped that up as a quick way to iterate through different parameters, to see which ones might cause the muffling. You’re right; the ring on pitch is especially pointless; I had originally entered several different notes, then I changed it back to just :C4 but left the structure. Still, even with that goal, it would have made more sense just to use a single-element ring! Oh, well.
And sorry for not explaining earlier; I guess by now you’ve found the section in the tutorial on rings, ticks, etc. I find them to be among the most intuitive tools in Sonic Pi for working out musical concepts—to the degree that I now use them even when they’re not helpful!