1717#include "shared-bindings/util.h"
1818#include "shared-module/synthio/block.h"
1919
20- #define DECAY_DEFAULT 0.7f
21- #define MIX_DEFAULT 0.5f
22-
2320//| class Reverb:
2421//| """An Reverb effect"""
2522//|
2623//| def __init__(
2724//| self,
28- //| max_delay_ms: int = 500,
29- //| delay_ms: synthio.BlockInput = 250.0,
30- //| decay: synthio.BlockInput = 0.7,
25+ //| roomsize: synthio.BlockInput = 0.5,
26+ //| damp: synthio.BlockInput = 0.5,
3127//| mix: synthio.BlockInput = 0.5,
3228//| buffer_size: int = 512,
3329//| sample_rate: int = 8000,
3430//| bits_per_sample: int = 16,
3531//| samples_signed: bool = True,
3632//| channel_count: int = 1,
3733//| ) -> None:
38- //| """Create a Reverb effect where you hear the original sample play back, at a lesser volume after
39- //| a set number of millisecond delay. The delay timing of the reverb can be changed at runtime
40- //| with the delay_ms parameter but the delay can never exceed the max_delay_ms parameter. The
41- //| maximum delay you can set is limited by available memory.
42- //|
43- //| Each time the reverb plays back the volume is reduced by the decay setting (reverb * decay).
34+ //| """Create a Reverb effect simulating the audio taking place in a large room where you get echos
35+ //| off of various surfaces at various times. The size of the room can be adjusted as well as how
36+ //| much the higher frequencies get absorbed by the walls.
4437//|
4538//| The mix parameter allows you to change how much of the unchanged sample passes through to
4639//| the output to how much of the effect audio you hear as the output.
4740//|
48- //| :param int max_delay_ms: The maximum time the reverb can be in milliseconds
49- //| :param synthio.BlockInput delay_ms: The current time of the reverb delay in milliseconds. Must be less the max_delay_ms
50- //| :param synthio.BlockInput decay: The rate the reverb fades. 0.0 = instant; 1.0 = never.
41+ //| :param synthio.BlockInput roomsize: The size of the room. 0.0 = smallest; 1.0 = largest.
42+ //| :param synthio.BlockInput damp: How much the walls absorb. 0.0 = least; 1.0 = most.
5143//| :param synthio.BlockInput mix: The mix as a ratio of the sample (0.0) to the effect (1.0).
5244//| :param int buffer_size: The total size in bytes of each of the two playback buffers to use
5345//| :param int sample_rate: The sample rate to be used
5446//| :param int channel_count: The number of channels the source samples contain. 1 = mono; 2 = stereo.
55- //| :param int bits_per_sample: The bits per sample of the effect
56- //| :param bool samples_signed: Effect is signed (True) or unsigned (False)
57- //| :param bool freq_shift: Do reverbs change frequency as the reverb delay changes
47+ //| :param int bits_per_sample: The bits per sample of the effect. Reverb requires 16 bits.
48+ //| :param bool samples_signed: Effect is signed (True) or unsigned (False). Reverb requires signed (True).
5849//|
5950//| Playing adding an reverb to a synth::
6051//|
6657//|
6758//| audio = audiobusio.I2SOut(bit_clock=board.GP20, word_select=board.GP21, data=board.GP22)
6859//| synth = synthio.Synthesizer(channel_count=1, sample_rate=44100)
69- //| reverb = audiodelays.Reverb(max_delay_ms=1000, delay_ms=850, decay=0.65 , buffer_size=1024, channel_count=1, sample_rate=44100, mix=0.7, freq_shift=False )
60+ //| reverb = audiodelays.Reverb(roomsize=0.7, damp=0.3 , buffer_size=1024, channel_count=1, sample_rate=44100, mix=0.7)
7061//| reverb.play(synth)
7162//| audio.play(reverb)
7263//|
7364//| note = synthio.Note(261)
7465//| while True:
7566//| synth.press(note)
76- //| time.sleep(0.25 )
67+ //| time.sleep(0.55 )
7768//| synth.release(note)
7869//| time.sleep(5)"""
7970//| ...
@@ -139,7 +130,7 @@ static void check_for_deinit(audiodelays_reverb_obj_t *self) {
139130// Provided by context manager helper.
140131
141132//| roomsize: synthio.BlockInput
142- //| """TODO. Apparent roomsize 0.0-1.0"""
133+ //| """Apparent size of the room 0.0-1.0"""
143134static mp_obj_t audiodelays_reverb_obj_get_roomsize (mp_obj_t self_in ) {
144135 return common_hal_audiodelays_reverb_get_roomsize (self_in );
145136}
@@ -157,7 +148,7 @@ MP_PROPERTY_GETSET(audiodelays_reverb_roomsize_obj,
157148 (mp_obj_t )& audiodelays_reverb_set_roomsize_obj );
158149
159150//| damp: synthio.BlockInput
160- //| """TODO. How reverbrent the area is. 0.0-1.0"""
151+ //| """How reverbrent the area is. 0.0-1.0"""
161152static mp_obj_t audiodelays_reverb_obj_get_damp (mp_obj_t self_in ) {
162153 return common_hal_audiodelays_reverb_get_damp (self_in );
163154}
0 commit comments