How to control volumes of individual buffers?

I’ve looked through tutorials and videos but cannot find the answer. I’ve tried amp as in this example. It runs without error but doesn’t seem to change the volume. I want to decrease the volume in this case…


live_loop :my_scale do ; tick
use_synth :prophet
play (scale :e, :aeolian).look amp: 0.5 #[I’ve tried 0.1 and 0.25 also]
sleep 20
with_fx :gverb do
play 60

thank you


You’re missing a comma before your amp option. The third line in your code should be:

play (scale :e, :aeolian).look, amp: 0.5 # or 0.1, 0.25
                              comma here

Cheers :slight_smile:

P.S. When sharing your code, you can enclose it in three backticks to convert it to a code format.


puts “Hello world”

will be formatted as follows:

puts "Hello world"

Hey @psunspots :slight_smile:

Was your original question about how to control the amplitude of an entire buffer of Sonic Pi code? Or does d0lfyn’s comment about the comma solve your problem?

(I ask because technically, you can’t control a buffer per se, but only synth, sample or fx nodes inside the buffer :slight_smile: - but it’s definitely possible to control many of these at once).

Adding a comma there seemed to work for the first note only. The first note played was less louder than subsequent notes. Maybe the line needs to be somewhere else? Thanks.

Hi, the code I posted is the only code in one single buffer so I guess I’m only trying to control the volume of one synth right now. I don’t believe d0lfyn’s code correction solved it.

All I’m trying to do is mix several different buffers that are playing simultaneously. I’ve got an ambient loop going in one buffer and I’m trying to have this random aeolian scale playing in another buffer, but it’s too loud and ruins it.

Maybe I should go about it another way? I’m all ears for suggestions, thanks.

Sure. The amp: that you have in your code is an “opt”, or “optional parameter”. These apply to synths, fx, and samples. It’s worth checking out at least Tutorial chapter 2.2 - Synth Options and 3.2 - Sample Parameters if you haven’t already - (FX follow a similar pattern). In most cases, opts apply to individual synths, fx or samples.

In your situation, every time around the loop, the play (scale ...) plays quietly, and the play 60 plays much louder. (This is because, in most situations as mentioned, opts apply to a single call to play).

On the other hand, it’s also possible to say, "use these default opt values ___ for all following calls to play or sample". (See use_synth_defaults/with_synth_defaults and use_sample_defaults/with_sample_defaults in the “Lang” section of the Help docs in the app for that). That’s (one) way you could tell Sonic Pi to affect all sounds in a buffer at once :slight_smile:

Does that help? I’m sure I or someone else will be happy to answer any further questions :slight_smile: