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 🙂 

 

0 Kudos
Message 1 of 4
(1,275 Views)
Highlighted

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

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
Message 2 of 4
(1,255 Views)
Highlighted

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 🙂

0 Kudos
Message 3 of 4
(1,228 Views)
Highlighted

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. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 4 of 4
(1,207 Views)