this implementation is hoped to be smaller. (feather_m4_express/fr fits
unlike the other PR; approximate savings ~600 bytes)
Minor difference to standard Python: A `dict` object has a
`move_to_end` method. However, calling this method always results in
TypeError.
Implementing it this way means that the method table can still be shared
between OrderedDict and builtin dict.
Closes#4408.
... by the disassembly just below
This was tripped up because in exactly the right conditions some qstr
could be of the form 'xx 63' and make the expression `\.\+63` match
something other than what was intended.
This test was re-worked upstream for mpy version 6 so it'll be a conflict
to resolve when we get to that. :-/
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.
skip all the byecode hex data, it's adequately checked
by the disassembly just below
This was tripped up because in exactly the right conditions some qstr
could be of the form 'xx 63' and make the expression `\.\+63` match
something other than what was intended.
This test was re-worked upstream for mpy version 6 so it'll be a conflict
to resolve when we get to that. :-/
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.
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.
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 allows to test how the midi synthesizer is working, without access
to hardware. Run `micropython-coverage midi2wav.py` and it will create
`tune.wav` as an output.
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)
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.