100 Commits
Author SHA1 Message Date
Earle F. Philhower, III 10d929ac01 Cast AdjustI2SRate result to uint32_t (#821)
Fixes #820
2026-08-02 10:06:52 -07:00
Earle F. Philhower, III 74fc1f09bb Fix C23 compilation errors (#814) 2026-07-21 08:38:24 -07:00
Earle F. Philhower, III 3450935a2a Add new project link 2025-12-09 14:50:39 -08:00
Earle F. Philhower, III cd98586a2c Suggest using latest pioarduino 2025-10-31 08:37:22 -07:00
Earle F. Philhower, III 89c60ad19b ESP32 Platform.IO information
Added section on ESP32 and Platform.IO integration issues and solutions.
2025-10-27 09:36:25 -07:00
Earle F. Philhower, III d6184e0897 Update version 2025-10-23 14:09:27 -07:00
Earle F. Philhower, III c075b393f1 Properly timeout for ESP32 I2S writes (#794)
The I2S write was always blocking meaning only a single loop call
might have ended up playing the entire audio output.

Replace the timeout of `10` with `0`.
2025-10-23 13:50:14 -07:00
Earle F. Philhower, III 5a0375f409 Speed MIDI decode 11%-64% with approximated powf (#793)
Use a numeric approximation to make powf much faster.  Loss of accuracy
isn't an issue in an audio output device.
2025-10-23 13:36:47 -07:00
Earle F. Philhower, III 41b96ef000 Increase MIDI speed by 20% by saturating at end (#792)
By rendering into a 32b int we don't have to saturate check in the inner
loop of the voice render, which is called multiple times per actual output
block.  That check is very expensive.

In tsf_render_short make the input `short *buffer` have 2x the space as
normal to allow the full 32b quantity for each sample to accumulate.
After all voices have been rendered, then resample with saturation into
int16_t values.

About 24% faster on the Pico while still saturating properly.
2025-10-22 18:32:35 -07:00
Earle F. Philhower, III 5cb3ef5d2d Fix typo in README 2025-10-20 18:50:51 -07:00
Earle F. Philhower, III 11576fe94c Update version 2025-10-20 18:36:36 -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 3e099fefe1 Don't skip CI, my son. 2025-10-20 16:26:45 -07:00
Earle F. Philhower, III 291cff213f Add block-based I2S write on Pico (#789) 2025-10-20 15:08:13 -07:00
Earle F. Philhower, III e2f215cea3 Add version defines (#788) 2025-10-20 08:44:57 -07:00
Earle F. Philhower, III 7704d78dc9 Add ConsumeSamples to Null output (#787)
Help with testing optimization by minimizing non-decode CPU usage
2025-10-20 08:30:24 -07:00
Earle F. Philhower, III 25c6165b3d Fix PDM compiles for older SOCs (#786)
Espressif changes the contents of the PDM struct depending on the
chip model.  Use a hopefully valid `#define` to avoid setting a
member that's not there in some cases.

Fixes #785
2025-10-18 17:38:23 -07:00
Earle F. Philhower, III 7ea583ff37 Update version 2025-10-14 14:36:15 -07:00
Earle F. Philhower, III 3032072561 Add ESP32 PDM 1-bit output support (#784)
Borrowed from BackgroundAudio PDM implementation
https://github.com/earlephilhower/BackgroundAudio

Requires an ESP32 model with PDM support.
2025-10-14 14:04:21 -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 058e131b26 Remove 8-bit handling in output, promote WAV/FLAC to 16 (#782)
Only the WAV and FLAC generators can generate 8-bit values, so it is
more efficient and sane to just have those generators upscale to 16-bit
signed (if necessary) in generation and simplify all the other
Generators and Outputs.
2025-10-13 09:56:39 -07:00
Earle F. Philhower, III 724b6d606e Update version 2025-10-11 15:32:12 -07:00
Earle F. Philhower, III 2f5cc2a388 Remove unneeded opus.h files (#781) 2025-10-11 14:43:59 -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 36dde3c85c Update README, ESP32 is supported 2025-10-09 12:35:45 -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 1255a4240a Mixer stubs produce 16b, avoid 8b WAV issues (#776) 2025-10-09 07:33:48 -07:00
Earle F. Philhower, III 94f6879f8d Add include for rtc_io_reg.h in AudioOutputULP.cpp 2025-10-08 19:55:02 -07:00
Earle F. Philhower, III 5cab5b34aa Fix div/0 error after WDT in ULP (#778)
Fixes #399

rtc_clk_cal can return 0 while calibration is underway.  If that happens
busy-wait until it returns a valid period.
2025-10-08 19:06:46 -07:00
Earle F. Philhower, III b4e76952c1 Rename helper fcn stack->stackenter for MAD (#777)
Fixes #379
2025-10-08 18:44:42 -07:00
Earle F. Philhower, III c5613c5a4b Add PWM/NoDAC filter and amp examples (#775)
Fixes #562
Fixes #732
2025-10-08 17:30:13 -07:00
Earle F. Philhower, III 81ebc8a11a Fix Talkie output on ESP32 (#774)
Fixes #629

Need to set the I2S clock after begin() for ESP32
2025-10-08 17:01:58 -07:00
Earle F. Philhower, III 15f9a65afa AudioOutputInternalDAC unitialized variable fix (#773)
Fixes #750
2025-10-08 15:17:17 -07:00
Earle F. Philhower, III 6bc8f56092 For I2S, only enable mclkPin if it's actually used (#772)
Fixes #761
2025-10-08 15:04:06 -07:00
Earle F. Philhower, III 297943c8a8 Update version 2025-10-08 10:46:52 -07:00
Earle F. Philhower, III d9e1ea710b Don't set I2S rate unless it's different (#771)
On the ESP32 it seems the i2s clock set will cause a hiccup, even
if it's setting the exact same clock as before.

Avoid it by only setting the I2S clock if it differs from the last set.
Initialize it to 0hz to ensure the first setRate call always works.

Supercedes #656
2025-10-08 10:36:16 -07:00
Earle F. Philhower, III a3e6f97862 Add auto-release GH action 2025-10-08 10:07:53 -07:00
Earle F. Philhower, III 069945007d Pin GH actions to SHA (#770) 2025-10-08 09:28:03 -07:00
Earle F. Philhower, IIIandCopilot Autofix powered by AI 402278ab11 Potential fix for code scanning alert no. 9: Array offset used before range check (#769)
Very minor fix for damaged SoundFont files.

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2025-10-08 09:21:26 -07:00
Earle F. Philhower, III b09bad5b9c Fix stale acction warnings 2025-10-08 09:11:53 -07:00
Earle F. Philhower, III acc4dc426d Add CodeQL GH action (#768) 2025-10-08 09:05:51 -07:00
Earle F. Philhower, III 18796abb1e Up GH action operations 2025-10-08 08:28:51 -07:00
Earle F. Philhower, III df171f5657 Add stale issue tracker GH action (#766) 2025-10-08 08:26:34 -07:00
Earle F. Philhower, III 41309312d7 Remove error when ULP included on 8266/Pico (#767)
Fixes #760
2025-10-08 08:25:30 -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 88a82209fd Remove ESP32 NDEBUG redefinition warnings (#741) 2025-04-11 12:16:20 -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 7e2b839f21 Update README.md 2025-01-22 13:33:31 -08:00
Earle F. Philhower, III 3044568f85 Update version 2024-12-31 10:30:46 -08:00
Earle F. Philhower, III 8adeb31d20 Automate version bumps, avoid manual mistakes (#725) 2024-12-31 10:30:06 -08:00
Earle F. Philhower, III cdd07c92c2 Only block tsf.h on Xtensa ESP32, not RISCV (#722)
Fixes #721
2024-12-19 14:33:24 -08:00
Earle F. Philhower, III aafabf2367 Ensure MP3 can safely exit on OOM (#716)
Fixes #715.  Good catch, @EternityForest
2024-12-19 09:33:01 -08:00
Earle F. Philhower, III 90b83fb95e Update README.md 2024-12-18 15:11:36 -08:00
Earle F. Philhower, III fbe69b8cd8 Fix AAC HR decode on RP2040
U64 big/little endian mismatch for ARM cores.  Remove the whole PowerPC support option as there aren't any commerically significant PPC embedded systems still being developed.
2024-12-18 14:39:07 -08:00
Earle F. Philhower, III 2f43b3b57d Update README.md 2024-10-14 17:48:14 -07:00
Earle F. Philhower, III 0e5870a440 Update library.properties
dot_a_linkage seems to cause issues with CI
2024-10-08 18:24:41 -07:00
Earle F. Philhower, III 7e50a43b4b Update README.md 2024-10-08 18:13:22 -07:00
Earle F. Philhower, III 1278b10717 Update library.properties 2024-10-08 17:51:13 -07:00
Earle F. Philhower, III 235bcb12de Fix UTF-8 warning in RCSL doc 2024-10-08 13:59:49 -07:00
Earle F. Philhower, III a4a974363d Update Arduino Lint GH Action 2024-10-08 13:56:03 -07:00
Earle F. Philhower, III 79208f6701 Fix GCC14-detected warnings (#711)
* Fix pedantic GCC14 warnings on calloc order
* Ensure AAC read-in doesn't overflow internal structures when the file is corrupted/illegal.
2024-10-06 16:53:22 -07:00
Earle F. Philhower, III a0a4a00757 Fix release numbering 2024-09-21 09:26:24 -07:00
Earle F. Philhower, III c93201483f Update pr-or-master-push.yml (#687) 2024-06-06 14:59:31 -07:00
Earle F. Philhower, III a6141473fb Update for ESP32 Arduino 3.x (#685)
Implement the renamed network client and other API changes when built
under the 3.x branch of the Arduino ESP32 core.

Disable building TSF on the ESP32, the Xtensa G++ backend bug is still there.

Minimal changes to get I2S to build under new IDF.  Deprecated but
not removed, so warnings are expected but should not be fatal in
use.

Fixes #683
2024-06-06 14:43:45 -07:00
Earle F. Philhower, III 492a5beba4 Update GH CI actions to latest (#681) 2024-04-17 10:22:17 -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 b3c41668a2 Fix GCC12.3 new warnings for RP2040 (#679)
* Fix GCC12.3 new warnings for RP2040

* Remove OPUS encoder, not supported on embedded
2024-04-16 16:32:16 -07:00
Earle F. Philhower, III 139fba4116 Update opusfile.c (#678) 2024-04-16 15:14:14 -07:00
Earle F. Philhower, III b7d89058dd Update polyphase.c 2024-04-16 15:11:31 -07:00
Earle F. Philhower, III e306df208c Update AudioOutputSPDIF.h 2024-04-16 15:10:49 -07:00
Earle F. Philhower, III f6c0d562f8 Update AudioOutputSPDIF.cpp (#677) 2024-04-16 15:10:24 -07:00
Earle F. Philhower, III 12131e9826 Update README.md 2023-01-28 14:32:54 -08: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
Earle F. Philhower, III 72ed4f76dd Update pr-or-master-push.yml 2022-09-01 12:15:29 -07:00
Earle F. Philhower, III a323627243 Update pr-or-master-push.yml 2022-08-31 10:54:49 -07:00
Earle F. Philhower, III bf31f0f8be Update macros.h 2022-08-31 10:52:24 -07:00
Earle F. Philhower, III 02225bcaa9 Fix overflow with x256 oversampling in I2SNoDAC (#543)
Fixes #542
2022-06-14 08:23:22 -07:00
Earle F. Philhower, III c4bf70bccf Fix typo in README (#541)
Fixes #540
2022-06-13 08:32:18 -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 b987ca3540 Update library.properties 2022-05-31 09:37:03 -07:00
Earle F. Philhower, III 19f802923d Update library.json 2022-05-31 09:36:45 -07:00
Earle F. Philhower, III 9a9e030d90 Add more tests to host testing in CI (#534)
Add more tests to host testing in CI
Fix FLAC potential 1st sample output oddity
2022-05-19 17:17:21 -07:00
Earle F. Philhower, III 879fe48b78 Clean up ESP32 I2S interface undefineds (#533) 2022-05-19 13:17:07 -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 be8b8efbf2 Clean ESP32 build (#529) 2022-05-18 18:43:50 -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 20943870a9 Fix #define protection macro name 2022-02-09 08:33:23 -08:00
Earle F. Philhower, III dca33f80c7 Update library.properties 2021-12-17 19:32:45 -08:00
Earle F. Philhower, III faa8b094c9 Update library.json 2021-12-17 19:32:29 -08:00
Earle F. Philhower, III 933439fa3f Update README.md 2021-12-17 11:42:16 -08:00
Earle F. Philhower, III de30f61899 Update to Rel 1.9.4 for ESP-C3 support (#455) 2021-11-30 12:28:02 -08: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 5411abef6b Update Linear Clock links 2021-10-19 12:19:10 -07:00
Earle F. Philhower, III 9dd4f24056 Update library.properties 2021-09-08 08:58:14 -07:00