Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pitch shift audio effect #10052

Merged
merged 10 commits into from
Mar 4, 2025
2 changes: 2 additions & 0 deletions ports/unix/variants/coverage/mpconfigvariant.mk
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ SRC_BITMAP := \
shared-bindings/audiocore/RawSample.c \
shared-bindings/audiocore/WaveFile.c \
shared-bindings/audiodelays/Echo.c \
shared-bindings/audiodelays/PitchShift.c \
shared-bindings/audiodelays/__init__.c \
shared-bindings/audiofilters/Distortion.c \
shared-bindings/audiofilters/Filter.c \
Expand Down Expand Up @@ -77,6 +78,7 @@ SRC_BITMAP := \
shared-module/audiocore/RawSample.c \
shared-module/audiocore/WaveFile.c \
shared-module/audiodelays/Echo.c \
shared-module/audiodelays/PitchShift.c \
shared-module/audiodelays/__init__.c \
shared-module/audiofilters/Distortion.c \
shared-module/audiofilters/Filter.c \
Expand Down
1 change: 1 addition & 0 deletions py/circuitpy_defns.mk
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,7 @@ SRC_SHARED_MODULE_ALL = \
audiocore/WaveFile.c \
audiocore/__init__.c \
audiodelays/Echo.c \
audiodelays/PitchShift.c \
audiodelays/__init__.c \
audiofilters/Distortion.c \
audiofilters/Filter.c \
Expand Down
5 changes: 0 additions & 5 deletions shared-bindings/audiocore/RawSample.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,3 @@ void common_hal_audioio_rawsample_construct(audioio_rawsample_obj_t *self,
uint8_t channel_count, uint32_t sample_rate, bool single_buffer);

void common_hal_audioio_rawsample_deinit(audioio_rawsample_obj_t *self);
bool common_hal_audioio_rawsample_deinited(audioio_rawsample_obj_t *self);
uint32_t common_hal_audioio_rawsample_get_sample_rate(audioio_rawsample_obj_t *self);
uint8_t common_hal_audioio_rawsample_get_bits_per_sample(audioio_rawsample_obj_t *self);
uint8_t common_hal_audioio_rawsample_get_channel_count(audioio_rawsample_obj_t *self);
void common_hal_audioio_rawsample_set_sample_rate(audioio_rawsample_obj_t *self, uint32_t sample_rate);
5 changes: 0 additions & 5 deletions shared-bindings/audiocore/WaveFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,3 @@ void common_hal_audioio_wavefile_construct(audioio_wavefile_obj_t *self,
pyb_file_obj_t *file, uint8_t *buffer, size_t buffer_size);

void common_hal_audioio_wavefile_deinit(audioio_wavefile_obj_t *self);
bool common_hal_audioio_wavefile_deinited(audioio_wavefile_obj_t *self);
uint32_t common_hal_audioio_wavefile_get_sample_rate(audioio_wavefile_obj_t *self);
void common_hal_audioio_wavefile_set_sample_rate(audioio_wavefile_obj_t *self, uint32_t sample_rate);
uint8_t common_hal_audioio_wavefile_get_bits_per_sample(audioio_wavefile_obj_t *self);
uint8_t common_hal_audioio_wavefile_get_channel_count(audioio_wavefile_obj_t *self);
5 changes: 0 additions & 5 deletions shared-bindings/audiodelays/Echo.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ void common_hal_audiodelays_echo_construct(audiodelays_echo_obj_t *self, uint32_
uint8_t channel_count, uint32_t sample_rate, bool freq_shift);

void common_hal_audiodelays_echo_deinit(audiodelays_echo_obj_t *self);
bool common_hal_audiodelays_echo_deinited(audiodelays_echo_obj_t *self);

uint32_t common_hal_audiodelays_echo_get_sample_rate(audiodelays_echo_obj_t *self);
uint8_t common_hal_audiodelays_echo_get_channel_count(audiodelays_echo_obj_t *self);
uint8_t common_hal_audiodelays_echo_get_bits_per_sample(audiodelays_echo_obj_t *self);

mp_obj_t common_hal_audiodelays_echo_get_delay_ms(audiodelays_echo_obj_t *self);
void common_hal_audiodelays_echo_set_delay_ms(audiodelays_echo_obj_t *self, mp_obj_t delay_ms);
Expand Down
261 changes: 261 additions & 0 deletions shared-bindings/audiodelays/PitchShift.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,261 @@
// This file is part of the CircuitPython project: https://circuitpython.org
//
// SPDX-FileCopyrightText: Copyright (c) 2025 Cooper Dalrymple
//
// SPDX-License-Identifier: MIT

