23
23
//|
24
24
//| def __init__(
25
25
//| self,
26
- //| biquad : synthio.Biquad = None,
26
+ //| filter : synthio.Biquad = None,
27
27
//| mix: synthio.BlockInput = 1.0,
28
28
//| buffer_size: int = 512,
29
29
//| sample_rate: int = 8000,
38
38
//| The mix parameter allows you to change how much of the unchanged sample passes through to
39
39
//| the output to how much of the effect audio you hear as the output.
40
40
//|
41
- //| :param synthio.Biquad biquad : The normalized biquad filter object used to process the signal.
41
+ //| :param synthio.Biquad filter : The normalized biquad filter object used to process the signal.
42
42
//| :param synthio.BlockInput mix: The mix as a ratio of the sample (0.0) to the effect (1.0).
43
43
//| :param int buffer_size: The total size in bytes of each of the two playback buffers to use
44
44
//| :param int sample_rate: The sample rate to be used
56
56
//|
57
57
//| audio = audiobusio.I2SOut(bit_clock=board.GP20, word_select=board.GP21, data=board.GP22)
58
58
//| synth = synthio.Synthesizer(channel_count=1, sample_rate=44100)
59
- //| filter = audiofilters.Filter(biquad =synth.low_pass_filter(frequency=2000, q_factor =1.25), buffer_size=1024, channel_count=1, sample_rate=44100, mix=1.0)
59
+ //| filter = audiofilters.Filter(filter =synth.low_pass_filter(frequency=2000, Q =1.25), buffer_size=1024, channel_count=1, sample_rate=44100, mix=1.0)
60
60
//| filter.play(synth)
61
61
//| audio.play(filter)
62
62
//|
68
68
//| time.sleep(5)"""
69
69
//| ...
70
70
static mp_obj_t audiofilters_filter_make_new (const mp_obj_type_t * type , size_t n_args , size_t n_kw , const mp_obj_t * all_args ) {
71
- enum { ARG_biquad , ARG_mix , ARG_buffer_size , ARG_sample_rate , ARG_bits_per_sample , ARG_samples_signed , ARG_channel_count , };
71
+ enum { ARG_filter , ARG_mix , ARG_buffer_size , ARG_sample_rate , ARG_bits_per_sample , ARG_samples_signed , ARG_channel_count , };
72
72
static const mp_arg_t allowed_args [] = {
73
- { MP_QSTR_biquad , MP_ARG_OBJ | MP_ARG_KW_ONLY , {.u_obj = MP_OBJ_NULL } },
73
+ { MP_QSTR_filter , MP_ARG_OBJ | MP_ARG_KW_ONLY , {.u_obj = MP_OBJ_NULL } },
74
74
{ MP_QSTR_mix , MP_ARG_OBJ | MP_ARG_KW_ONLY , {.u_obj = MP_OBJ_NULL } },
75
75
{ MP_QSTR_buffer_size , MP_ARG_INT | MP_ARG_KW_ONLY , {.u_int = 512 } },
76
76
{ MP_QSTR_sample_rate , MP_ARG_INT | MP_ARG_KW_ONLY , {.u_int = 8000 } },
@@ -90,7 +90,7 @@ static mp_obj_t audiofilters_filter_make_new(const mp_obj_type_t *type, size_t n
90
90
}
91
91
92
92
audiofilters_filter_obj_t * self = mp_obj_malloc (audiofilters_filter_obj_t , & audiofilters_filter_type );
93
- common_hal_audiofilters_filter_construct (self , args [ARG_biquad ].u_obj , args [ARG_mix ].u_obj , args [ARG_buffer_size ].u_int , bits_per_sample , args [ARG_samples_signed ].u_bool , channel_count , sample_rate );
93
+ common_hal_audiofilters_filter_construct (self , args [ARG_filter ].u_obj , args [ARG_mix ].u_obj , args [ARG_buffer_size ].u_int , bits_per_sample , args [ARG_samples_signed ].u_bool , channel_count , sample_rate );
94
94
95
95
return MP_OBJ_FROM_PTR (self );
96
96
}
@@ -128,31 +128,31 @@ static mp_obj_t audiofilters_filter_obj___exit__(size_t n_args, const mp_obj_t *
128
128
static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN (audiofilters_filter___exit___obj , 4 , 4 , audiofilters_filter_obj___exit__ ) ;
129
129
130
130
131
- //| biquad : synthio.Biquad
131
+ //| filter : synthio.Biquad
132
132
//| """The normalized biquad filter object used to process the signal."""
133
- static mp_obj_t audiofilters_filter_obj_get_biquad (mp_obj_t self_in ) {
134
- return common_hal_audiofilters_filter_get_biquad (self_in );
133
+ static mp_obj_t audiofilters_filter_obj_get_filter (mp_obj_t self_in ) {
134
+ return common_hal_audiofilters_filter_get_filter (self_in );
135
135
}
136
- MP_DEFINE_CONST_FUN_OBJ_1 (audiofilters_filter_get_biquad_obj , audiofilters_filter_obj_get_biquad );
136
+ MP_DEFINE_CONST_FUN_OBJ_1 (audiofilters_filter_get_filter_obj , audiofilters_filter_obj_get_filter );
137
137
138
- static mp_obj_t audiofilters_filter_obj_set_biquad (size_t n_args , const mp_obj_t * pos_args , mp_map_t * kw_args ) {
139
- enum { ARG_biquad };
138
+ static mp_obj_t audiofilters_filter_obj_set_filter (size_t n_args , const mp_obj_t * pos_args , mp_map_t * kw_args ) {
139
+ enum { ARG_filter };
140
140
static const mp_arg_t allowed_args [] = {
141
- { MP_QSTR_biquad , MP_ARG_OBJ | MP_ARG_REQUIRED , {} },
141
+ { MP_QSTR_filter , MP_ARG_OBJ | MP_ARG_REQUIRED , {} },
142
142
};
143
143
audiofilters_filter_obj_t * self = MP_OBJ_TO_PTR (pos_args [0 ]);
144
144
mp_arg_val_t args [MP_ARRAY_SIZE (allowed_args )];
145
145
mp_arg_parse_all (n_args - 1 , pos_args + 1 , kw_args , MP_ARRAY_SIZE (allowed_args ), allowed_args , args );
146
146
147
- common_hal_audiofilters_filter_set_biquad (self , args [ARG_biquad ].u_obj );
147
+ common_hal_audiofilters_filter_set_filter (self , args [ARG_filter ].u_obj );
148
148
149
149
return mp_const_none ;
150
150
}
151
- MP_DEFINE_CONST_FUN_OBJ_KW (audiofilters_filter_set_biquad_obj , 1 , audiofilters_filter_obj_set_biquad );
151
+ MP_DEFINE_CONST_FUN_OBJ_KW (audiofilters_filter_set_filter_obj , 1 , audiofilters_filter_obj_set_filter );
152
152
153
- MP_PROPERTY_GETSET (audiofilters_filter_biquad_obj ,
154
- (mp_obj_t )& audiofilters_filter_get_biquad_obj ,
155
- (mp_obj_t )& audiofilters_filter_set_biquad_obj );
153
+ MP_PROPERTY_GETSET (audiofilters_filter_filter_obj ,
154
+ (mp_obj_t )& audiofilters_filter_get_filter_obj ,
155
+ (mp_obj_t )& audiofilters_filter_set_filter_obj );
156
156
157
157
158
158
//| mix: synthio.BlockInput
@@ -241,7 +241,7 @@ static const mp_rom_map_elem_t audiofilters_filter_locals_dict_table[] = {
241
241
242
242
// Properties
243
243
{ MP_ROM_QSTR (MP_QSTR_playing ), MP_ROM_PTR (& audiofilters_filter_playing_obj ) },
244
- { MP_ROM_QSTR (MP_QSTR_biquad ), MP_ROM_PTR (& audiofilters_filter_biquad_obj ) },
244
+ { MP_ROM_QSTR (MP_QSTR_filter ), MP_ROM_PTR (& audiofilters_filter_filter_obj ) },
245
245
{ MP_ROM_QSTR (MP_QSTR_mix ), MP_ROM_PTR (& audiofilters_filter_mix_obj ) },
246
246
};
247
247
static MP_DEFINE_CONST_DICT (audiofilters_filter_locals_dict , audiofilters_filter_locals_dict_table ) ;
0 commit comments