Commit Graph

2217 Commits

Author SHA1 Message Date
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
Mark fa435468fa
Merge branch 'main' into gif_displayio_support 2023-02-13 18:30:51 -06:00
gamblor21 5c2bd38684 Removed gifio module from tests 2023-02-13 09:40:16 -06:00
MicroDev d9d94eacca
run updated pre-commit 2023-02-01 13:38:41 +05:30
Jeff Epler cc16bd3d53
do not chain exceptions to themselves
cpython actually makes sure the newly chained exception doesn't create
a cycle (even indirectly); see _PyErr_SetObject use of "Floyd's cycle
detection algo". We'll go for the simpler solution of just checking
one level deep until it's clear we need to do more.

Closes: #7414
2023-01-04 08:40:20 -06:00
Jeff Epler 2c46e785f6
update test results 2022-12-28 12:38:07 -06:00
Jeff Epler 83bbfd1815
Allow the tests to directly call the non-heap using _int and _str variants
.. of getenv. These can have their own special bugs.
2022-12-28 12:36:58 -06:00
Jeff Epler edcb832661
These need to be double-blackslashed 2022-12-28 12:35:48 -06:00
Jeff Epler 337b1da143
Explicitly test \n and \r\n files
\r\n files must be working due to micropython's built in handling of
text-mode files, I didn't implement it.

\r-only (old mac text-mode files) are explicitly not supported by
the toml format.
2022-12-26 10:53:58 -06:00
Jeff Epler f6b69cf5e3
Allow settings.toml to end without a newline 2022-12-26 10:53:58 -06:00
Jeff Epler 6426ddb73b
Rename test and add some additional cases
While working on adding 0o and 0b literals (which aren't added yet and
may not be) I realized that my approach would likely cause a problem
for the value "0"
2022-12-12 08:22:54 -06:00
Jeff Epler dd6dd5df21
rework the getenv test again
* use a virtual fat filesystem during the test
 * this makes the file I/O part more closely patch runtime which is nice
 * side-steps the need to add a special function for testing
   * but test still can't be run on a device, because the vfs calls
     are incompatible, and you intentionally can't remount "/" anyway
 * and side-steps problems with storing 'bad' toml files
2022-12-10 12:58:08 -06:00
Jeff Epler 3ab71d7448
Rename test function, make 'bad' files binary & add another test 2022-12-09 15:23:56 -06:00
Jeff Epler 6dca9db225
Rename test function & fix a bug with default value handling 2022-12-09 14:35:50 -06:00
Jeff Epler f30d3ba02e
update expected result 2022-12-08 15:39:19 -06:00
Jeff Epler 3459fe322b
Withdraw the _environ module
This existed solely for testing, so expose it a different way during
the unix coverage build

Also turn off os.getenv support on samd21.
2022-12-08 15:33:10 -06:00
Jeff Epler ef2bfdb5db
dotenv becomes settings.toml 2022-12-08 12:44:20 -06:00
Jeff Epler b83c42e41a
Implement the chain= argument of traceback.print_exception 2022-12-02 10:50:31 -06:00
Jeff Epler dd443bacb8
Chain exceptions while unwinding 2022-11-13 19:53:23 -06:00
Jeff Epler b6f86e1e73
Recursively print chained exceptions 2022-11-13 19:53:21 -06:00
Jeff Epler f3169246ba
Implement chained exceptions
This adds the __cause__, __context__ and __suppress_context__
members to exception objects and makes e.g., `raise exc from cause`
set them in the same way as standard Python.
2022-11-13 19:52:50 -06:00
Jeff Epler 05252c87f4
Don't crash when assigning attributes of the GeneratorExit const singleton 2022-10-22 11:37:34 -05:00
Jim Mussared 55169e0b4d
extmod/uasyncio/task.py: Fix crash when non-awaited task is awaited.
A task that has been sent to the loop's exception handler due to being
re-scheduled twice will then subsequently cause a `raise None` if it is
subsequently awaited. In the C version of task.py, this causes a segfault.

This makes the await succeed (via raising StopIteration instead).

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-10-15 14:58:07 -05:00
Jeff Epler 4f190c9228
Handle tests that just won't stop 2022-10-14 16:40:10 -05:00
Jeff Epler 798f6ec71f
Switch tests to run on Adafruit_CircuitPython_asyncio (fails)
This also depends on https://github.com/adafruit/Adafruit_CircuitPython_Ticks/pull/8
otherwise adafruit_ticks is unimportable and the tests are just skipped.

Several of the tests fail, and one runs forever instead of terminating.

We should fix our asyncio until the tests patch, then incorporate this
change.
2022-10-14 14:44:52 -05:00
Jeff Epler 55519670a8
Fix parsing long dotenv values
Values that exceeded the stack buffer of 64 bytes were incorrectly
handled.

A new test is added.
2022-10-13 16:41:30 -05:00
Jeff Epler febc7a8514
format_traceback: Return list, as documented, and compatible with CPython 2022-10-13 09:38:43 -05:00