Jeff Epler
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
Jeff Epler
e0cfae1d05
synthio: add (untested) phase offset
2023-05-21 13:22:46 -05:00
Jeff Epler
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
Jeff Epler
c435c469f4
synthio: simplify block logic a bit by converting from float just once
2023-05-18 11:55:01 -05:00
Jeff Epler
391438102b
synthio: Finish implementing Math blocks
2023-05-17 16:32:20 -05:00
Jeff Epler
5de4d197a2
synthio: start generalizing LFO to Block
2023-05-17 15:05:34 -05:00
Jeff Epler
3d2db5dbe0
synthio: improve documentation, simplify synthio_lfo_obj_tick_scaled
2023-05-17 11:13:15 -05:00
Jeff Epler
d4294de62b
synthio: Allow bends of more than one octave
...
up to +-12 sounds good, right?
2023-05-16 16:58:04 -05:00
Jeff Epler
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
Jeff Epler
e6c5e83a45
synthio: remove more dead code
2023-05-16 10:07:22 -05:00
Jeff Epler
b2c6f9b1a4
synthio: add Synthesizer.lfo, retrigger option
2023-05-16 10:07:07 -05:00
Jeff Epler
f83212314e
synthio: Add LFOs
2023-05-15 21:15:39 -05:00
Scott Shawcroft
ca01200b4f
Merge pull request #7965 from dhalbert/stm-rtc-monotonic
...
STM: monotonic time even when RTC is changed
2023-05-12 13:43:13 -07:00
Scott Shawcroft
40f1ac1809
Merge pull request #7970 from dhalbert/adafruit_bus_device-no-cs
...
adafruit_bus_device SPIDevice can have None for chip select
2023-05-12 13:39:42 -07:00
Dan Halbert
fe386e7c73
adafruit_bus_device SPIDevice can have None for chip select
2023-05-12 15:29:59 -04:00
Jeff Epler
f68ab9c5c2
synthio: Fix FIR filtering when audio is stereo
2023-05-12 14:00:32 -05:00
Jeff Epler
03abc623ef
synthio: note: fix assigning bend & tremolo coefficients dynamically
2023-05-12 14:00:31 -05:00
Jeff Epler
522c5a9a11
synthio: fix crash on synthesizer.press((float,))
2023-05-12 14:00:31 -05:00
Dan Halbert
e8067851f5
fix subticks handling
2023-05-12 14:39:57 -04:00
Jeff Epler
585b1c23b5
synthio: Fix sweep-type pitch bends
...
The accumulator saturate logic was wrong, and the sweep was never restarted
either
2023-05-11 19:13:11 -05:00
Jeff Epler
bc7feb30a5
synthio: implement FIR filtering
...
A 37-tap filter worked fine on RP2040 (prop maker) at 48kHz, so
you can probably pretty much go nuts on M7.
2023-05-11 19:00:44 -05:00
Jeff Epler
62e6de8ed5
synthio: Factor out synth_note_into_buffer
, start adding filter buffer
2023-05-11 18:59:05 -05:00
Jeff Epler
7845a1b13b
synthio: Add filter
boolean property to Note objects
2023-05-11 17:58:09 -05:00
Jeff Epler
33fb771b76
synthio: Add filter
argument to Synthesizer constructor
...
as step 1/n of adding FIR filtering
2023-05-11 17:56:11 -05:00
Jeff Epler
53e13f15a3
synthio: Finish ading SWEEP_IN
2023-05-11 16:53:40 -05:00
Jeff Epler
ec30963731
synthio: fix a -Warray-parameter diagnostic
2023-05-11 10:21:56 -05:00
Jeff Epler
89080564b4
synthio: Fix release time of zero-sustain envelopes
...
When there's no sustain, the release step needs to be calculated from
the attack level, not the sustain level. Otherwise, contrary to intent,
this leads to the actual release taking a loooonnngg time.
2023-05-11 10:19:48 -05:00
Jeff Epler
095e020809
synthio: Add ring modulation
2023-05-11 09:31:18 -05:00
Jeff Epler
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
Jeff Epler
1d1907b98b
synthio: Generalize vibrato into bend
...
bend can be static, sweep, or vibrato
2023-05-11 09:31:07 -05:00
Scott Shawcroft
f8cbdf88e5
Merge pull request #7947 from FoamyGuy/polygon_point_typecheck
...
validate point type is tuple in vectorio Polygon
2023-05-09 09:12:17 -07:00
foamyguy
56d9798b1d
validate point type is tuple in vectorio Polygon
2023-05-08 15:39:19 -05:00
Jeff Epler
c031bda5dd
synthio: implement a range compressor with hard knee
...
This really improves the loudness of the output with multiple notes
while being a nice simple algorithm to implement.
2023-05-08 09:22:42 -05:00
Jeff Epler
9a9f3229fa
synthio: Perform vibrato in pitch, not as frequency ratio
...
Now the vibrato 'units' are 1.0 = one octave, 1/12 = one semitone,
1/1200 = one cent. Before, the units were somewhat arbitrary and were not
perceptually "symmetrical" around the base frequency.
For vibrato_depth = 1/12 and base frequency of 440,
before: pitch from 403.33 to 476.67Hz, not corresponding to any notes
after: pitch from 415.30 to 466.16Hz, corresponding to G# and A#
2023-05-06 21:35:20 -05:00
Jeff Epler
a53c0ed066
synthio: add onevo_to_hz, implement midi_to_hz in terms of it
...
this has the side effect of making some notes more accurate, the new
frequency= value in the test is closer to the true midi frequency of
830.609...Hz.
2023-05-06 21:35:19 -05:00
Jeff Epler
d2aca7eba0
synthio: fix per-note envelope & envelope modification
...
.. and simplify the envelope advance logic by handling
'instant' values more intelligently.
2023-05-04 12:23:45 -05:00
Jeff Epler
c839888e28
synthio: rename function that records error position
2023-05-04 08:45:31 -05:00
Jeff Epler
e23e7d3b3f
synthio: get_buffer: return error if object deinited
...
this may fix a weird crash during shutdown
2023-05-04 07:45:45 -05:00
Jeff Epler
2b0231e9d3
synthio: re-striking a note should re-enter attack
...
.. without changing the current note amplitude
2023-05-04 07:23:50 -05:00
Jeff Epler
021aaa4599
synthio: remove unused 'phase' from Note objects
2023-05-04 07:23:50 -05:00
Jeff Epler
1701552dec
synthio: make sustain level relative to attack level
...
and re-vamp overall envelope calculation again.
Now, if you set a low overall attack level like 0.2 this avoids the
"diminishing volume" effect when many notes sound at once. You need
simply choose a maximum attack level that is appropriate for the max
number of voices that will actually be played.
2023-05-04 07:23:50 -05:00
Jeff Epler
c06597c07a
synthio: replace the quietest releasing note when over-writing
2023-05-04 07:23:49 -05:00
Jeff Epler
4f56b7646e
synthio: slow ramp overall envelope back up
...
.. and account releasing notes at their sustain level until they're
done.
this ameliorates the effect where multiple releasing notes
don't seem to actually be releasing, but stay at a constant volume.
2023-05-04 07:23:49 -05:00
Jeff Epler
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
Jeff Epler
5514e3065d
synthio: add midi_to_hz
...
to convert notes in the MIDI 1-127 note scale to floating point Hz
2023-05-04 07:23:48 -05:00
Jeff Epler
bd9aca2526
Merge pull request #7862 from jepler/synthio-envelope
...
Synthio envelope
2023-05-03 12:42:56 -05:00
Jeff Epler
dd262258e0
synthio: Add MidiTrack.error_location
to record errors
...
.. instead of just printing the unraiseable error on the repl
2023-05-03 09:37:02 -05:00
Jeff Epler
d8550f4e7c
synthio: fix offset in default square waveform
2023-05-03 09:37:02 -05:00
Dan Halbert
34f565dd89
Merge pull request #7891 from tannewt/fix_epd_uc
...
Add address_little_endian and fix display memory reuse
2023-04-26 00:27:59 -04:00
Scott Shawcroft
75046b3a58
Save space with consolidated errors
2023-04-25 13:26:48 -07:00