Plotting F0 with librosa

541 views
Skip to first unread message

William Hobbs

unread,
Apr 9, 2021, 11:07:13 PM4/9/21
to librosa
Hi all! I apologize if this is way too basic, but I just can't figure out how to get an array of simple frequencies from a wav file in librosa. I would eventually like to make a graph plotting fundamental frequencies against time. I have no doubt that a module as fancy as this one would allow that, but I don't see how to do it. Can anyone help? Thanks! William

Tiago Tavares

unread,
Apr 10, 2021, 7:22:26 PM4/10/21
to William Hobbs, librosa
Hi William, 

I believe what you are looking for is to open a wave file then calculate the F0 in short-time frames. From the documentation  (https://librosa.org/doc/latest/generated/librosa.pyin.html#librosa.pyin), you get a straightforward example:
y, sr = librosa.load('some_wavefile.wav')
f0, voiced_flag, voiced_probs = librosa.pyin(y, fmin=librosa.note_to_hz('C2'), fmax=librosa.note_to_hz('C7'))
Then, f0 will have your fundamental frequency array.

I hope this helps!!

Tiago

On Sat, Apr 10, 2021 at 12:07 AM William Hobbs <hobbsbu...@gmail.com> wrote:
Hi all! I apologize if this is way too basic, but I just can't figure out how to get an array of simple frequencies from a wav file in librosa. I would eventually like to make a graph plotting fundamental frequencies against time. I have no doubt that a module as fancy as this one would allow that, but I don't see how to do it. Can anyone help? Thanks! William

--
You received this message because you are subscribed to the Google Groups "librosa" group.
To unsubscribe from this group and stop receiving emails from it, send an email to librosa+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/librosa/7d233d93-e0fc-4791-b02d-6d8c61b72686n%40googlegroups.com.


--
Reply all
Reply to author
Forward
0 new messages