17
17
#include "shared-bindings/util.h"
18
18
#include "shared-module/synthio/block.h"
19
19
20
- #define DECAY_DEFAULT 0.7f
21
- #define MIX_DEFAULT 0.5f
22
-
23
20
//| class Reverb:
24
21
//| """An Reverb effect"""
25
22
//|
26
23
//| def __init__(
27
24
//| 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,
31
27
//| mix: synthio.BlockInput = 0.5,
32
28
//| buffer_size: int = 512,
33
29
//| sample_rate: int = 8000,
34
30
//| bits_per_sample: int = 16,
35
31
//| samples_signed: bool = True,
36
32
//| channel_count: int = 1,
37
33
//| ) -> 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.
44
37
//|
45
38
//| The mix parameter allows you to change how much of the unchanged sample passes through to
46
39
//| the output to how much of the effect audio you hear as the output.
47
40
//|
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.
51
43
//| :param synthio.BlockInput mix: The mix as a ratio of the sample (0.0) to the effect (1.0).
52
44
//| :param int buffer_size: The total size in bytes of each of the two playback buffers to use
53
45
//| :param int sample_rate: The sample rate to be used
54
46
//| :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).
58
49
//|
59
50
//| Playing adding an reverb to a synth::
60
51
//|
66
57
//|
67
58
//| audio = audiobusio.I2SOut(bit_clock=board.GP20, word_select=board.GP21, data=board.GP22)
68
59
//| 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)
70
61
//| reverb.play(synth)
71
62
//| audio.play(reverb)
72
63
//|
73
64
//| note = synthio.Note(261)
74
65
//| while True:
75
66
//| synth.press(note)
76
- //| time.sleep(0.25 )
67
+ //| time.sleep(0.55 )
77
68
//| synth.release(note)
78
69
//| time.sleep(5)"""
79
70
//| ...
@@ -139,7 +130,7 @@ static void check_for_deinit(audiodelays_reverb_obj_t *self) {
139
130
// Provided by context manager helper.
140
131
141
132
//| roomsize: synthio.BlockInput
142
- //| """TODO. Apparent roomsize 0.0-1.0"""
133
+ //| """Apparent size of the room 0.0-1.0"""
143
134
static mp_obj_t audiodelays_reverb_obj_get_roomsize (mp_obj_t self_in ) {
144
135
return common_hal_audiodelays_reverb_get_roomsize (self_in );
145
136
}
@@ -157,7 +148,7 @@ MP_PROPERTY_GETSET(audiodelays_reverb_roomsize_obj,
157
148
(mp_obj_t )& audiodelays_reverb_set_roomsize_obj );
158
149
159
150
//| damp: synthio.BlockInput
160
- //| """TODO. How reverbrent the area is. 0.0-1.0"""
151
+ //| """How reverbrent the area is. 0.0-1.0"""
161
152
static mp_obj_t audiodelays_reverb_obj_get_damp (mp_obj_t self_in ) {
162
153
return common_hal_audiodelays_reverb_get_damp (self_in );
163
154
}
0 commit comments