Commit Graph

2243 Commits

Author SHA1 Message Date
KB Sriram
8abcbf3f3e py/objdict: Fix fromkeys to return the right type.
Fixes https://github.com/adafruit/circuitpython/issues/8173

It looks like a small fix, and mostly independent of upstream
plans around https://github.com/micropython/micropython/pull/6173

I also filed an issue upstream
https://github.com/micropython/micropython/issues/12011
2023-07-23 12:18:27 -04:00
Jeff Epler
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
Jeff Epler
30b69a821e
synthio: update ring mod manual test 2023-05-30 19:32:24 -05:00
Jeff Epler
8a564602a1
synthio: this modified biquad test lets me hear what I'm hunting 2023-05-30 19:21:13 -05:00
Jeff Epler
f5388e12af
synthio: add manual filter frequency sweeping to standalone test
.. by assigning a new band pass filter to the note every 2 frames
2023-05-29 11:23:45 -05:00
Jeff Epler
51027974e5
synthio: apply biquad filters during synthesis 2023-05-29 10:53:48 -05:00
Jeff Epler
fed8d5825b
synthio: add biquad filter type & basic filter calculations
the filter cannot be applied as yet.
2023-05-29 09:50:18 -05:00
Jeff Epler
eda43d7474
Add some more Note tests 2023-05-24 10:00:12 -05:00
Jeff Epler
1059c99f6e
synthio: Add tests of each varying lfo input
I looked at all the results and they pleased me
2023-05-22 10:45:28 -05:00
Jeff Epler
3790fd4117
synthio: Add tests of all synthio math blocks
I plotted and eyeballed these and they all looked plausible
2023-05-22 10:45:21 -05:00
Jeff Epler
78e75f6977
synthio: enable additional LFO test cases 2023-05-21 13:22:49 -05:00
Jeff Epler
823a02c0b7
synthio: Add a new test of synthio.LFO 2023-05-21 13:22:49 -05:00
Jeff Epler
4da32a7b86
Merge remote-tracking branch 'origin/main' into synthio-lfo-dag 2023-05-19 11:56:13 -05:00
Scott Shawcroft
9d11bda9e8
Fix memoryview.cast over sliced memoryview
Fixes #4758
2023-05-18 13:26:50 -07: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
a682b42180
fir filtering demo 2023-05-17 11:13:15 -05:00
Jeff Epler
f83212314e
synthio: Add LFOs 2023-05-15 21:15:39 -05:00
Jeff Epler
91a5103910
synthio: add a host demo of all major features 2023-05-12 14:00:33 -05:00
Jeff Epler
f52bb65da6
synthio: add some new manual tests 2023-05-11 18:59:06 -05:00
Jeff Epler
9d8dcf7d33
synthio: endorse new test result 2023-05-11 18:59:02 -05:00
Jeff Epler
17df238145
synthio: doc fixes, rename BendType to BendMode 2023-05-11 15:23:54 -05:00
Jeff Epler
cbd02b74df
synthio: endorse updated test result 2023-05-11 10:22:55 -05:00
Jeff Epler
2062b2bfb7
synthio: add a noise program to the manual tests 2023-05-11 09:31:08 -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
Jeff Epler
91978522c5
synthio: Add adafruit_wave and use it in the manual test 2023-05-11 09:31:07 -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
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
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
b33c9f6b4b
synthio: put license notice on copied files 2023-05-03 09:37:12 -05:00
Jeff Epler
d8550f4e7c
synthio: fix offset in default square waveform 2023-05-03 09:37:02 -05:00
Jeff Epler
b5c33a4c03
Add a manual test of synthio
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.
2023-04-25 12:05:53 -05:00
Jeff Epler
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
Scott Shawcroft
e0a7edbe54
Merge pull request #7838 from jepler/more-aes-vectors
add more test vectors for aes
2023-04-06 09:54:57 -07:00
Jeff Epler
8c8ca3b810
endorse new test outputs 2023-04-06 10:21:27 -05:00
Jeff Epler
09bc8fbdc0
add more test vectors for aes 2023-04-05 14:55:41 -05:00
Jeff Epler
14637cd75a
update tests with new expected results 2023-04-05 12:00:05 -05:00
Jeff Epler
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
Jeff Epler
7bbb2ed898
add a basic acceptance test of MidiTrack 2023-04-02 13:48:23 -05:00
Jeff Epler
736af5b0c8
update expected result 2023-04-01 13:12:00 -05:00
Dan Halbert
b947605ab7
Touch up 2023-03-23 09:24:11 -04:00
hathach
8c1095b268
Merge branch 'main' into add-codespell 2023-03-23 14:09:57 +07:00
hathach
a8abe8e705
remove lib from exludes, fix all remaining typos 2023-03-23 13:59:08 +07:00
Jeff Epler
349dedca54
struct: Check that argument counts match, similar to cpython3
.. and test our struct module during the build-time tests

Closes #7771
2023-03-22 09:35:09 -05:00
Scott Shawcroft
bdf592089a
Fix .bin, .hex and .uf2 with new linker sections
Also, format perfbench output in table with reference timing from
the host.
2023-03-20 14:02:57 -07:00
hathach
ce2c3d7dc5
revert deque(s) 2023-03-20 12:12:30 +07:00
hathach
fecc1bdedb
fix typos (partial) detected by codepell 2023-03-18 22:17:02 +07:00
Scott Shawcroft
5bb8a7a7c6
Improve iMX RT performance
* Enable dcache for OCRAM where the VM heap lives.
* Add CIRCUITPY_SWO_TRACE for pushing program counters out over the
  SWO pin via the ITM module in the CPU. Exempt some functions from
  instrumentation to reduce traffic and allow inlining.
* Place more functions in ITCM to handle errors using code in RAM-only
  and speed up CP.
* Use SET and CLEAR registers for digitalio. The SDK does read, mask
  and write.
* Switch to 2MiB reserved for CircuitPython code. Up from 1MiB.
* Run USB interrupts during flash erase and write.
* Allow storage writes from CP if the USB drive is disabled.
* Get perf bench tests running on CircuitPython and increase timeouts
  so it works when instrumentation is active.
2023-03-14 12:30:58 -07:00
Scott Shawcroft
144aed40e3
Rename flag. Turn on UTF-8 and flag on unix
Also added label portion to the test.
2023-02-24 12:23:59 -08:00
Scott Shawcroft
1197394a03
Add simple test 2023-02-23 15:53:59 -08:00