LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

frequency and duty cycle measurement

Hi Friends,
 
Its been very helping from the day 1 i started psoting my questions to this forum...
Now again its time to seek ur help...
 
My req is something like i  have a sound waveform (say a tone) saved as a .wav file.
Say suppose 1.wav.................
 
I need to evaluate this wave at a particular interval and should be able to calculate duty cycle, dB level, output frequency and peak to peak voltage similar to a CRO.
 
I already tried with the below VI but its showing for the entire .wav, so need to do some modifications which attains my req, but i am not sure where to kick off....
 
So anybody who have worked or developed similar VI in past ,please share your exp's
 
Thanking you in advance.
 
Cheers,
Suneel.V
0 Kudos
Message 1 of 39
(5,455 Views)
Hi svelamal,

If you want to analyze a subset of your waveform, you can use the Get Waveform Subset VI in the Waveform palette.  This VI will let you specify a range of samples or time to extract from the input waveform.


Regards,

Jeremy_B

Applications Engineer
National Instruments
0 Kudos
Message 2 of 39
(5,420 Views)
Hi Jeremey,
 
I tried with the Get Waveform Subset VI but looks like i messed up.
Let me clearly tell you what i ve done so far.
  • Select a .wav( sound wave file) file from a path.
  • Read the file and calculate the parameters (frequency, Dutycycle ....)
  • Also able to put cursors on the graph and select a specific location on the graph (four yellow lines on graph indicator)

But right now the req is

  • Need to get the selected graph thru cursors to a new wave file.
  • calculate the same ouput parameters to the selected graph.

Please see the attached VI and help me in modifying with my requirement.

cheers,

Suneel

0 Kudos
Message 3 of 39
(5,402 Views)
Hi Suneel,

Have a look at the example VI at this link: http://zone.ni.com/devzone/cda/epd/p/id/4149
I think it will do what your looking for.  It will get a waveform subset based on cursor positions on a graph, and then graph the waveform subset.  You could then pass the resulting waveform into whatever processing you need.
Regards,

Jeremy_B

Applications Engineer
National Instruments
0 Kudos
Message 4 of 39
(5,380 Views)

Thanks Jeremey,

Looks like this is the ideal example....

But right now i dont have enough effort hours left to implement it to my VI's....

But for sure out of my interest i will come on the weekend and work for it...

Thanks again for you help....

Now i am supporting one of our other project which need a proper timer concept...

Sorry for putting here but again needed ur help...

Requirement is something like this....

  • A button press should start the clock (milliseconds..)
  • At the backend it should continue the clock.
  • Again a button press should stop the clock and give the time in (ms or s)
  • Reset the clock to 0 and again wait for the next press..

This i am trying to implement today....

Any help from your end is very much appreciable..

 

Cheers,

Suneel

0 Kudos
Message 5 of 39
(5,368 Views)

Hi Suneel,

You could have your button press execute a case statement which gets the current value of the millisecond timer (Tick Count (ms) VI in the Timing palette), and then record the value again after your other button press, and then subtract the two.

 

Regards,

Jeremy_B

Applications Engineer
National Instruments
0 Kudos
Message 6 of 39
(5,348 Views)

Hi Jeremy,

This is Suneel, today i tried to impement waveform_extractor.vi to my program.

But unfotunately thats not working out.

  • As i explained you before my req is i need to take a .wav file from a path,
  • read it and then use this waveform extractor.vi
  • extract the waveform upto a particular time period and apply some functions to calculate the frequency and duty cycle.

I've attached the VI where i am getting broken arrows for the same logic of waveform extraactor .vi

also attached the .vi

Please repair it and re-send the same

Awaiting for ur reply

Cheers,

Suneel/svelamal

0 Kudos
Message 7 of 39
(5,279 Views)

That is because you have multi-channel sound data and the output of the Sound File Read is an array of waveforms. See image below:

I added an index array just to show you that there is in fact an array of waveforms.  Now, the rest of the code will not be happy with dealing with a single waveform, and I do not know which channel information you want to deal with.

RayR



Message Edited by JoeLabView on 06-29-2008 08:09 AM
0 Kudos
Message 8 of 39
(5,273 Views)
Thanks Joe,
 
I modified and looks like the VI is now ok.
But sometimes its showing some error.
Anyways i will try to look into that...
 
Once again thanks for your prompt response....
 
 
Cheers,
Suneel.V
0 Kudos
Message 9 of 39
(5,256 Views)

Joe/Jeremey,

I am facing some new issue with the VI,

Frequency and Duty cycle are coming but the problem is something like the JPG attached.

Its not frequent and only coming for a particular part of the waveform

Is it waveform (.wav) dependent, if so let me know how to debug this.

 

Attached the VI (modified), snapshot of error and also wavefile (.wav)

P.S: error coming only when the yellow lines selected to the first quarter of the wave.

Cheers,

Suneel.V

0 Kudos
Message 10 of 39
(5,247 Views)