LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Music playing stops live data

Highlighted

Hi there, a pretty new labVIEW user here! 

I'm currently trying to create a code for a heart rate and respiratory rate sensor, that outputs text and music when certain thresholds are reached (4 conditions, high high, low low, high low, low high). The text output is fine, but for some reason whenever the music activates at high heart rate and high respiratory rate, it essentially stops the code which is not helpful for live data. 

I would like the code to work so that when the condition for music playing is no longer met, the music stops playing and the rest of the output options function as normal. 

 

I've attached the VI, please ignore the threshold values, the overly complicated and awful simulated signals and the messy front panel! 

Also the same problem occurs with both a live signal and the simulated signal. 

 

I would really appreciate the help! It's the last thing I need to fix in my final VI but I cant seem to figure it out. 

Thanks Smiley Happy 

 

0 Kudos
Message 1 of 4
(964 Views)

Hi vcookie,

 

when you want to do things in parallel you need to program them in parallel!

 

Suggestion: use the producer-consumer scheme for your application!

 

Recommendations:

- Use the autocleanup toolmore often!

- Simplify your code: there are InRange functions, no need for two separate comparisons. There are bandpass filters, no need for two separate filters…

- How do you calculate this BPM value? Why does BPM (beats per minute) depend on the number of peaks found by the peak detector?

- Use less ExpressVIs! It's just senseless to convert an integer array to DDT and then convert it back to a scalar DBL value…

Best regards,
GerdW
CLAD expired, using 2009SP1 + LV2011SP1 + LV2017 (+LV2018 sometimes) on Win7+cRIO
Kudos are welcome Smiley Wink

Message 2 of 4
(944 Views)

Hi GerdW, 

 

Thanks for your reply!
Yeah I know the VI is a bit of a mess! The simulated signals are just something I copied off youtube that was meant to function as a heart rate simulator (but works terribly it turns out!). In the other code with the proper DAQ assistant and the 2 external sensors, the codes much simpler and we're collecting the signals fine. This was just the only code I had on me that didnt require DAQ. 
I had a look at the producer-consumer scheme you recommended, I'm afraid I'm a bit overwhelmed and need a bit more guidance in how to actually set it up. Like am I meant to have an external while loop to the one I currently have that functions as the consumer loop?

 

Cheers Smiley Happy

0 Kudos
Message 3 of 4
(917 Views)

You should use Play sound file instead. Leave the timeout input at zero and the VI will not stall the rest of the code, but will continue playing in the background.


LabVIEW Champion Do more with less code and in less time
0 Kudos
Message 4 of 4
(896 Views)