Synth triggered by the level of a sample

Hi everybody,
as a newbie, I wonder if there is some way to obtain the following result.
When a sample (or live_audio) is playing, the level (amplitude) of the sampled-sound controls another action: if it overcomes a threshold level, it triggers a note synth. In other words: is there a way to read continuously the level of a sample or the live_audio input?
An example of this could be: a piano chord is triggered when a recorded speaking voice accentuates some vowels or in a drums loop the snare is hit.
Thanks in advance to everyone who would like to answer,
Leo

1 Like

@Prof1220 - @samaaron began attempting to integrate an amplitude monitor into Sonic Pi a while ago, but this has not been successfully completed. (See the following code segments for a few of the pieces:)

1 Like

@ethancrawford, thank you for your suggestions. I suppose that this task is beyond my ability, but at list now I know it! Maybe in the future, I will try a workaround using Gate in Ableton Live as a trigger, sending MIDI note on/off (but Iā€™ve still a lot to learn first in Sonic Pi).
All the best,
Leo

1 Like

@Prof1220 As well as the gate, consider using an envelope follower. Some are shipped with Ableton or as M4L Envelope Follower.

1 Like

Thank you @Hussein, I will give a look.

Hi there!

I would like to know more about this, because Iā€™m trying of check the state of a parameterā€™s synth or sample and use that data as part of a conditional. For example, if I set a pan slider in a synth that is playing to be able of checking in which point it is, in order to trigger another action. If this kind of information is being diplay in the register panel where I can see the data between brackets, how can I catch that data to use it? If a synth is a kind of ruby object, shouldnā€™t be a way to access to its parameters?

Thanks in advance.
Nina

Hello Nina,

If a synth is a kind of ruby object, shouldnā€™t be a way to access to its parameters?

There is no way to retrieve the current value of a synth or fx opt directly from the playing synth or fx itself.
You can still use conditional checks to affect your script based on opt values, but you must deal with the opt values by assigning them to variables and working with them before assigning them to the fx or synth.

The reason that you cannot access opt values directly from the synth or fx ā€œobjectā€ is that Sonic Pi is its own language that is built on top of Ruby. It is not, however, intended to be an extension of, or 100% compatible with all of Ruby.
(If you wish to read a bit more about that, see topics such as the following):

Hope that clears things up a bit - there will no doubt be plenty of folks able to help if you have further questions :slight_smile:

1 Like