amp: | 1 | pan: | 0 | attack: | 0 | decay: | 0 |
sustain: | 1 | release: | 0 | attack_level: | 1 | decay_level: | sustain_level |
sustain_level: | 1 | env_curve: | 0 | input: | 1 |
use_synth :sound_in_stereo
Treat sound card input as a synth. If your audio card has inputs, you may use this synth to feed the incoming audio into Sonic Pi. This synth will read in a stereo audio stream - for example from a stereo microphone or external stereo keyboard. See :sound_in
for a similar synth capable of reading in a mono signal. The stereo input is expected to be on consecutive sound card channels.
As with all Sonic Pi synths, there is a default envelope which determines the duration of the lifetime of the synth. Therefore, to get a continuous stream of audio, you need to place consecutive calls to this synth in iteration or a live_loop
. For example:
live_loop :playback do
synth :sound_in_stereo, sustain: 8
sleep 8
end
Note that if the microphone and speaker are close together (on a laptop or in a small room) you will potentially get a harsh feedback sound.
Also, note that audio in isn’t yet supported on Raspberry Pi.
Introduced in v2.10
amp: |
The amplitude of the sound. Typically a value between 0 and 1. Higher amplitudes may be used, but won’t make the sound louder, they will just reduce the quality of all the sounds currently being played (due to compression.)
Default: 1
|
pan: |
Position of sound in stereo. With headphones on, this means how much of the sound is in the left ear, and how much is in the right ear. With a value of -1, the sound is completely in the left ear, a value of 0 puts the sound equally in both ears and a value of 1 puts the sound in the right ear. Values in between -1 and 1 move the sound accordingly.
Default: 0
|
attack: |
Amount of time (in beats) for sound to reach full amplitude (attack_level). A short attack (i.e. 0.01) makes the initial part of the sound very percussive like a sharp tap. A longer attack (i.e 1) fades the sound in gently. Full length of sound is attack + decay + sustain + release.
Default: 0
|
decay: |
Amount of time (in beats) for the sound to move from full amplitude (attack_level) to the sustain amplitude (sustain_level).
Default: 0
|
sustain: |
Amount of time (in beats) for sound to remain at sustain level amplitude. Longer sustain values result in longer sounds. Full length of sound is attack + decay + sustain + release.
Default: 1
|
release: |
Amount of time (in beats) for sound to move from sustain level amplitude to silent. A short release (i.e. 0.01) makes the final part of the sound very percussive (potentially resulting in a click). A longer release (i.e 1) fades the sound out gently. Full length of sound is attack + decay + sustain + release.
Default: 0
|
attack_level: |
Amplitude level reached after attack phase and immediately before decay phase
Default: 1
|
decay_level: |
Amplitude level reached after decay phase and immediately before sustain phase. Defaults to sustain_level unless explicitly set
Default: sustain_level
|
sustain_level: |
Amplitude level reached after decay phase and immediately before release phase.
Default: 1
|
env_curve: |
Select the shape of the curve between levels in the envelope. 1=linear, 2=exponential, 3=sine, 4=welch, 6=squared, 7=cubed
Default: 0
|
input: |
First of two consecutive sound card input channels to obtain audio from. Indexing starts at 1 so input 1 represents the first channel, and channel 2 can be represented by
Default: 1
|