LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

write wav file with on/off button

Solved!
Go to solution

Hello All,

 

I'm trying to save a wav file at a press of a button on/off with automated name files.

 

The idea is the VI is running, displaying data when the save button is pressed data are saved as wav until the button is pressed again. The filename are generated with date and time automatically. The user can create as many save as he/she wants without stopping the VI.

 

As you can guess I'm not a good labview programmer and I'm having a problem as my VI doesnt work properly. The saved wav file returned are huge they seems to retain too many data basically. When i play it back it sound looped. I understand the problem comes from my VI. Believe me I've been trying and trying with no luck. Could someone have a look please and let me know what is wrong. I do not understand how to make the saving part of my VI work.

Please find attached my VI.

 

Thank you in advance for your help.

Frederic.

0 Kudos
Message 1 of 8
(2,671 Views)

Done it 🙂 . Yay.

0 Kudos
Message 2 of 8
(2,640 Views)

Posting what you did to solve the problem would help others in the future Smiley Very Happy

----------------------------------------------------------------------------------------------------------------------------
"If anyone needs me, I'll be in the Angry Dome!"


0 Kudos
Message 3 of 8
(2,636 Views)

Hello Frederic,

 

I think I can see what is going wrong.

 

In the bottom loop, you keep writing 'Filtered Signal' to your file regardless of whether it has changed value. This is why when you play it back you get looping sound.

 

If I was you, I wouldn't worry about saving to file in a separate loop. If you did want to do this, you would have to implement some kind of queue based producer/consumer architecture. (this may still be necessary if writing to file takes too long)

 

That aside, see that attached example for how you could go about it. (I haven't connected everything up just shown the idea). You need to be careful to not to create the file on every loop iteration - I think I have avoided this but you will need to check it!

 

Let me know if this helps

 

Regards,

Nick
Message 4 of 8
(2,635 Views)

looks like I was just too late!

Nick
0 Kudos
Message 5 of 8
(2,634 Views)

Hi Nick,

Thank you for your help. Please find attched what i did which looks very similar to yours. Does it look alright to you?

 

Hi Chrissy,

You are right I should have posted the VI for others. Here it is:

 

Message 6 of 8
(2,628 Views)
Solution
Accepted by topic author fredericb

Yes, our solutions are remarkably similar!

 

Do be careful to close off the files when you have finished writing to them - I am not sure you have done this. You have placed one close outside the loop which will only close off the most recently created file.

 

Regards,

Nick
0 Kudos
Message 7 of 8
(2,625 Views)

Thanks for the feedback Nick i'll do that. 

Frederic

0 Kudos
Message 8 of 8
(2,622 Views)