The description of `AACDecode()` function states that the output buffer
must be big enough for 1024 samples per channel _or_ 2048 if SBR is
enabled. By default SBR is enabled on non-ESP8266 platforms, yet the
buffer in `AudioGeneratorAAC` is always 1024 samples per channel long.
This causes memory corruption on ESP32 and possibly Pi Pico. This change
makes the output buffer correct.
* Pull untouched upstream TinySoundFont
Start from the upstream TinySoundFont by @schellingb at
https://github.com/schellingb/TinySoundFont and rearchitect the MIDI
processing.
* Convert to PROGMEM-based SoundFont structures.
This makes it much faster to access the SoundFont and also removes all the
static RAM usage. The samples, the regions, the instruments are all now
in ROM. Only the dynamic voices and related info takes up RAM. No caching.
* (Re)convert to fixed point math.
TSF upstream is built for systems with real floating point units (and
produces great sound with it!), but processors like the Pico, ESP8266,
and several models of ESP32 don't have one so emulate FP in *extremely*
slow SW. Use fixed point (integer) representations for the inner loop
and wherever possible to avoid `float` math.
For processors like the Pico 2 or original ESP32 with hardware FPUs this
still increases performance since integer is still much faster.
* Redo the example and add default SF2s
Rewrite the MIDI examples to use PROGMEM for both SF2 and MID file.
It simplifies life for the casual user and me.
* Breaking change
The MIDI object now has a `midi::SetSoundFont(tsf *)` instead of a
`midi::SetSoundfont(AudioFileSource *)`. It no longer supports reading
SF2 from LittleFS or SD.
Move to the new I2S driver for the ESP chips, since the next revisioncl
of the IDF will remove them completely.
Make the I2S constructors saner and add consistent SetPinout() and
SetBuffers calls to allow configuration.
Remove need for separate UseMCLK or SwapClocks calls, we can figure
that out from the pins selected.
Fixes#758
Move to Opus 1.5.1
Remove OpusFile and OGG libraries because we parse the OGG file in
the object directly with way less memory and overhead.
Update example for LittleFS and RP2040
Fixes#372
MP3 comes in chunks of encoded data started by a header sequence.
Scan for it in the decoder and only pass in data that starts with
this header to avoid the burst errors
Avoids a avalanche of `lost synchronization` error reports when there
is a file error.
Also enable additional sketches on the RP2040/RP2350
Fix examples to build on RP2040
Clean up generator warnings
No SPDIF on RP2040 (yet)
Add back C sources for AAC on ARM
No WiFi streaming on RP2040
No webradio on RP2040
No talking clock (NTP) on RP2040 either
The I2S subsystem was rewritten in the RP2040 core V2.0, so update to
use the new object and calls.
Also clean up some code warnings and remove SPIFFS from the RP2040\
Add ported versions of the Opus codec, OpusFile parser, and OGG demuxer
from Xiph.org.
Only works on the ESP32 due to memory limitations (of opusfile,
strangely enough, and not because of opus compression).
Adds a basic example and a host test.
Fixes#278
Fixes#114
Adobe Audition WAV files have a slightly different but legal header
format. Enable that format (only for PCM, not a/ulaw or anything else)
to be decoedd properly.
Add in a WAV object test that can run on hosts and valgrind.
Because we are allocating objects totaling over 80% of the ESP8266 memory
space, we are very sensitive to memory fragmentation. While we can control
our own allocs, the IP and SDK can allocate any size, at any time, which
can cause us to not be able to find the large contiguous memory areas we need
for the codes.
Work around this by preallocating, before anything else, buffer memory and
never freeing it. Pass this memory into the codec and it will allocate from
this block and be guaranteed to always succeed.
This may fix the last of the hangs on the webradio/http streaming, which only
seemed to happen after a stop/start cycle.
Enable automatic building of all examples and SAM(speech) on a
commit by using Travis-CI. Build against ESP8266 and ESP32.
Minor tweaks to examples and codebase to allow successful compilation
on ESP32 compiler.