Repository navigation
Support SF3 soundfonts, update TinySoundFont, add tests and CI - #6
Merged
Merged
Conversation
Vendor stb_vorbis v1.22 as its own translation unit and include its declarations ahead of tsf.h, which turns on TinySoundFont's existing SF3 (Ogg Vorbis compressed samples) path. Update tsf.h to upstream (2025): sustain pedal (MIDI CC 64) and tsf_channel_set_sustain, velocity 0 note-on as note-off, LIMITATTN unit fix, realloc and packing fixes. The README notes that SF3 samples are decoded at load time and that stb_vorbis should only be fed trusted files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Exposes TinySoundFont's tsf_channel_set_sustain: while held, noteOff keeps notes sounding until the pedal is released. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
commonTest loads an SF2 fixture (TinySoundFont's florestan-subset) and an SF3 made from it by scripts/make-test-sf3.py, then checks presets, rendering, stereo panning, the sustain pedal, close() and rejection of non-SoundFont data. They run natively on the host (linuxX64Test, macosArm64Test; the fixtures path comes from an environment variable) and on a device via connectedAndroidDeviceTest. The Test workflow runs linuxX64Test on pull requests and pushes to master, which exercises the same native code without an Android emulator. gradlew is now executable in git. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SF3 support. Vendors stb_vorbis v1.22 (
native/src/stb_vorbis.c, compiled as its own translation unit).tsf.cincludes its declarations beforetsf.h, which turns on TinySoundFont's existing SF3 code path: Ogg Vorbis compressed samples are decoded when the font loads. No API change;MikroSoundFont.loadaccepts.sf3bytes on every platform.TinySoundFont updated to current upstream (2025): sustain pedal (MIDI CC 64), note-on with velocity 0 acts as note-off,
LIMITATTNunit fix, realloc and struct packing fixes.tsfCInterop.hgainstsf_channel_set_sustain.Channel.setSustain(Boolean)exposes the new sustain call on Android and Kotlin/Native.setMidiControl(64, …)reaches it as well.README documents SF3: samples are decoded up front (slower load, several times the file size in memory), and stb_vorbis isn't hardened against malformed input, so only trusted
.sf3files should be loaded.Tests and CI. First test suite:
commonTestruns every case against an SF2 fixture (TinySoundFont'sflorestan-subset.sf2) and an SF3 made from it (scripts/make-test-sf3.py): presets, rendering, stereo pan, sustain pedal,close(), rejecting non-SoundFont data. Runs natively on the host (linuxX64Test,macosArm64Test) and on a device (connectedAndroidDeviceTest). NewTestworkflow runslinuxX64Teston PRs and master pushes, no emulator needed.gradlewis now executable in git.Supersedes #2, which proposed SF3 via stb_vorbis on the old CMake/JNI build; thanks to @Von-Cheam for raising it.
Test plan
./gradlew assemblefor all targetsmacosArm64Test: 11/11connectedAndroidDeviceTeston SM-S948B (Android 17): 11/11linuxX64Test: green (~2 min)libtinySoundFontstubs.sostill 16 KB aligned (65 KB → 150 KB)iosSimulatorArm64Test: not run, no simulator runtime installed locally🤖 Generated with Claude Code