We use it to open endpoints as they are used. Fetching the descriptor
as needed can cause issues with devices that we're expecting a control
packet while another transaction was ongoing. Specifically, a usb
thumb drive didn't expect a control transaction while doing a SCSI
transaction.
This PR also aborts transactions on timeout or ctrl-c interrupt. It
doesn't always recover though...
1. Raise an exception when creating a USB device when host isn't
initialized.
2. Mark RP2040 dtcm_bss as NOLOAD since it doesn't need to be
loaded (just zeroed.)
3. Fix submodule location for ulab to Jeff's copy.
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.
and re-organize so that esp32 s2/s3 don't do as much at reset
.. it's not necessary (because most data is in esp-idf managed memory)
and doing this saves me from having to debug why reconstruct isn't working
properly on that platform.
This needs to be tested on other platforms again before being merged!
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.
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.
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.
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.
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#
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.
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.
.. 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.
This class allows much more expressive sound synthesis:
* tremolo & vibrato
* arbitrary frequency
* different evelope & waveform per note
* all properties dynamically settable from Python code
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)