sapfir - Create sf2 from recorded sample

Meant for chopping breaks and vocals to make boom bap with the Helio
sequencer on Android or the Ardour DAW on GNU/Linux when external
plugins are unavailable. For serious SoundFont editing, consider
SpessaFont: https://github.com/spessasus/SpessaFont

git clone https://codeberg.org/nykula/sapfir
cd sapfir
npm i
>TimGM6mb.sf2 curl https://www.timbrechbill.com/saxguru/TimGM6mb.sf2
>'slow funk.mp3' curl https://archive.org/download/377DrumLoopsSamplePack/2023-07-18%20-%20202%20-%2065%20bpm%20-%20slow%20funk-y.mp3
npx http-server

On GNU/Linux, Firefox is ok; on Windows, only Chromium-based browsers
give me the required setInterval precision. Tested with Firefox 139
and Edge 137.

Before committing, apply Prettier:

npx prettier --write --use-tabs index.js

Rebuild node_modules/essentia.js/dist/essentia-wasm.web.wasm from
source, tested on Debian trixie:

sudo apt-get install cmake emscripten git libeigen3-dev pkgconf
bash android/app/essentia-dependency.sh init
bash android/app/essentia-dependency.sh build

Android build:

cd android
gradle installDebug

Regenerate icon:

grep -v foreground icon.svg >ic_launcher_background.svg &&inkscape --export-background-opacity=0 --export-filename=android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_background.png --export-width=432 --export-height=432 ic_launcher_background.svg 2>&1 |grep -Eve WARNING -e '^$'
grep -v background icon.svg >ic_launcher_foreground.svg &&inkscape --export-background-opacity=0 --export-filename=android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png --export-width=432 --export-height=432 ic_launcher_foreground.svg 2>&1 |grep -Eve WARNING -e '^$'
inkscape --export-background-opacity=0 --export-filename=fastlane/metadata/android/en-US/images/icon.png --export-width=512 --export-height=512 icon.svg 2>&1 |grep -Eve WARNING -e '^$'
pngquant $(find android/app/src/ fastlane/ -name '*.png') --ext .png --force

Before commiting, apply google-java-format:

google-java-format -i app/src/main/java/org/codeberg/nykula/sapfir/MainActivity.java

To release, bump version in package.json, versionCode and versionName in android/app/build.gradle and push v1.0.0 git tag.

Copyright (c) 2025 Denys Nykula <nykula@ukr.net>

License: AGPL-3.0-or-later

Dependencies: spessasynth_core, essentia.js, Preact
