LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need help with VI

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. 

0 Kudos
Message 1 of 7
(1,276 Views)

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! ADDQ VIPM Now on GitHub
"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 7
(1,271 Views)

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.


GCentral
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
Message 3 of 7
(1,259 Views)

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

 

Thanks 

0 Kudos
Message 4 of 7
(1,199 Views)

@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?


GCentral
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
0 Kudos
Message 5 of 7
(1,182 Views)

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 

0 Kudos
Message 6 of 7
(1,171 Views)

@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.


GCentral
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
Message 7 of 7
(1,147 Views)