git.iko.soy/rowtype-yoga/purescript-basic-pitch
on main help sign in

PureScript bindings to @spotify/basic-pitch (polyphonic pitch detection)

git clone ssh://git.iko.soy/rowtype-yoga/purescript-basic-pitch

purescript-basic-pitch

PureScript FFI bindings to @spotify/basic-pitch — a small TensorFlow.js model that transcribes audio into polyphonic note events (a whole chord at once, unlike monophonic pitch detection).

model <- loadModel (ModelPath "/model/model.json")   -- once
notes <- transcribe defaultOptions model samples      -- per recorded burst
chord = pitches notes                                 -- :: Array MidiPitch

samples must be MONO Float32Array at sampleRate (22050 Hz). basic-pitch processes a 2-second window, so feed it a recorded burst — resample mic audio to sampleRate first.

bun install
spago test