02-12-2010 11:13 AM
Hi,
I am developing a VI that provides breathing guidance to the user. Guidance is provided using audio and visual. I am not exactly able to figure out the audio guidance and have implemented the rest of the algorithm. let me show how it goes-
The VI calcualtes what breathing rate to guide at and a horizontal bar fills (0 to 100%) and empties to signify breathing in and out. eg- If breathign rate is 10 breaths per minute = each breath lasts 6 seconds = 3 seconds spent breathing in and 3 seconds spent breathing out(assuming 1:1 ratio, which is a control and changed by the operator).
I want to now incorporate audio feedback for the user who wishes to close eyes to relax. I have 2 .wav files for breathing in and breathing out and aim to play these files for the duration of the breathing rate - eg play file 1.wav for 3 seconds and file2.wav for 3 seconds and then file 1 and so on.
With time breathing rate reduces and length of time played increases.
I am not quite figuring this out.
I would be grateful if anyone can direct towards ideas /provide brief sample code to be used as starters.
A sample audio file attached.
Solved! Go to Solution.
02-13-2010 11:22 AM - edited 02-13-2010 11:23 AM
I will give you my tentative thoughts on this.
I think you should record an audion of the maximal lenght you will need to play. You say that at the beginning one audio file will have to play for 3 minuted, but later the time will increase. So you have to know the maximal time for the audio to be played and record an audio of such lenght.
Next, if the prolongation of the playback is automatic and not controlled by the user, you should have a coefficient of the rate of the prolongation during time. And to get the current lenght of the playback I would simply multiply the previously mentioned coefficient by the initial value (which is 3 mins.).
To play one audio after another cyclically, you could simply use a stacked sequence structure (interchaging the playback audios continuously) placed in a loop. You should measure the time during the playback and activate the next sequence when the limit is reached. In your case the limit would also be dynamic and it would get updated during the therapeutics.
02-20-2010 08:09 AM
02-22-2010 03:46 AM
Hi Vizz,
Its jaspal.boparai@habinternational.co.uk.
02-22-2010 04:39 AM
I am managing to play a .wav file of length 30 seconds, but I want to stop it after 10 seconds.
I am not quite able to do so.
How do I stop playing a .wav file after a fixed time before the end of file is reached. I tried the timeout(s) option of Sound Output Write.VI but it doesnt work.
Thanks
02-22-2010 08:31 AM
02-22-2010 10:10 AM
Thanks DFGray,
That worked.