LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem Writing continuous data to a soundfile

Solved!
Go to solution

Greetings,

 

I have a problem which is probably easy to solve but I'm a beginner user of LabVIEW.

So, I have an FM receiver which receives demodulated data, I want to write that data to a .wav file but since it is in a while loop it rewrites with every sample of info.

Could you please help me out a bit?

 

I'm attaching the VI here,

Thank you.

0 Kudos
Message 1 of 6
(1,704 Views)

Hi CPapa,

 


@CPapa wrote:

I want to write that data to a .wav file but since it is in a while loop it rewrites with every sample of info.

Could you please help me out a bit?


When the file function overwrites existing data each iteration then you need to collect all the data in a waveform before saving to file…

 

How much data do you want to collect?

Maybe a different file format may work better/easier for you?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 6
(1,681 Views)

Can you save it to an earlier version.  Maybe 2017 or so.

0 Kudos
Message 3 of 6
(1,673 Views)
Solution
Accepted by CPapa

Hi CPapa,

 

The VI you're using, Sound File Write Simple.vi, will overwrite the same file path, and doesn't append to the file. You'll need to create / open a sound file before the while loop, and then inside the loop write each waveform acquired from the FM receiver to the sound file.

 

Take a look at the example code in <LabVIEW>\examples\Graphics and Sound\Sound\Sound Input to File.vi to see how to use the sound file functions. The end result should be something like this (I don't have NI-USRP installed, hence the ? subVIs):

 

fm-to-wav.png

Message 4 of 6
(1,655 Views)

Hello, I want to capture a single song (ride of the valks) aprrox. 5mins. So .wav would be the best since I will be able to play it as well.

 

Could you please provide me with your idea of collecting all the data in a vi?

0 Kudos
Message 5 of 6
(1,596 Views)

Hi CPapa,

 


@CPapa wrote:

Hello, I want to capture a single song (ride of the valks) aprrox. 5mins. So .wav would be the best since I will be able to play it as well.

 

Could you please provide me with your idea of collecting all the data in a vi?


I guess you are talking about my suggestion: please use the quote feature of the editor to indicate what exactly you are referencing in your questions!

 

When you want to sample 5mins of sound data then my suggestion is not valid anymore: 5min*60s/min*44100Sample/s*2channels~=26.5MSamples. This needs ~212MB memory in total, which would be feasable, but isn't recommended because my appraoch would require constant memory handler actions…

Stick with the other suggestion you got!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 6
(1,586 Views)