LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Graphing Frequency and Time of a Waveform

Hello all,

 

Just wanting to know if there is a way to graph frequency on the y-axis and time on the x-axis of a waveform subset 2 second subset to be exact). I'd like to be able to see the frequency change over time with the y-axis ranging from 0 to whichever the highest read frequency is, in Hz. 

 

Thanks for any help! 

0 Kudos
Message 1 of 16
(2,505 Views)

Hi aj,

 

so you need something like a spectrogram?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 16
(2,498 Views)

Thanks for the reply Gerd, I read up on spectral measurements tried the express VI and it seems close to what I'm looking for but not quite. 

 

Let me digress, I'm no electrical engineer, but I'm interested in music and lightshows so that's what I'm researching. Though, LabView has been eating me up lately.

 

As a small part of a project I'm doing, I'm trying to recreate a BPM engine, where I load a song's waveform into LabVIEW and then I get the BPM of that song. I found a group a short report by a group of students that did this on MatLab so I've been trying to model this after their work. I'm having trouble making the cross-over but it's got to be possible on LabVIEW. 

 

Report of MATLAB BPM engine: https://www.clear.rice.edu/elec301/Projects01/beat_sync/beatalgo.html

0 Kudos
Message 3 of 16
(2,459 Views)

For what you are trying to do (create a BPM machine), a spectrogram might not be (quite) what you want.  I should say that I'm not an engineer, either, but I also would not use the algorithm in the Matlab reference you cite.  Particularly if the music has an obvious beat, much simpler (and far faster) algorithms suggest themselves (but what do I know?).

 

One nice thing about LabVIEW (which is borne out by its name, spelled out in full and not as an Acronym) is that it simplifies building Virtual Instruments that you can test rapidly and ask the question "Is this a Good Algorithm to analyze These Data?", allowing you to experiment.  My suggestion would be to "step back" from the problem -- what are your data, what is the "signal" that you think is buried in the data, how might you accentuate the signal (by, say, digitally manipulating it), and how might you analyze the signal?  LabVIEW provides "tools" (VIs, functions, "wires") that let you create, re-create, measure, evaluate "software Instruments" (a.k.a. Algorithms) and try out ideas quickly, never having to pick up a soldering iron or hook up an oscilloscope ...

 

Bob Schor

Message 4 of 16
(2,421 Views)

Hello all,

 

I've been fumbling around trying to build a code to read the BPM of a song that gets uploaded into a file read VI (.wav) for a month now. It's only part of a greater plan I have. I'm quite out of tries now and am wondering if anyone has done something like this or has any idea what might be the best way to go about. I've created a bandpass filter that smooths and rectifies the individual bands but I'm not sure if I can have the code read and determine BPM from these envelopes of my waveform. Lately I've been led to believe that LabVIEW has  much simpler way of doing what I need but that's all the info I was given. 

 

Any ideas? 

 

Thanks

Adam 

0 Kudos
Message 5 of 16
(2,392 Views)

Thanks for this piece Bob, 

 

No I'm curious as to what the simple solution could be. 

0 Kudos
Message 6 of 16
(2,367 Views)

Close your eyes and imagine listening to music (to make it more obvious, make it loud disco music with an obvious "beat").  Imaging you had a tape recorder with a "VU" meter -- can you see the needle "moving to the beat"?  You need a way of estimating "loudness" and how it varies as a function of time.  Think about what frequency it might be varying?  Are you a musician?  Do you know about "Time Signatures"?  They are typically expressed as "Beats per minute", which is another hint.

 

[I knew being a physiologist would come in handy someday ...].

 

Bob Schor

Message 7 of 16
(2,349 Views)

You speak very poetically, it's enjoyable to read. Haha! I'm a lighting designer in the musical realm, so I live a symbiotic relationship with time signatures. I also live a near symbiotic relationship with house music (today's disco music) so I know that my major repeating frequency is around 120 Hz, a good "kick." 

I just can't seem to find a way to accentuate that frequency. Which is what I believe is how to go about this. 

0 Kudos
Message 8 of 16
(2,344 Views)

Don't bother "accentuating the frequency".  [Reminds me of an Old Song, that also has the line "Don't Mess with Mr. In-Between"].  If you were to calculate the envelope of the Waveform, you would probably see that if you low-pass filtered this envelope, say at 100 Hz (corresponding to 6000 BPM, way higher than you expect), you might "see" the beats ...  [Note -- I don't happen to have any disco music handy here with which to test this "off-the-top-of-my-head" idea, but I would expect it to work ...].

 

Does this seem reasonable to you?  Can you do a quick test?

 

Bob Schor

0 Kudos
Message 9 of 16
(2,339 Views)

I do indeed see the beats, Bob. I also understand how 100 Hz corresponds to 6000 BPM, mathematically. But how does low-pass filtering relate to the tempo? 

0 Kudos
Message 10 of 16
(2,327 Views)