Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions locale/circuitpython.pot
Original file line number Diff line number Diff line change
Expand Up @@ -3724,6 +3724,7 @@ msgid "file must be a file opened in byte mode"
msgstr ""

#: shared-bindings/audiodelays/Chorus.c shared-bindings/audiodelays/Echo.c
#: shared-bindings/audiodelays/GranularPitchShift.c
#: shared-bindings/audiodelays/MultiTapDelay.c
#: shared-bindings/audiodelays/PitchShift.c
#: shared-bindings/audiofilters/Distortion.c
Expand Down
2 changes: 2 additions & 0 deletions ports/raspberrypi/boards/archi/mpconfigboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Register
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_seesaw
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_framebuf
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_SimpleIO

OPTIMIZATION_FLAGS = -O2
2 changes: 2 additions & 0 deletions ports/unix/variants/coverage/mpconfigvariant.mk
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ SRC_BITMAP := \
shared-bindings/audiodelays/Echo.c \
shared-bindings/audiodelays/Chorus.c \
shared-bindings/audiodelays/PitchShift.c \
shared-bindings/audiodelays/GranularPitchShift.c \
shared-bindings/audiodelays/MultiTapDelay.c \
shared-bindings/audiodelays/__init__.c \
shared-bindings/audiofilters/Distortion.c \
Expand Down Expand Up @@ -85,6 +86,7 @@ SRC_BITMAP := \
shared-module/audiodelays/Echo.c \
shared-module/audiodelays/Chorus.c \
shared-module/audiodelays/PitchShift.c \
shared-module/audiodelays/GranularPitchShift.c \
shared-module/audiodelays/MultiTapDelay.c \
shared-module/audiodelays/__init__.c \
shared-module/audiofilters/Distortion.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 @@ -713,6 +713,7 @@ SRC_SHARED_MODULE_ALL = \
audiodelays/Echo.c \
audiodelays/Chorus.c \
audiodelays/PitchShift.c \
audiodelays/GranularPitchShift.c \
audiodelays/MultiTapDelay.c \
audiodelays/__init__.c \
audiofilters/Distortion.c \
Expand Down
315 changes: 315 additions & 0 deletions shared-bindings/audiodelays/GranularPitchShift.c

Large diffs are not rendered by default.

31 changes: 31 additions & 0 deletions shared-bindings/audiodelays/GranularPitchShift.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// This file is part of the CircuitPython project: https://circuitpython.org
//
// SPDX-FileCopyrightText: Copyright (c) 2026 Tim Cocks for Adafruit Industries
//
// SPDX-License-Identifier: MIT

#pragma once

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

extern const mp_obj_type_t audiodelays_granular_pitch_shift_type;

void common_hal_audiodelays_granular_pitch_shift_construct(audiodelays_granular_pitch_shift_obj_t *self,
mp_obj_t semitones, mp_obj_t mix, uint32_t grain_size, uint32_t density,
mp_float_t spread, uint32_t buffer_size, uint8_t bits_per_sample, bool samples_signed,
uint8_t channel_count, uint32_t sample_rate);

void common_hal_audiodelays_granular_pitch_shift_deinit(audiodelays_granular_pitch_shift_obj_t *self);

mp_obj_t common_hal_audiodelays_granular_pitch_shift_get_semitones(audiodelays_granular_pitch_shift_obj_t *self);
void common_hal_audiodelays_granular_pitch_shift_set_semitones(audiodelays_granular_pitch_shift_obj_t *self, mp_obj_t semitones);

mp_obj_t common_hal_audiodelays_granular_pitch_shift_get_mix(audiodelays_granular_pitch_shift_obj_t *self);
void common_hal_audiodelays_granular_pitch_shift_set_mix(audiodelays_granular_pitch_shift_obj_t *self, mp_obj_t arg);

mp_float_t common_hal_audiodelays_granular_pitch_shift_get_spread(audiodelays_granular_pitch_shift_obj_t *self);
void common_hal_audiodelays_granular_pitch_shift_set_spread(audiodelays_granular_pitch_shift_obj_t *self, mp_float_t spread);

bool common_hal_audiodelays_granular_pitch_shift_get_playing(audiodelays_granular_pitch_shift_obj_t *self);
void common_hal_audiodelays_granular_pitch_shift_play(audiodelays_granular_pitch_shift_obj_t *self, mp_obj_t sample, bool loop);
void common_hal_audiodelays_granular_pitch_shift_stop(audiodelays_granular_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 @@ -13,6 +13,7 @@
#include "shared-bindings/audiodelays/Echo.h"
#include "shared-bindings/audiodelays/Chorus.h"
#include "shared-bindings/audiodelays/PitchShift.h"
#include "shared-bindings/audiodelays/GranularPitchShift.h"
#include "shared-bindings/audiodelays/MultiTapDelay.h"

//| """Support for audio delay effects
Expand All @@ -26,6 +27,7 @@ static const mp_rom_map_elem_t audiodelays_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_Echo), MP_ROM_PTR(&audiodelays_echo_type) },
{ MP_ROM_QSTR(MP_QSTR_Chorus), MP_ROM_PTR(&audiodelays_chorus_type) },
{ MP_ROM_QSTR(MP_QSTR_PitchShift), MP_ROM_PTR(&audiodelays_pitch_shift_type) },
{ MP_ROM_QSTR(MP_QSTR_GranularPitchShift), MP_ROM_PTR(&audiodelays_granular_pitch_shift_type) },
{ MP_ROM_QSTR(MP_QSTR_MultiTapDelay), MP_ROM_PTR(&audiodelays_multi_tap_delay_type) },
};

Expand Down
Loading
Loading