cancel
Showing results for 
Search instead for 
Did you mean: 

Need help with VI

Highlighted
UCF_Michelle
Member

Need help with VI

Message contains an attachment

Hello!

 

So I am in search of some guidance. I have a labview code in which I have it generate a sine wave frequency sweep with the increment of frequencies and duration per frequency I set it to. I now need the code to still perform the same task, but I need to be able to turn off the sound for a desired duration which can vary between frequencies and start again where it left off. For example, if i have a sweep from 200 hz to 260 hz with an increment of 5 hz, I want to be able to play the 200 hz frequency for a second, stop the frequency for a second and then play the next frequency in this case 205 for a second, stop it for a second and repeat this until it reaches 260. 

 

Can anyone help me with this? I have attach my VI. The Vi is somewhat all over the place, but it basically generates the sine wave and then records data that I capture using microphones. 

 

Thanks in advance for the help. 

6 REPLIES 6
Yamaeda
Proven Zealot

Re: Need help with VI

If you generate the signal as 1 sec (which it looks like you're doing), you only need to add a 2sec wait in the playing loop, then it'll play for 1 sec and be silent for 1.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
crossrulz
Knight of NI

Re: Need help with VI

My thought was that you could just append a waveform that is just 0 for the 1 second (use Initialize Array with the needed number of samples, unbundle the Y out of the waveform, append the new array, write back into the Y for the waveform and then write that to the sound card).

 

Additional thought:

You only need 1 queue to send data to the logging loop.  Just make the data type a 2D array.  The From DDT should be configured to output a 2D array and that can be enqueued directly.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
UCF_Michelle
Member

Re: Need help with VI

I tried that but the wait only happens in the beginning not between the frequencies. 

 

Thanks 

crossrulz
Knight of NI

Re: Need help with VI


@UCF_Michelle wrote:

I tried that but the wait only happens in the beginning not between the frequencies.


Which "that" did you try?  Can you share your code so we can possibly see if you did something wrong?



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
UCF_Michelle
Member

Re: Need help with VI

Message contains an attachment

I tried adding a wait delay in the section of my code to have the sound play for a second and stop for a second but that did not work. I need to be able to play the frequency of my preference for a desired amount of time, stop the frequency, again for a desired time and play the next frequency repeating the same loop. I also need to make sure although the sound is not playing, my DAQ is still capture data. So basically, I am interested in capturing the decay rate of different frequencies. I attached my code for reference. 

 

Thank You 

crossrulz
Knight of NI

Re: Need help with VI


@UCF_Michelle wrote:

I tried adding a wait delay in the section of my code to have the sound play for a second and stop for a second but that did not work.


Your wait is after the loop.  That is not going to work for you.

 

Move your DAQ into a separate loop that can run in parallel with your generation loop.  Then move your wait to be inside of your generation loop.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5