#include <stdint.h>

#include "shared-bindings/audiodelays/PitchShift.h"
#include "shared-bindings/audiocore/__init__.h"
#include "shared-module/audiodelays/PitchShift.h"

#include "shared/runtime/context_manager_helpers.h"
#include "py/binary.h"
#include "py/objproperty.h"
#include "py/runtime.h"
#include "shared-bindings/util.h"
#include "shared-module/synthio/block.h"

//| class PitchShift:
//| """A pitch shift effect"""
//|
//| def __init__(
//| self,
//| semitones: synthio.BlockInput = 0.0,
//| mix: synthio.BlockInput = 1.0,
//| window: int = 1024,
//| overlap: int = 128,
//| buffer_size: int = 512,
//| sample_rate: int = 8000,
//| bits_per_sample: int = 16,
//| samples_signed: bool = True,
//| channel_count: int = 1,
//| ) -> None:
//| """Create a pitch shift effect where the original sample play back is altered to change the
//| the perceived pitch by a factor of semi-tones (1/12th of an octave). This effect will cause
//| a slight delay in the output depending on the size of the window and overlap buffers.
//|
//| 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.
//|
//| :param synthio.BlockInput semitones: The amount of pitch shifting in semitones (1/12th of an octave)
//| :param synthio.BlockInput mix: The mix as a ratio of the sample (0.0) to the effect (1.0)
//| :param int window: The total size in bytes of the window buffer used alter the playback pitch
//| :param int overlap: The total size in bytes of the overlap buffer used to prevent popping in the output. If set as 0, no overlap will be used.
//| :param int buffer_size: The total size in bytes of each of the two playback buffers to use
//| :param int sample_rate: The sample rate to be used
//| :param int channel_count: The number of channels the source samples contain. 1 = mono; 2 = stereo.
//| :param int bits_per_sample: The bits per sample of the effect
//| :param bool samples_signed: Effect is signed (True) or unsigned (False)
//|
//| Shifting the pitch of a synth by 5 semitones::
//|
//| import time
//| import board
//| import audiobusio
//| import synthio
//| import audiodelays
//|
//| audio = audiobusio.I2SOut(bit_clock=board.GP0, word_select=board.GP1, data=board.GP2)
//| synth = synthio.Synthesizer(channel_count=1, sample_rate=44100)
//| pitch_shift = audiodelays.PitchShift(semitones=5.0, mix=0.5, window=2048, overlap=256, buffer_size=1024, channel_count=1, sample_rate=44100)
//| pitch_shift.play(synth)
//| audio.play(pitch_shift)
//|
//| while True:
//| for notenum in (60, 64, 67, 71):
//| synth.press(notenum)
//| time.sleep(0.25)
//| synth.release_all()"""
//| ...
//|
static mp_obj_t audiodelays_pitch_shift_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
enum { ARG_semitones, ARG_mix, ARG_window, ARG_overlap, ARG_buffer_size, ARG_sample_rate, ARG_bits_per_sample, ARG_samples_signed, ARG_channel_count, };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_semitones, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_INT(0)} },
{ MP_QSTR_mix, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_INT(1)} },
{ MP_QSTR_window, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 1024} },
{ MP_QSTR_overlap, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 128} },
{ MP_QSTR_buffer_size, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 512} },
{ MP_QSTR_sample_rate, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 8000} },
{ MP_QSTR_bits_per_sample, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 16} },
{ MP_QSTR_samples_signed, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = true} },
{ MP_QSTR_channel_count, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 1 } },
};

mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);

mp_int_t channel_count = mp_arg_validate_int_range(args[ARG_channel_count].u_int, 1, 2, MP_QSTR_channel_count);
mp_int_t sample_rate = mp_arg_validate_int_min(args[ARG_sample_rate].u_int, 1, MP_QSTR_sample_rate);
mp_int_t bits_per_sample = args[ARG_bits_per_sample].u_int;
if (bits_per_sample != 8 && bits_per_sample != 16) {
mp_raise_ValueError(MP_ERROR_TEXT("bits_per_sample must be 8 or 16"));
}

