Commit graph

92 commits

Author SHA1 Message Date
dcooperdalrymple
e049337147 Allow variable mix down sample scale. 2025-01-17 18:24:18 -06:00
dcooperdalrymple
99b4fae790 Remove unnecessary copies of mix_down_sample. 2025-01-17 17:04:03 -06:00
dcooperdalrymple
4257c62a8a Variable number of samples within shared_bindings_synthio_lfo_tick. 2024-12-12 10:10:29 -06:00
Mark
92ef41083a
Merge pull request #9756 from jepler/synthio-blockbiquad
synthio: Add a form of biquad filter that uses BlockInputs
2024-11-10 17:43:58 -06:00
c377123d0b BlockBiquad: Only recalculate when needed. 2024-11-07 14:14:13 -06:00
c06e6ee03e BlockBiquad: Use Q as argument name
Synthesizer.lpf takes `Q` as the argument name, use the same convention
here.
2024-11-07 13:59:23 -06:00
dcooperdalrymple
e7382c2fc4 Make conversion of mp_float_t to uint32_t for waveform_loop values explicit. 2024-11-04 08:13:17 -06:00
dcooperdalrymple
e2a52afa93 Add support for synthio.BlockInput on synthio.Note.waveform_loop_start, synthio.Note.waveform_loop_end, synthio.Note.ring_waveform_loop_start, and synthio.Note.ring_waveform_loop_end. 2024-11-03 20:30:06 -06:00
dcooperdalrymple
aa7d619d55 Fix ring_waveform_loop_start typo in frequency calculation. 2024-11-03 19:57:02 -06:00
21ebcad778 Add notch filter to BlockBiquad 2024-10-24 21:02:40 -05:00
e891bce129 Rename FilterType -> FilterMode 2024-10-24 20:53:31 -05:00
1fef6b4105 BlockBiquad: improve docs & make parameter names match old filter methods 2024-10-24 11:40:13 -05:00
ce0c1c77a4 Add BlockBiquad
BlockBiquad takes kind, f0 (center frequency) & Q (sharpness)
block type arguments and calculates the actual filter coefficients
every frame.

This allows the filter characteristics f0 and Q to be changed dynamically
from LFOs & arithmetic blocks.

A new manual test demonstrates this on a host computer, playing a simple
tone that is dynamically filtered.
2024-10-24 11:39:23 -05:00
Dan Halbert
3f4d9310ff CircuitPython files: replace STATIC with static 2024-05-20 11:02:17 -04:00
Dan Halbert
950b5d09d2 guard2once -s ... 2024-05-19 20:40:44 -04:00
Dan Halbert
747b7619ea update headers of most CircuitPython-only files 2024-05-17 14:56:28 -04:00
c92ad33a9c
synthio: allow negative amplitudes
Previously, negative amplitudes were clamped to zero.
Now, they are allowed to range from -ALMOST_ONE to +ALMOST_ONE.
This is useful in certain circumstances, such as using synthio
to create CV-like outputs that can be positive or negative, by
using the amplitude property of the note.
2023-11-21 08:54:07 -06:00
dcooperdalrymple
55db6b7947 Added SYNTHIO_WAVEFORM_SIZE definition, renamed 'loop_...' to 'waveform_loop_...', added 'ring_waveform_loop_...` parameters, and updated docstrings. 2023-11-20 09:50:03 -06:00
dcooperdalrymple
785ef5abd2 Add loop_start and loop_end properties to synthio.Note for waveshaping and sampling capabilities. 2023-11-17 17:41:49 -06:00
774f6ac6ab
Switch to using MP_ERROR_TEXT instead of translate, globally 2023-10-30 09:49:06 +01:00
ea5bc12a07
fix getting protocol 2023-09-22 13:53:20 -05:00
Dan Halbert
d582407b06 pre-commit fixes 2023-08-14 00:59:22 -04:00
Dan Halbert
2171e67c1b merge latest adafruit/main 2023-08-13 19:43:54 -04:00
Dan Halbert
fe0e2f13bc wip; fix qstr processing 2023-08-10 20:06:32 -04:00
346f08f8b9
synthio: Add Synthesizer.note_state
This enables the specific use case of checking whether a note's release
phase has ended, but is also potentially useful to implement a sort of
"voice stealing" algorithm in Python code, which can take account of
the note's envelope state as well as other factors specific to the
program.
2023-07-20 13:16:00 -05:00
a999e40935 synthio: reorganize the order of operations
Apply envelope & panning after biquad filtering.

