spotify / basic-pitch-ts

A lightweight yet powerful audio-to-MIDI converter with pitch bend detection.
https://basicpitch.io
Apache License 2.0
212 stars 15 forks source link

NoteFramesToTime Issue - TypeError invalid attempt to spread non-iterable instance. #7

Closed mike3osei closed 1 year ago

mike3osei commented 1 year ago

Hey all, amazing library. As I was setting it up I ran into:

Screen Shot 2022-09-28 at 5 44 21 PM

It looks like the onsets, frames, and contours, get defined. Pct is 1 as well after await basicPitch.evaluateModel. The problem i'm running into is after the model runs noteFramesToTime(addPitchBendsToNoteEvents())) keep throwing errors. I was wondering if ya'll had run into this by any chance? It seems to be happening around toMidi && globalMax.

I'm using NextJs and typescript as well. I verified that my audioRecording was a mono recording and set to the correct sampleRate.

mike3osei commented 1 year ago

Wrapping contours and onsets with an outer array fixes this issue for me.

const notes = noteFramesToTime( addPitchBendsToNoteEvents( [contours], outputToNotesPoly(frames, [onsets], 0.25, 0.25, 5), ) );