audiodelays_pitch_shift_obj_t *self = mp_obj_malloc(audiodelays_pitch_shift_obj_t, &audiodelays_pitch_shift_type);
common_hal_audiodelays_pitch_shift_construct(self, args[ARG_semitones].u_obj, args[ARG_mix].u_obj, args[ARG_window].u_int, args[ARG_overlap].u_int, args[ARG_buffer_size].u_int, bits_per_sample, args[ARG_samples_signed].u_bool, channel_count, sample_rate);

return MP_OBJ_FROM_PTR(self);
}


//| def deinit(self) -> None:
//| """Deinitialises the PitchShift."""
//| ...
//|
static mp_obj_t audiodelays_pitch_shift_deinit(mp_obj_t self_in) {
audiodelays_pitch_shift_obj_t *self = MP_OBJ_TO_PTR(self_in);
common_hal_audiodelays_pitch_shift_deinit(self);
return mp_const_none;
}
static MP_DEFINE_CONST_FUN_OBJ_1(audiodelays_pitch_shift_deinit_obj, audiodelays_pitch_shift_deinit);

static void check_for_deinit(audiodelays_pitch_shift_obj_t *self) {
audiosample_check_for_deinit(&self->base);
}


//| def __enter__(self) -> PitchShift:
//| """No-op used by Context Managers."""
//| ...
//|
// Provided by context manager helper.

//| def __exit__(self) -> None:
//| """Automatically deinitializes when exiting a context. See
//| :ref:`lifetime-and-contextmanagers` for more info."""
//| ...
//|
static mp_obj_t audiodelays_pitch_shift_obj___exit__(size_t n_args, const mp_obj_t *args) {
(void)n_args;
common_hal_audiodelays_pitch_shift_deinit(args[0]);
return mp_const_none;
}
static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiodelays_pitch_shift___exit___obj, 4, 4, audiodelays_pitch_shift_obj___exit__);


//| semitones: synthio.BlockInput
//| """The amount of pitch shifting in semitones (1/12th of an octave)."""
//|
static mp_obj_t audiodelays_pitch_shift_obj_get_semitones(mp_obj_t self_in) {
audiodelays_pitch_shift_obj_t *self = MP_OBJ_TO_PTR(self_in);
return common_hal_audiodelays_pitch_shift_get_semitones(self);
}
MP_DEFINE_CONST_FUN_OBJ_1(audiodelays_pitch_shift_get_semitones_obj, audiodelays_pitch_shift_obj_get_semitones);

static mp_obj_t audiodelays_pitch_shift_obj_set_semitones(mp_obj_t self_in, mp_obj_t semitones_in) {
audiodelays_pitch_shift_obj_t *self = MP_OBJ_TO_PTR(self_in);
common_hal_audiodelays_pitch_shift_set_semitones(self, semitones_in);
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_2(audiodelays_pitch_shift_set_semitones_obj, audiodelays_pitch_shift_obj_set_semitones);

MP_PROPERTY_GETSET(audiodelays_pitch_shift_semitones_obj,
(mp_obj_t)&audiodelays_pitch_shift_get_semitones_obj,
(mp_obj_t)&audiodelays_pitch_shift_set_semitones_obj);


//| mix: synthio.BlockInput
//| """The output mix between 0 and 1 where 0 is only sample and 1 is all effect."""
static mp_obj_t audiodelays_pitch_shift_obj_get_mix(mp_obj_t self_in) {
return common_hal_audiodelays_pitch_shift_get_mix(self_in);
}
MP_DEFINE_CONST_FUN_OBJ_1(audiodelays_pitch_shift_get_mix_obj, audiodelays_pitch_shift_obj_get_mix);

static mp_obj_t audiodelays_pitch_shift_obj_set_mix(mp_obj_t self_in, mp_obj_t mix_in) {
audiodelays_pitch_shift_obj_t *self = MP_OBJ_TO_PTR(self_in);
common_hal_audiodelays_pitch_shift_set_mix(self, mix_in);
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_2(audiodelays_pitch_shift_set_mix_obj, audiodelays_pitch_shift_obj_set_mix);

MP_PROPERTY_GETSET(audiodelays_pitch_shift_mix_obj,
(mp_obj_t)&audiodelays_pitch_shift_get_mix_obj,
(mp_obj_t)&audiodelays_pitch_shift_set_mix_obj);


//| playing: bool
//| """True when the effect is playing a sample. (read-only)"""
//|
static mp_obj_t audiodelays_pitch_shift_obj_get_playing(mp_obj_t self_in) {
audiodelays_pitch_shift_obj_t *self = MP_OBJ_TO_PTR(self_in);
check_for_deinit(self);
return mp_obj_new_bool(common_hal_audiodelays_pitch_shift_get_playing(self));
}
MP_DEFINE_CONST_FUN_OBJ_1(audiodelays_pitch_shift_get_playing_obj, audiodelays_pitch_shift_obj_get_playing);

MP_PROPERTY_GETTER(audiodelays_pitch_shift_playing_obj,
(mp_obj_t)&audiodelays_pitch_shift_get_playing_obj);


//| def play(self, 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."""
//| ...
//|
static mp_obj_t audiodelays_pitch_shift_obj_play(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_sample, ARG_loop };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_sample, MP_ARG_OBJ | MP_ARG_REQUIRED, {} },
{ MP_QSTR_loop, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false} },
};
audiodelays_pitch_shift_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
check_for_deinit(self);
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);

