TinySoundFont icon indicating copy to clipboard operation
TinySoundFont copied to clipboard

Fixed-point version for FPU-less systems

Open Cacodemon345 opened this issue 1 year ago • 5 comments

A fixed-point version of the library would be nice for systems with no FPU (e.g. 32-bit ARM systems with enough memory to handle reasonable soundfonts) and also for purposes of using it in the likes of SBEMU/VSBHDA (where reliance on the FPU can cause problems).

Cacodemon345 avatar Apr 10 '24 14:04 Cacodemon345

This should benefit systems with weak FPUs, such as the Vortex86 or VIA CPUs. For example, a 933 MHz Vortex86MX has FPU performance comparable to a Pentium II 350 MHz and is incapable of handling real-time MIDI synthesis:

https://youtu.be/klvMr7NKQq8

viti95 avatar Jan 27 '25 11:01 viti95

Yes, it would be nice to do a fixed point version (for eg raspberry pi pico) and also make it independent of little endian.

alexriegler12 avatar Feb 04 '25 20:02 alexriegler12

FWIW I've had a (mostly) fixed point port of TinySoundFont for microcontrollers like the ESP8266, ESP32-family, and Raspberry Pi Pico-family in ESP8266Audio.

As of now there are still floating point operations in the envelope calculations (because getting the dynamic range right is a bear, at least for me). The latest version just converted SF2 loading( to use ROM arrays directly (which should work on the R.Pi SBCs just be in RAM) since the total RAM for these microcontrollers can be as low as 40KB of heap. On the RP2040 Pico it handles relatively complex MIDs at 22KHz stereo in realtime. On the RP2350 (which has a single precision FPU) it's good enough for 44.1khz on many moderately complex MIDs.

earlephilhower avatar Oct 21 '25 17:10 earlephilhower