spotify / basic-pitch

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

Using basic-pitch in an iOS application #61

Open adamjuls opened 1 year ago

adamjuls commented 1 year ago

Hi,

I would like to use basic-pitch in an iOS mobile application. It seems that it is possible to convert the model into a tflite. format, but I am stuck trying to change the output into MIDI notes. Can someone help me with suggesting Pretty MIDI alternatives that work well with the basic pitch model for Swift?

martingasser commented 1 year ago

It shouldn't be too hard to port the Python code that converts the model outputs to notes (https://github.com/spotify/basic-pitch/blob/ad9ab8a65d18a1cb06dee25f45855acc4598a10a/basic_pitch/note_creation.py#L46) to Swift, you could even try using a numpy-like library like https://github.com/jjjkkkjjj/Matft.

I did the same thing in C++ using the xtensor library and using onnxruntime for model inference, works great.

adamjuls commented 1 year ago

Thank you for answering my question @martingasser . By any chance is your C++ implementation open source?

e7mac commented 10 months ago

@adamjuls did you end up making this work?