From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
01-27-2009 09:58 AM
Hi there,
I am very new to LabVIEW and I am currently making a VI for an electronic drum for a college project.
I was wondering if its possible to modify the Sound File to Sound Output VI so that it has an input which stops and starts the VI.
Basically I have the VI within in a case structure. When the drum is hit, the case structure is true, the Sound File to Sound Output VI plays a sample. When false, it does nothing. The problem is when i hit the drum, the Sound File to Sound Output VI waits for the sound to end before another sound is played again from a hit.
I tried adding a boolean switch connecting to a Compund Arithmetic OR box which is then connected to STOP in the while lop within the Sound File to Sound Output VI. Then made the switch an input for a SubVI using the connector pane. But when I run the Sound File to Sound Output VI now I get a sound card error.
Any help would be appreciated.
01-27-2009 11:50 AM
Zerroth -
LabVIEW works in a way that when an action is iniciated, in this case the Sound File to Sound Output VI the following action (stop sound) will only execute when the Sound File to Sound Output VI has finished.
I'm guessing you are trying to work out drum patterns and drum rolls. which is why you would need to receive a new input before it finishes, am I right?
The way I see it you are limited by the size of your sound file, and your DAQ card, LV can make acquisitions in speeds in the mille seconds, If your sound is that short you can make drum rolls no problem.
As far as I see with some local variables you could make a full drum kit.
Again it all depends on how long your sound file lasts;
Best Regards
Bruno
01-28-2009 08:48 AM
Hi,
It may be beneficial to see the code in this instance. Would that be possible? We can then look at the best way of implementing the sound so that it doesnt wait for the last sound to finish before playing the next one. The application sounds very interesting though!
As Bruno said, because LabVIEW is a dataflow development environment, a node will not execute until all the inputs it needs are available. This may be what is happening, where the sound file is a required input for the next node and has to finish before the next one starts.
Best Wishes,
01-28-2009 12:44 PM
Hi there,
Thanks for replying.
Using Sound Forge I made the sound shorter the sound sample shorter. It works better but you dont here the sound as well.
I have attached the Drum VI to the this post.
Again, thanks for the help.
Emile
01-29-2009 08:44 AM
01-29-2009 10:24 AM
Emile -
I was discussing your application with the guys here at AE department of NI Brazil. After some discussion on what could and could not be done and a couple testes, and analysing your code we came up with an idea.
Inside the Sound File to Sound Output.vi you will need a reset button associated to a local variable. Each time the drum pad is hit the local variable will reset the sound. This means that the sound will be played until it receives a reset command so the sound can either play till the end or be cut during the execution. Speed of the reset button will depend on your computer but it should be in the range of a couple milliseconds.
However, analising the VI I noticed that it defines the number of samples per iteration. This means that the sound is split into interations each with a defined number of samples. If the reset button is pressed, it will only execute at the end of the interation, which means you may have unwanted delay.
A way around this problem is using Active X to access the Windows media player to play the sound. With the media player you can stop the sound in the middle without any problems. I have included a simple Active X vi below.
The volume can also be adjusted in the Sound File to Sound Output.vi
there is subVI called Sound Output set Volume.vi (it is inside the while loop ). This VI determines the sound level of your signal. You are going to have to use some logic here to adjust your signal strength to be a value between 0 and 100 and perhaps again use a local variable as a controle for the volume.
I know this isn't the easiest solution but it is the only one that seems plausible to me.
Best of Luck
Bruno
02-12-2009 02:24 PM
08-17-2011 01:04 AM
Will this be possible in case of singal generation?
I have a multiple signal and sweep generator and I what to have a stop button to "stop" the current generation in order to star another different.
How can i stpo the current sound output??
regards