41 lines
1.9 KiB
Plaintext
Executable File
41 lines
1.9 KiB
Plaintext
Executable File
This is a ported and significantly modified version of TinySoundFont by
|
|
Bernhard Schelling. https://github.com/schellingb/TinySoundFont
|
|
|
|
TinySoundFont lets you use a SoundFont2 library (sampled MIDI instruments)
|
|
to play high quality music with a single #include.
|
|
|
|
Porting and modifications done by Earle F. Philhower, III
|
|
<earlephilhower@yahoo.com> and released under the GPL v3 or later.
|
|
|
|
The changes to allow it to work on the ESP8266 consisted mostly in making
|
|
it significantly less memory intensive and speeding up the inner loops by
|
|
using fixed point arithmetic instead of floating point. This change to
|
|
fixed point lets us use simple integer math, which is massively faster than
|
|
the software FP libraries on the ESP8266, but does come at the cost of a
|
|
slightly increased noise floor.
|
|
|
|
On the memory side, all data structures were converted into a "lazy"
|
|
allocation which means that instead of loading the full contents of the
|
|
header bits into RAM (which is often WAY more than the 40KB available on
|
|
the EPS8266), only those bits needed are loaded, and only when they are
|
|
needed.
|
|
|
|
Also, instead of loading the entire sample array into memory (i.e. nearly
|
|
500MB for a good piano sample), only a very small portion is loaded into a
|
|
LRU *cache* area.
|
|
|
|
Even with the caching, it was found that SPIFFS, while having great
|
|
functionality, was horrbly slow. So I wrote a new "faster" ROM filesystem
|
|
called, surprisingly, FastROMFilesystem.
|
|
https://github.com/earlephilhower/ESP8266FastROMFS
|
|
If you are getting choppy playback, try this new filesytem or using a SD
|
|
card (not tested by myself, but it'd be hard top be slower than SPIFFS).
|
|
Simply going from SPIFFS to FastROMFilesystem took my testing of
|
|
FURELISE.MID and 1MGM.SF2 from 0.5x realtime to 2.5x (i.e. from unusable
|
|
stuttering to plenty of time to do other tings on the ESP8266) for the
|
|
first 20 seconds or so tested.
|
|
|
|
-Earle F. Philhower, III
|
|
earlephilhower@yahoo.com
|
|
|