LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Settting up a audio functions based on a moving average through real-time data streaming

Solved!
Go to solution

Dear Labview community,

 

I am a currently a student who has a limited computer coding background. I have just completed the online core 1 course and i am in the process of understanding labviews functionality and processes. However, i am under pressure to start testing due to a strict time schedule to get my thesis written up.

 

I have created (with a little help) a labview vi (version 9) which calls for one double data each time the iteration run (labview calls the data from a separate piece of software that is streaming the data in via a dll plugin).   The streamed data (volts which is converted to acceleration G’s in the vi)of which is impact accelerations of treadmill running over a prolonged time period. The data has continuous peaks followed by oscillation’s of returning to zero acceleration. In the vi, the audio/Boolean indicators are currently based on thresholds from each impact acceleration value being streamed in. However,  the Vi contains a peak detection part which is setup to ignore these immediate noisy oscillation peaks that set off the audio sounds un-rhythmical. I don’t quite understand this part of the vi as the guy from engineering set this up. Then In VI there is also a moving average which takes into account the previous 5 impact peaks. The thing is I want to be able to setup the audio/boolean feedback based on the moving average change. The problem is that I don’t know how to connect the audio functions with the moving average and also the audio sounds are constantly on, due to moving average value being constantly above the set audio thresholds. How can I sound the audio/buzzer only when a new peak has been added to the average value data?

Can anyone correct my VI to get me up and running (excuse the pun)?

Im desparate

Kind regards,

Adam

0 Kudos
Message 1 of 10
(3,059 Views)

Hi Adam,

 

Thank you for you post to the community.

 

I understand you want to turn on your audio/boolean indicators only when a new peak is added.

 

You could do this by adding boolean constants into the case structure you are using to add to the 'average value data'. Please see the attached image showing how an extra output can be added to your case structure to control you audio/boolean indicators.

 

I hope this helps, please post back if you have any further questions

 

 

Jack. W
Applications Engineer
National Instruments
0 Kudos
Message 2 of 10
(3,032 Views)

Hi Jack,

 

Thank you for replying.

 

I am not too sure what you mean by where and how an extra output can be added to your case structure to control you audio/boolean indicators in my code. In your jpeg the the text box above the true case structure is called 'false case' is this correct? Also what do you mean by condition?

 

Sorry for the stupid questions.

 

Thank you so much

 

Adam

0 Kudos
Message 3 of 10
(3,021 Views)
Solution
Accepted by Clan350

Hi Adam,

 

Forgive me for that error, I had the true and false labels the wrong way round.

 

I have created a new example of the previous explanation using the code you provided (see attached). In this example I have added to the case structure in your code that manages the storage of the last 5 peaks (at the top right of your while loop). When it is true i.e. a new peak has been added, a new output in the case structure is set as true by a constant within. When the structure is false it outputs false with another constant.

 

Please see the examples to see how I have then used this new output with an additional case structure to control outputs.

 

In the first example I post, by condition I mean the the input that controls the case structure.

 

Hope this helps

Jack. W
Applications Engineer
National Instruments
0 Kudos
Message 4 of 10
(3,004 Views)

Hi Jack,

 

Yes the audio sound is now working on the moving average update. Thank you!!!! 

Just another quick one, the boolean indicators are now being constantly on as opposed to being turned on and off when the moving average value changes. See jpeg.

 

Cheers Jack,

 

Adam

0 Kudos
Message 5 of 10
(2,987 Views)

Have you remembered to wire the boolean indicators to false in each of the case structures when in the false state?

Jack. W
Applications Engineer
National Instruments
0 Kudos
Message 6 of 10
(2,984 Views)

Do i create a local variable of the boolean, then put into the false case structure and wire it up with the question mark?

0 Kudos
Message 7 of 10
(2,979 Views)

That's exactly right yes.

Jack. W
Applications Engineer
National Instruments
0 Kudos
Message 8 of 10
(2,976 Views)

Yes, its working.

 

Jack, the audio vi's (beep) seem to be defaulted on using off the system speakers, i want to be able to present the audio sounds via external speakers. Is there way i can do this?

 

Also the boolean lights on come on for a short duration, can modify this?

 

I owe you a beer.

 

Adam 

0 Kudos
Message 9 of 10
(2,970 Views)

Glad that is working for you now

 

Please set up a new forum discussion for questions not related to this discussions subject. Or search the forum for existing related discussions.

Jack. W
Applications Engineer
National Instruments
0 Kudos
Message 10 of 10
(2,961 Views)