audiofreeverb
– Support for audio freeverb effect
The audiofreeverb
module contains classes to provide access to audio freeverb effects.
Available on these boards
- class audiofreeverb.Freeverb(roomsize: synthio.BlockInput = 0.5, damp: synthio.BlockInput = 0.5, mix: synthio.BlockInput = 0.5, buffer_size: int = 512, sample_rate: int = 8000, bits_per_sample: int = 16, samples_signed: bool = True, channel_count: int = 1)
An Freeverb effect
- Create a Reverb effect simulating the audio taking place in a large room where you get echos
off of various surfaces at various times. The size of the room can be adjusted as well as how much the higher frequencies get absorbed by the walls.
The mix parameter allows you to change how much of the unchanged sample passes through to the output to how much of the effect audio you hear as the output.
- Parameters:
roomsize (synthio.BlockInput) – The size of the room. 0.0 = smallest; 1.0 = largest.
damp (synthio.BlockInput) – How much the walls absorb. 0.0 = least; 1.0 = most.
mix (synthio.BlockInput) – The mix as a ratio of the sample (0.0) to the effect (1.0).
buffer_size (int) – The total size in bytes of each of the two playback buffers to use
sample_rate (int) – The sample rate to be used
channel_count (int) – The number of channels the source samples contain. 1 = mono; 2 = stereo.
bits_per_sample (int) – The bits per sample of the effect. Freeverb requires 16 bits.
samples_signed (bool) – Effect is signed (True) or unsigned (False). Freeverb requires signed (True).
Playing adding reverb to a synth:
import time import board import audiobusio import synthio import audiofreeverb audio = audiobusio.I2SOut(bit_clock=board.GP20, word_select=board.GP21, data=board.GP22) synth = synthio.Synthesizer(channel_count=1, sample_rate=44100) reverb = audiofreeverb.Freeverb(roomsize=0.7, damp=0.3, buffer_size=1024, channel_count=1, sample_rate=44100, mix=0.7) reverb.play(synth) audio.play(reverb) note = synthio.Note(261) while True: synth.press(note) time.sleep(0.55) synth.release(note) time.sleep(5)
- __exit__() None
Automatically deinitializes when exiting a context. See Lifetime and ContextManagers for more info.
- roomsize: synthio.BlockInput
Apparent size of the room 0.0-1.0
- damp: synthio.BlockInput
How much the high frequencies are dampened in the area. 0.0-1.0
- mix: synthio.BlockInput
The rate the reverb mix between 0 and 1 where 0 is only sample and 1 is all effect.
- play(sample: circuitpython_typing.AudioSample, *, loop: bool = False) None
Plays the sample once when loop=False and continuously when loop=True. Does not block. Use
playing
to block.The sample must match the encoding settings given in the constructor.