Hi Liddy,
LabVIEW comes with several functions to play "tones" aka waveforms on your speakers. Did you play with them?
They are called SoundOutput-Configure, -Play, -Stop:
The sound stops as soon as the error data arrives at the sequence frame…
02-22-2018 10:46 AM - 已編輯 02-22-2018 10:47 AM
Also use an event structure to capture key down and key up events. I show them in the same event frame but they could just as easily be separated into different frames. Check the scancode for the equivalent of spacebar and use this to toggle the sound on/off using Gerd's post above.
Thank you. I have been reading documentation and trying to use the key down event. I keep getting an error that there is no case for some selector values (fig. 1 below). I tried to start by turning on an LED during a key down event and turning it off when the key is released. If I can get the key down event to work I'm hoping I can move to turning on =audio for the duration of a key press and off when they key is released. I was able to turn on an LED for the duration of a key press (any key) and off with a key release using the structure in Fig. 2. I essentially want to do the same thing with an audio tone with a frequency of 500 Hz.
Fig. 1
Fig. 2
Thank you for your help. It's been three days and I still cannot figure this out.
在 02-22-2018 02:58 PM
I would put the audio portion of the code in an action engine so you can call a play or stop function easily within the event structure. This works with WAV file format. Each press of the spacebar restarts the audio file from the beginning. I think it can be restarted from the last position it stopped but that isn't the way I wrote this.
Thank you very much!
Is there a way I can stop the event structure without using a Boolean Stop? I would like to stop the event structure when the For Loop it is within stops.
Hi Liddy,
Is there a way I can stop the event structure without using a Boolean Stop?
You don't "stop" an event structure…
But you can enforce the event structure to execute within a certain time limit using the timeout event…
I would like to stop the event structure when the For Loop it is within stops.