Upstream / Original Project: ysharma3501/FlashSR
This Go implementation is based on and inspired by the original FlashSR project.
flashsr-go is a Go library and CLI for FlashSR audio super-resolution.
It runs the FlashSR ONNX model to convert speech-like audio to 48 kHz output.
- Library API for in-process audio pipelines.
- CLI for WAV input/output workflows.
- Streaming wrapper with overlap/crossfade behavior.
- Optional resampling for non-16 kHz inputs.
- Browser demo kernel compiled to Go/WASM.
- Go
1.25+ - ONNX Runtime shared library (
libonnxruntime)- Linux:
.so - macOS:
.dylib - Windows:
.dll
- Linux:
FlashSR uses github.com/yalue/onnxruntime_go, which loads ONNX Runtime dynamically.
Set the library path with FLASHSR_ORT_LIB or --ort-lib.
Build:
go build -o flashsr ./cmd/flashsrSet ONNX Runtime path:
export FLASHSR_ORT_LIB=/path/to/libonnxruntime.soRun environment checks:
./flashsr doctorUpsample a WAV file:
./flashsr upsample --input in.wav --output out_48k.wavUse explicit input rate override:
./flashsr upsample \
--input in.wav \
--output out_48k.wav \
--input-rate 24000Use streaming mode:
./flashsr upsample \
--input in.wav \
--output out_48k.wav \
--stream \
--chunk-size 4000flashsr upsample: WAV -> 48 kHz WAVflashsr doctor: model + ONNX Runtime diagnosticsflashsr model download: fetch model from Hugging Face
Download model manually:
./flashsr model download --out assets/model.onnxUseful environment variables:
FLASHSR_ORT_LIB: path tolibonnxruntimeFLASHSR_MODEL_PATH: override embedded model fileHF_TOKEN: Hugging Face token for gated/private model access
package main
import (
"os"
"github.com/MeKo-Christian/flashsr-go/flashsr"
)
func main() {
u, err := flashsr.New(flashsr.Config{
ORTLibPath: os.Getenv("FLASHSR_ORT_LIB"),
InputRate: 24000, // auto-resample to 16 kHz before inference
})
if err != nil {
panic(err)
}
defer u.Close()
in := []float32{0, 0.1, -0.1} // example PCM
out, err := u.Upsample16kTo48k(in)
if err != nil {
panic(err)
}
_ = out
}The repository includes a browser demo in web/ with an explicit wasm kernel in
cmd/flashsr-wasm.
Behavior:
- Upload a WAV file.
- Analyze sample rate quality.
- If input sample rate is below
48 kHz, resample to48 kHz. - If input sample rate is
>= 48 kHz, keep the original WAV bytes.
Local run:
./web/build-wasm.sh
python3 -m http.server 8080 -d web/distor:
just web-demoOpen: http://localhost:8080
GitHub Pages deploy is defined in:
.github/workflows/deploy-pages.yml
It builds web/dist/flashsr-kernel.wasm, copies wasm_exec.js, and uploads
web/dist as the Pages artifact.
Run tests:
go test ./...Useful just targets:
just testjust lintjust cijust web-demo
- Embedded model:
assets/model.onnx - Pinned model hash is
model.ExpectedSHA256inmodel/model.go. - The ORT backend currently reports provider
CPU.
MIT license for this repository code.
See:
LICENSENOTICETHIRD_PARTY_NOTICES.md