10-28-2010 11:00 PM
Hey everyone,
I'm using LabVIEW 2010 together with a myDAQ. I'm trying to change the frequency of a sine wave dynamically based on an analog input from the myDAQ. The sine wave will eventually be output to a speaker as a demonstration for how the frequency of a sine wave is related to the pitch of the resulting tone.
I am using a while loop to update the frequency of the sine wave based on the input of the myDAQ. Everything is okay except that because I have to update every x seconds (the loop restarts), the speakers have a nasty little jolt due to the discontinuity when the loop restarts. To avoid this problem, I was wondering if anyone knows of a VI that produces a sine wave and has a function for dynamically changing frequency so I can avoid the loop and thus the periodic start/stops of the sine wave, or, alternatively, if anyone can think of a better way to approach this problem. I'm hoping that it is possible in LabVIEW without the help of something like LabVIEW Real-Time or something.
Also - can anyone tell me more about the Play Waveform VI? I'm using that to play the sine wave with the speakers, but occasionally the buffer fills up or something and I get an error message telling me that it is trying to read samples that don't exist anymore. It suggests that I change some parameters, but the Play Waveform VI doesn't allow me to change anything.
Thanks,
Matt
10-29-2010 02:44 AM
Update - Not to answer my own question, but I think I may have gotten it.
I'm using the Sound VIs now instead of the Play Waveform VI. From what I read there's a buffer in there that helps smooth out the transition between loop iterations. It works as intended. Also, my last problem about samples not being read was also due to a sampling mismatch in my DAQ Assistant I believe. All is right with the world again 🙂