mp_obj_t sample = args[ARG_sample].u_obj;
common_hal_audiodelays_pitch_shift_play(self, sample, args[ARG_loop].u_bool);

return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_KW(audiodelays_pitch_shift_play_obj, 1, audiodelays_pitch_shift_obj_play);


//| def stop(self) -> None:
//| """Stops playback of the sample."""
//| ...
//|
//|
static mp_obj_t audiodelays_pitch_shift_obj_stop(mp_obj_t self_in) {
audiodelays_pitch_shift_obj_t *self = MP_OBJ_TO_PTR(self_in);
common_hal_audiodelays_pitch_shift_stop(self);
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_1(audiodelays_pitch_shift_stop_obj, audiodelays_pitch_shift_obj_stop);


static const mp_rom_map_elem_t audiodelays_pitch_shift_locals_dict_table[] = {
// Methods
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&audiodelays_pitch_shift_deinit_obj) },
{ MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) },
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&audiodelays_pitch_shift___exit___obj) },
{ MP_ROM_QSTR(MP_QSTR_play), MP_ROM_PTR(&audiodelays_pitch_shift_play_obj) },
{ MP_ROM_QSTR(MP_QSTR_stop), MP_ROM_PTR(&audiodelays_pitch_shift_stop_obj) },

// Properties
{ MP_ROM_QSTR(MP_QSTR_playing), MP_ROM_PTR(&audiodelays_pitch_shift_playing_obj) },
{ MP_ROM_QSTR(MP_QSTR_semitones), MP_ROM_PTR(&audiodelays_pitch_shift_semitones_obj) },
{ MP_ROM_QSTR(MP_QSTR_mix), MP_ROM_PTR(&audiodelays_pitch_shift_mix_obj) },
AUDIOSAMPLE_FIELDS,
};
static MP_DEFINE_CONST_DICT(audiodelays_pitch_shift_locals_dict, audiodelays_pitch_shift_locals_dict_table);

static const audiosample_p_t audiodelays_pitch_shift_proto = {
MP_PROTO_IMPLEMENT(MP_QSTR_protocol_audiosample)
.reset_buffer = (audiosample_reset_buffer_fun)audiodelays_pitch_shift_reset_buffer,
.get_buffer = (audiosample_get_buffer_fun)audiodelays_pitch_shift_get_buffer,
};

MP_DEFINE_CONST_OBJ_TYPE(
audiodelays_pitch_shift_type,
MP_QSTR_PitchShift,
MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS,
make_new, audiodelays_pitch_shift_make_new,
locals_dict, &audiodelays_pitch_shift_locals_dict,
protocol, &audiodelays_pitch_shift_proto
);
28 changes: 28 additions & 0 deletions shared-bindings/audiodelays/PitchShift.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// This file is part of the CircuitPython project: https://circuitpython.org
//
// SPDX-FileCopyrightText: Copyright (c) 2025 Cooper Dalrymple
//
// SPDX-License-Identifier: MIT

#pragma once

#include "shared-module/audiodelays/PitchShift.h"

extern const mp_obj_type_t audiodelays_pitch_shift_type;

void common_hal_audiodelays_pitch_shift_construct(audiodelays_pitch_shift_obj_t *self,
mp_obj_t semitones, mp_obj_t mix, uint32_t window, uint32_t overlap,
uint32_t buffer_size, uint8_t bits_per_sample, bool samples_signed,
uint8_t channel_count, uint32_t sample_rate);

void common_hal_audiodelays_pitch_shift_deinit(audiodelays_pitch_shift_obj_t *self);

mp_obj_t common_hal_audiodelays_pitch_shift_get_semitones(audiodelays_pitch_shift_obj_t *self);
void common_hal_audiodelays_pitch_shift_set_semitones(audiodelays_pitch_shift_obj_t *self, mp_obj_t semitones);

