micropython-lib
micropython-lib copied to clipboard
Add chunk and aifc modules
Added the chunk and aifc modules from CPython with some minimal changes for MicroPython incompatibilities. Chunk is a dependency of aifc.
Note that the tests weren't ported since they use the CPython test infrastructure which is going to be challenging to run under MicroPython. A simple test for chunk was added.
Unfortunately, some of the audio files that aifc can process requires an additional library, audioop. It's implemented in C and will require a rewrite (it may be a good candidate for a native module). So, at least for now, if an attempt is made to load those particular audio files then a runtime exception will be raised ("Import Error: no module named audioop").
Successfully tested with stereo 8, 12, 16, 24, and 32 bit integer AIFF and AIFF-C files. Fails with alaw compressed data, ulaw compressed data, and float data.
Also, I presume the Python license is compatible..?
PEP 594 suggests that this library is to be deprecated so perhaps we should forget about this library...