Turning the output of pyin into audio

86 views
Skip to first unread message

Jase offire

unread,
Dec 2, 2022, 12:19:46 AM12/2/22
to librosa
Hello
So, I'm trying to build a tool that will eventually allow me to record my voice, and output usable midi data. Right now, I just want to take the fundamental frequency and turn it into an audio file to hear the results. Alas, I do not understand the output of pyin or numpy itself, really to use the data in a meaningful way.

Brian McFee

unread,
Dec 2, 2022, 6:27:12 AM12/2/22
to librosa
For sonification of f0 estimates, I'd recommend using mir_eval's sonify module.  The pitch_contour function should work more or less directly with pyin's output: https://craffel.github.io/mir_eval/#mir_eval.sonify.pitch_contour 

The librosa example gallery demonstrates exactly how to do this: https://librosa.org/doc/latest/auto_examples/plot_audio_playback.html#sonifying-pitch-estimates

Note that this is continuous(ish) frequency and not midi.  If you want midi, you might want to check out https://librosa.org/doc/latest/generated/librosa.hz_to_midi.html#librosa-hz-to-midi
Reply all
Reply to author
Forward
0 new messages