mp_obj_t common_hal_audiodelays_pitch_shift_get_mix(audiodelays_pitch_shift_obj_t *self);
void common_hal_audiodelays_pitch_shift_set_mix(audiodelays_pitch_shift_obj_t *self, mp_obj_t arg);

bool common_hal_audiodelays_pitch_shift_get_playing(audiodelays_pitch_shift_obj_t *self);
void common_hal_audiodelays_pitch_shift_play(audiodelays_pitch_shift_obj_t *self, mp_obj_t sample, bool loop);
void common_hal_audiodelays_pitch_shift_stop(audiodelays_pitch_shift_obj_t *self);
2 changes: 2 additions & 0 deletions shared-bindings/audiodelays/__init__.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#include "shared-bindings/audiodelays/__init__.h"
#include "shared-bindings/audiodelays/Echo.h"
#include "shared-bindings/audiodelays/PitchShift.h"

//| """Support for audio delay effects
//|
Expand All @@ -21,6 +22,7 @@
static const mp_rom_map_elem_t audiodelays_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_audiodelays) },
{ MP_ROM_QSTR(MP_QSTR_Echo), MP_ROM_PTR(&audiodelays_echo_type) },
{ MP_ROM_QSTR(MP_QSTR_PitchShift), MP_ROM_PTR(&audiodelays_pitch_shift_type) },
};

static MP_DEFINE_CONST_DICT(audiodelays_module_globals, audiodelays_module_globals_table);
Expand Down
5 changes: 0 additions & 5 deletions shared-bindings/audiofilters/Distortion.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ void common_hal_audiofilters_distortion_construct(audiofilters_distortion_obj_t
uint8_t channel_count, uint32_t sample_rate);

void common_hal_audiofilters_distortion_deinit(audiofilters_distortion_obj_t *self);
bool common_hal_audiofilters_distortion_deinited(audiofilters_distortion_obj_t *self);

uint32_t common_hal_audiofilters_distortion_get_sample_rate(audiofilters_distortion_obj_t *self);
uint8_t common_hal_audiofilters_distortion_get_channel_count(audiofilters_distortion_obj_t *self);
uint8_t common_hal_audiofilters_distortion_get_bits_per_sample(audiofilters_distortion_obj_t *self);

mp_obj_t common_hal_audiofilters_distortion_get_drive(audiofilters_distortion_obj_t *self);
void common_hal_audiofilters_distortion_set_drive(audiofilters_distortion_obj_t *self, mp_obj_t arg);
Expand Down
5 changes: 0 additions & 5 deletions shared-bindings/audiofilters/Filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ void common_hal_audiofilters_filter_construct(audiofilters_filter_obj_t *self,
uint8_t channel_count, uint32_t sample_rate);

void common_hal_audiofilters_filter_deinit(audiofilters_filter_obj_t *self);
bool common_hal_audiofilters_filter_deinited(audiofilters_filter_obj_t *self);

uint32_t common_hal_audiofilters_filter_get_sample_rate(audiofilters_filter_obj_t *self);
uint8_t common_hal_audiofilters_filter_get_channel_count(audiofilters_filter_obj_t *self);
uint8_t common_hal_audiofilters_filter_get_bits_per_sample(audiofilters_filter_obj_t *self);

mp_obj_t common_hal_audiofilters_filter_get_filter(audiofilters_filter_obj_t *self);
void common_hal_audiofilters_filter_set_filter(audiofilters_filter_obj_t *self, mp_obj_t arg);
Expand Down
4 changes: 0 additions & 4 deletions shared-bindings/audiomixer/Mixer.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,5 @@ void common_hal_audiomixer_mixer_construct(audiomixer_mixer_obj_t *self,
uint32_t sample_rate);

void common_hal_audiomixer_mixer_deinit(audiomixer_mixer_obj_t *self);
bool common_hal_audiomixer_mixer_deinited(audiomixer_mixer_obj_t *self);

bool common_hal_audiomixer_mixer_get_playing(audiomixer_mixer_obj_t *self);
uint32_t common_hal_audiomixer_mixer_get_sample_rate(audiomixer_mixer_obj_t *self);
uint8_t common_hal_audiomixer_mixer_get_channel_count(audiomixer_mixer_obj_t *self);
uint8_t common_hal_audiomixer_mixer_get_bits_per_sample(audiomixer_mixer_obj_t *self);
Loading