LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

play sound in specified duration and desired file when reading data with VISA functions ?

Solved!
Go to solution

Hi.

I read data with VISA read function and then I use functions like multiple for showing data on Chart. every thing is OK.

now I want play a specified sound (like a 3s song in my desired folder) when signal amplitude cross over from specified value. then after desired time, it will be wait for new cross over from specified value and this procedure repeat again until I stop the program. 

Data comes from MCU and it doesn't stop when system play sound and when system play sound, incoming data for this part (play sound) will be ignore them until specified expired.

I use this VI for reading data and mentioned part which is sound part is empty and I don't know what I must done ?

altougth I use another while loop for sound apart because I want save CPU time.

Thanks.

 

L1.png

0 Kudos
Message 1 of 4
(3,415 Views)

Use a notifier to tell the second loop when to play the sound file.  By passing the wire, you are creating a data dependency and therefore both loops will not run in parallel.


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 2 of 4
(3,405 Views)

Thanks for reply.

my question has 2 part.

1. exceute two while loop paralel which means both work in time ?

2. how I can play a specifeid song for specified duration ?

 

I see labview example for notifer and change my first VI to this : 

L2.png

 

with up VI, can I use two while, simultaneusly ? 

for playing sound with mentioned circumstances in first post, what I can done ?

 

Thanks.

0 Kudos
Message 3 of 4
(3,389 Views)
Solution
Accepted by topic author ajapyy

I would recommend making the data type of the notifier a cluster that contains a path and a numeric (double).  The path tells the player which file to play.  The numeric is the duration.

 

Now for a slightly complicated, but really neat, way to stop your second loop.  Do not use a second notifier.  Instead, send the normal notification but use Not A Path for the path in the cluster.  Your second loop can do a check for the Not A Path and stop when that is recieved.


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 4 of 4
(3,382 Views)