This may fix the weird popping problem. It also reduces the number
of operations that are done "in stereo", so it could help performance.

It also fixes a previously unnoticed problem where a ring-modulated
waveform had 2x the amplitude of an un-modulated waveform.

The test differences look large but it's because some values got changed
in the LSB after the mathematical divisions were moved around.
2023-05-31 14:22:43 -05:00
5f7998e6f2
synthio: improve rounding in biquad
this removes a marked DC offset and may cure the 'pops' problem.
2023-05-30 13:43:06 -05:00
8a85deb1e2 synthio: shift 19 was too much for a note with amplitude 1 2023-05-30 09:26:14 -05:00
3151656f4b synthio: more fir-filter removal; fix biquad logic errors 2023-05-30 09:24:26 -05:00
a891e149a6
synthio: Fix multichannel biquad filtering 2023-05-29 11:23:07 -05:00
51027974e5
synthio: apply biquad filters during synthesis 2023-05-29 10:53:48 -05:00
fed8d5825b
synthio: add biquad filter type & basic filter calculations
the filter cannot be applied as yet.
2023-05-29 09:50:18 -05:00
11d8a6ec3a
synthio: rename synthesizer.lfos to .blocks
.. since math blocks can be placed in it too (and that's useful)
2023-05-23 19:38:25 -05:00
1847c2b72a
synthio: fix, rename voct_to_hz
todbot discovered that this function wasn't working right, and wasn't
well-named.
2023-05-23 19:38:24 -05:00
ac02a2668e
synthio: avoid exceptions inside get_buffer
.. in case the items in lfos are not actually LFOs
2023-05-21 13:22:50 -05:00
11c110e0da
synthio: remove 'none' case from lfo_tick 2023-05-21 13:22:48 -05:00
4ff08e02eb
synthio: lfo: bugfixes & improvements
LFO waveforms are now linearly interpolated by default, but a new
property (interpolated=False) can disable this.

The 'once' logic was improved
2023-05-21 13:22:47 -05:00
e0cfae1d05
synthio: add (untested) phase offset 2023-05-21 13:22:46 -05:00
e259f8d1ba
synthio: Move some divide-by-twos to get_buffer
these are always h-type buffers, so let's make the "len" be the element
count, not the byte count.
2023-05-21 13:22:44 -05:00
c435c469f4
synthio: simplify block logic a bit by converting from float just once 2023-05-18 11:55:01 -05:00
391438102b
synthio: Finish implementing Math blocks 2023-05-17 16:32:20 -05:00
5de4d197a2
synthio: start generalizing LFO to Block 2023-05-17 15:05:34 -05:00
3d2db5dbe0
synthio: improve documentation, simplify synthio_lfo_obj_tick_scaled 2023-05-17 11:13:15 -05:00
d4294de62b
synthio: Allow bends of more than one octave
up to +-12 sounds good, right?
2023-05-16 16:58:04 -05:00
0b926f8fd4
synthio: improve release/press/change
Semi-incompatible name change: The method `release_then_press`
is now `change`. For now a compatibility alias is supported.

Everywhere a `NoteSequence` was accepted, a single note is now accepted.
So for instance, `synth.press(30)` can be written instead of requiring
``synth.press((30,))`. The same goes for `change.retrigger`, which
will accept a single LFO or a sequence.
2023-05-16 10:26:56 -05:00
e6c5e83a45
synthio: remove more dead code 2023-05-16 10:07:22 -05:00
b2c6f9b1a4
synthio: add Synthesizer.lfo, retrigger option 2023-05-16 10:07:07 -05:00
f83212314e
synthio: Add LFOs 2023-05-15 21:15:39 -05:00
f68ab9c5c2
synthio: Fix FIR filtering when audio is stereo 2023-05-12 14:00:32 -05:00
03abc623ef
synthio: note: fix assigning bend & tremolo coefficients dynamically 2023-05-12 14:00:31 -05:00