forked from micropython/micropython
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
audiofilters: Add Distortion effect and implement LFO ticking #9776
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
Merged
Merged
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
16575fc
Added `Distortion` and `DistortionMode` classes to `audiofilters` mod…
relic-se 46ebae1
Remove separate DistortionMode code files.
relic-se 3a16daf
Remove `audiofilters.DistortionMode.ATAN`
relic-se 1008dd5
Simplify `audiofilters.DistortionMode.LOFI` sample processing with bi…
relic-se 37b6b70
Fix error with null sample handling in `audiofilters.Distortion`.
relic-se 064c3f3
Merge branch 'adafruit:main' into audiofilters_distortion
relic-se a7060f0
Merge branch 'adafruit:main' into audiofilters_distortion
relic-se 6481b4e
Merge branch 'adafruit:main' into audiofilters_distortion
relic-se 31c9095
Implement `synthio_block_slot_get_limited`.
relic-se 155f197
Convert default float values from null checks to MP_ROM_INT.
relic-se 89f2ae1
Remove unnecessary kwarg setters.
relic-se 5c981f0
Use `MICROPY_FLOAT_CONST` and `MICROPY_FLOAT_C_FUN` within floating p…
relic-se 222ce2c
Apply similar updates to audiofilters.Filter and audiodelays.Echo: MI…
relic-se 0410d22
Added `soft_clip` property to toggle between hard clipping (default) …
relic-se 57022f9
Implemented soft clipping and continued optimization of distortion al…
relic-se 48ca21d
Add Distortion to unix port and make type conversions explicit.
relic-se 4257c62
Variable number of samples within `shared_bindings_synthio_lfo_tick`.
relic-se 0e64e1c
Implement block ticking within audio effects.
relic-se 5fbbeed
Call `shared_bindings_synthio_lfo_tick` on audioeffects in `SYNTHIO_M…
relic-se e18e5b2
Merge branch 'adafruit:main' into audiofilters_distortion
relic-se cef94d7
Remove unnecessary deinit check.
relic-se b796f0d
Only calculate lofi bit mask when necessary.
relic-se 84f8e31
Update `shared_bindings_synthio_lfo_tick` within `audiomixer` to use …
relic-se d84cdbc
Update Distortion class docstring.
relic-se 8c40c56
Move `shared_bindings_synthio_lfo_tick` to avoid error if using unsig…
relic-se 05db339
Remove truncation of `delay_ms` within buffer processing loop.
relic-se ec5b1e8
Add `mix_down_sample` to echo output.
relic-se 48f272e
Fix build errors.
relic-se 99b4fae
Remove unnecessary copies of `mix_down_sample`.
relic-se e049337
Allow variable mix down sample scale.
relic-se 815f829
Merge branch 'adafruit:main' into audiofilters_distortion
relic-se File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// This file is part of the CircuitPython project: https://circuitpython.org | ||
// | ||
// SPDX-FileCopyrightText: Copyright (c) 2024 Cooper Dalrymple | ||
// | ||
// SPDX-License-Identifier: MIT | ||
|
||
#pragma once | ||
|
||
#include "shared-module/audiofilters/Distortion.h" | ||
|
||
extern const mp_obj_type_t audiofilters_distortion_type; | ||
extern const mp_obj_type_t audiofilters_distortion_mode_type; | ||
|
||
void common_hal_audiofilters_distortion_construct(audiofilters_distortion_obj_t *self, | ||
mp_obj_t drive, mp_obj_t pre_gain, mp_obj_t post_gain, | ||
audiofilters_distortion_mode mode, bool soft_clip, mp_obj_t mix, | ||
uint32_t buffer_size, uint8_t bits_per_sample, bool samples_signed, | ||
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); | ||
|
||
mp_obj_t common_hal_audiofilters_distortion_get_pre_gain(audiofilters_distortion_obj_t *self); | ||
void common_hal_audiofilters_distortion_set_pre_gain(audiofilters_distortion_obj_t *self, mp_obj_t arg); | ||
|
||
mp_obj_t common_hal_audiofilters_distortion_get_post_gain(audiofilters_distortion_obj_t *self); | ||
void common_hal_audiofilters_distortion_set_post_gain(audiofilters_distortion_obj_t *self, mp_obj_t arg); | ||
|
||
audiofilters_distortion_mode common_hal_audiofilters_distortion_get_mode(audiofilters_distortion_obj_t *self); | ||
void common_hal_audiofilters_distortion_set_mode(audiofilters_distortion_obj_t *self, audiofilters_distortion_mode mode); | ||
|
||
bool common_hal_audiofilters_distortion_get_soft_clip(audiofilters_distortion_obj_t *self); | ||
void common_hal_audiofilters_distortion_set_soft_clip(audiofilters_distortion_obj_t *self, bool soft_clip); | ||
|
||
mp_obj_t common_hal_audiofilters_distortion_get_mix(audiofilters_distortion_obj_t *self); | ||
void common_hal_audiofilters_distortion_set_mix(audiofilters_distortion_obj_t *self, mp_obj_t arg); | ||
|
||
bool common_hal_audiofilters_distortion_get_playing(audiofilters_distortion_obj_t *self); | ||
void common_hal_audiofilters_distortion_play(audiofilters_distortion_obj_t *self, mp_obj_t sample, bool loop); | ||
void common_hal_audiofilters_distortion_stop(audiofilters_distortion_obj_t *self); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.