Commit graph

34 commits

Author SHA1 Message Date
Cooper Dalrymple
2e018ceb39 Updated formatting 2025-04-01 11:52:05 -05:00
Cooper Dalrymple
05a50b8fd8 Initial replacement of old Biquad with BlockBiquad 2025-04-01 09:10:25 -05:00
Scott Shawcroft
3f2c1e0724
Merge pull request #9804 from jepler/synthio-blockbiquad-morefilters
Add BlockBiquad shelf & peaking, AudioFilter support
2025-02-13 21:17:03 -08:00
fea0a39653 Deprecate Biquad, BlockBiquad is better in every way
.. and we'd like to get the code space back from having two biquad kinds.
2025-02-08 16:42:49 -06:00
8aa1969c61 add, use a default exit object
This just delegates to .deinit().

Also, change default __enter__ to a macro that reuses the
identically-beving "identity_obj", and harmonize a few sites so that
the naming s consistent.

Saves about 800 bytes on metro rp2350.
2025-02-07 15:10:58 -06:00
e15eba0d33 audio: reduce code size
By placing certain fields in a fixed location in all sample types,
code can be reduced & reused. For instance, the same property object
can be used for every sample type's `sample_rate` property.

The sample proto functions like `sample_rate` become superfluous since
once an object is verified to support the audiosample protocol, direct
access to the fields in the base object is possible.
2025-02-06 21:56:09 -06:00
Scott Shawcroft
e277540f7a
Switch to ruff like MicroPython 2025-02-05 11:09:15 -08:00
6ff3860ec8 Synthesizer: Match documentation to implementation.
The docstrings incorrectly gave the name of the argument; the code
only accepts the argument name "Q":
```
     { MP_QSTR_Q, MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL } },
```
2024-11-07 13:58:18 -06:00
elpekenin
bc7a052cbb fix some doc-comments 2024-08-23 23:00:56 +02:00
Dan Halbert
3f4d9310ff CircuitPython files: replace STATIC with static 2024-05-20 11:02:17 -04:00
Dan Halbert
747b7619ea update headers of most CircuitPython-only files 2024-05-17 14:56:28 -04:00
Scott Shawcroft
e62db5adcd
Fix native property setting from subclass 2023-10-24 16:20:51 -07:00
Dan Halbert
4d175ab41a convert to MP_DEFINED_CONST_OBJ_TYPE() 2023-09-19 21:09:29 -04:00
Dan Halbert
2c0fa0f7dc initial merge from v1.20.0; just satisifying conflicts 2023-09-19 11:10:12 -04:00
Dan Halbert
2171e67c1b merge latest adafruit/main 2023-08-13 19:43:54 -04:00
Dan Halbert
0d2c3c3f08 wip: continuing compilation fixes; mp_obj_alloc everywhere 2023-08-07 20:45:57 -04:00
29a4364ba7
fix method signature 2023-07-20 14:05:56 -05: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
3151656f4b synthio: more fir-filter removal; fix biquad logic errors 2023-05-30 09:24:26 -05:00
1d58b550b5
synthio: fix doc build 2023-05-29 13:07:15 -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
9f138dc188
synthio: list filter in the constructor 2023-05-23 19:38:25 -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
4d60c4608e
synthio: doc fixes 2023-05-21 17:49:30 -05:00
e6c4d12eaf
synthio: doc improvement 2023-05-21 13:22:47 -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
b2c6f9b1a4
synthio: add Synthesizer.lfo, retrigger option 2023-05-16 10:07:07 -05:00
33fb771b76
synthio: Add filter argument to Synthesizer constructor
as step 1/n of adding FIR filtering
2023-05-11 17:56:11 -05:00
e87e7ee54f
synthio: add stereo & Note.panning
A note can be placed in the center (panning=0) or moved to just the left
(panning=1) or right (panning=-1) channels. Fractional panning values
place it partially in both channels.
2023-05-11 09:31:18 -05:00
a7da245ad0
synthio: Add synthio.Note
This class allows much more expressive sound synthesis:
 * tremolo & vibrato
 * arbitrary frequency
 * different evelope & waveform per note
 * all properties dynamically settable from Python code
2023-05-04 07:23:49 -05:00
12c1a72f03
synthio: implement envelope
This works for me (tested playing midi to raw files on host computer, as
well as a variant of the nunchuk instrument on pygamer)

it has to re-factor how/when MIDI reading occurs, because reasons.

endorse new test results

.. and allow `-1` to specify a note with no sustain (plucked)
2023-04-25 12:05:53 -05:00
375a9cd4c5
add Synthesizer.release 2023-04-25 12:05:50 -05:00
992457c7f7
Improve documentation 2023-04-05 16:53:09 -05:00
b011468251
Add synthio.Synthesizer
In contrast to MidiTrack, this can be controlled from Python code,
turning notes on/off as desired.

Not tested on real HW yet, just the acceptance test based on checking
which notes it thinks are held internally.
2023-04-02 20:37:23 -05:00