44 Commits
Author SHA1 Message Date
Earle F. Philhower, III 74fc1f09bb Fix C23 compilation errors (#814) 2026-07-21 08:38:24 -07:00
Wojtek Kaniewski 05f2fb0045 Fix memory corruption in AudioGeneratorAAC on non-ESP8266 platforms (#807)
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.
2026-03-18 07:30:39 -07:00
Earle F. Philhower, III 7d99e6b7b9 BREAKING: Re-port MIDI, faster, lower memory, ESP32 support (#790)
* 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.
2025-10-20 18:26:41 -07:00
Earle F. Philhower, III e0143bbf37 ESP IDF 6.0 compat, update I2S, DAC, ULP (#783)
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
2025-10-14 12:06:34 -07:00
Earle F. Philhower, III f1d74df9f7 Rewrite OPUS driver, no extra libs, update (#780)
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
2025-10-10 15:19:20 -07:00
Earle F. Philhower, III c19a6153c9 Add Werror, etc. to CI process (#779) 2025-10-09 09:42:39 -07:00
Earle F. Philhower, III 39188b81d6 Scan MP3 for header, avoid multiple burst errors (#764)
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
2025-10-07 23:22:54 -07:00
Earle F. Philhower, III ae685b19e9 Use arduino-cli to build examples, avoid bitrot (#765)
The CI internals for all cores seem to change a lot, so don't rely
on them to build tests here.  Instead, run arduino-cli to build a sketch.
2025-10-07 20:26:11 -07:00
Earle F. Philhower, III a852767b6f Speed up AAC decode by ~20% on Pico/ESP32 (#742)
Import the optimized (well...de-un-optimized) version of libhelix from
BackgroundAudio for about a 20% speedup on the Pico for AAC decode.
2025-04-12 10:25:55 -07:00
Earle F. Philhower, III f9e72dbb21 Add style check matching RP2040 core (#740)
Will let us backport the BackgroundAudio patches to libhelix easier and clean
up some ugly formatting we've let develop.
2025-04-11 12:09:49 -07:00
Earle F. Philhower, III 62dd23a74a Bring back ESP8266 Arduino CI (#739)
No idea how it started failing, the 8266 repo is dead and shouldn't be changing...
2025-04-10 15:06:19 -07:00
Earle F. Philhower, III 89a5a07712 Get ESP32 CI builds working again (#680) 2024-04-17 10:11:03 -07:00
Earle F. Philhower, III 0b5da0e9dd Add PWMAudio support for the RP2040 (#597)
Uses the RP2040 HW PWM generator to provide a stereo audio signal.
2023-01-03 17:08:56 -08:00
TorrenteroandEdgar 6d3b8665f4 sketch_utils.sh now uses flags and breaks current functionality (#555)
Co-authored-by: Edgar <edgar.coria@xema.tech>
2022-07-16 18:05:28 -07:00
Earle F. Philhower, III c2adbdcf88 Enable Werror for ESP32 (#536)
The ESP32 core now builds without warnings, so at Werror back
2022-06-01 02:44:13 -07:00
Earle F. Philhower, III b9666d3652 Get ESP32 CI running again (#532)
Get ESP32 CI running again
ESP32 lacks separable CI stuff
ESP32 has broken GCC 8, don't build MIDI examples
2022-05-19 10:48:24 -07:00
Earle F. Philhower, III a6f1eda9a2 Get ESP8266 CI running again (#531)
Add LWIP to ESP8266 builds
New build step on ESP8266
Fix warnings, quiet get.py
Ack SPIFFS deprecation
Example fix
Clean up overzealous pragmas
Fix server.accept() deprecation
2022-05-18 22:12:33 -07:00
Earle F. Philhower, III 2069060574 Add RP2040 build (#530)
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
2022-05-18 21:03:37 -07:00
Earle F. Philhower, III 9384bb0f3d Update for RP2040 core v2.0 new I2S (#528)
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\
2022-05-18 17:37:34 -07:00
Earle F. Philhower, III e254ad9543 Add MOD test, update DIVIDER name (#451)
Fixes #449
2021-11-28 16:20:05 -08:00
Earle F. Philhower, III 86a1818da5 Add codespell to CI checks (#450) 2021-11-28 10:52:33 -08:00
Earle F. Philhower, III f4d4e69332 Move large OPUS locals to the heap (#374) 2021-02-24 20:50:22 -08:00
Earle F. Philhower, III 4994de7cb7 Revert "Work around Arduino-Builder bug causing ESP8266 build fail (#358)" (#365)
This reverts commit b832ec2434.

Arduino-CLI has fixed a bug in their code, attempt to run nightly builds in CI again.
2021-01-27 16:26:44 -08:00
Earle F. Philhower, III b832ec2434 Work around Arduino-Builder bug causing ESP8266 build fail (#358)
Thanks to @d-a-v for the debug!
2021-01-02 11:02:07 -08:00
Earle F. Philhower, III 93a540da9b Add FLAC host test (#302) 2020-09-03 08:37:15 -07:00
Earle F. Philhower, III fae26d4010 Add Opus file format (and OGG demux) (#294)
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
2020-08-11 20:56:13 -07:00
Earle F. Philhower, III f8d5ccf7d0 Add ESP32 build, break out ESP8266 install for CI (#288)
Re-enable ESP32 builds in CI

Fix examples which do not compile on ESP32
2020-08-08 16:40:21 -07:00
Earle F. Philhower, III 0f40d83241 Use GitHub CI to run tests (#287) 2020-08-08 15:36:06 -07:00
Earle F. Philhower, III 9c654e55cb Fix MIDI test app from double-fclose()ing FILE 2020-08-07 21:40:55 -07:00
Earle F. Philhower, III c5f0930b03 Add MIDI host test w/valgrind
Valgrind detects an error in TSF.h, not yet fixed.  This could be
causing issues on the ESP32.
2020-08-07 21:28:13 -07:00
Earle F. Philhower, III 2c52aeaf44 Add -Wall to CI process 2019-12-31 12:21:59 -08:00
Earle F. Philhower, III 7c7fd1375e Attempt to update ESP32 CI build process
Manually implement the GH scripts that are now used in the ESP32 repo,
overriding the shared method we used to use between the 8266 and 32.
2019-12-31 11:40:01 -08:00
Earle F. Philhower, III 1d6186b4b2 Make host tests compile again 2019-12-31 11:00:30 -08:00
Earle F. Philhower, III 814ec61fa7 Fix CI test to get all submodules in the Arduino tree 2019-04-12 15:58:50 -07:00
Earle F. Philhower, III 955b1d29b2 Fix WAV header decode, add WAV host test
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.
2018-08-03 12:02:52 -07:00
Earle F. Philhower, III e9aec0449d Add AudioOutputMixer to valgrind testing
It, amazingly, worked without any issues found by Valgrind on the
first try.
2018-02-26 12:56:48 -08:00
Earle F. Philhower, III e8e7acb884 Fix warnings and off-by-one in AAC 2018-01-21 19:27:07 -08:00
Earle F. Philhower, III 8ffebe6496 Enable static allocated buffers, no dynamic malloc
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.
2018-01-21 13:02:05 -08:00
Earle F. Philhower, III a359222eae Fix double close in ID3 routine, add buff to tests 2018-01-20 09:24:10 -08:00
Earle F. Philhower, III 4b3ca23d6e Include ID3 tag scanner in MP3 test 2018-01-20 08:42:51 -08:00
Earle F. Philhower, III 24e9d0a585 Add AAC valgrind test on the host, clean up warns
The AAC codec didn't show any issues on initial valgrind runs except
for having a different stop() behavior than the MP3 one.  Make them
match.
2018-01-19 22:11:52 -08:00
Earle F. Philhower, III 0172f17b51 MP3 test in Valgrind
Run a host MP3 test using valgrind, shows no errors.
2018-01-19 21:23:17 -08:00
Earle F. Philhower, III cffb424c2c WIP - build some code on the PC to run valgrind/etc. 2018-01-19 19:39:19 -08:00
Earle F. Philhower, III e5d23a4692 Enable Travis-CI builds
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.
2018-01-19 15:57:30 -08:00