LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Append data to existing sound (.wav) file

Hello, I am using LV2010 to create an application that logs sound data. This works fine. However, the customer has requested the ability to re-open a session and record more data to the .wav file. And when Sound File Open Write VI is passed an existing file, it doesn't append, it overwrites. This is a problem for me. Is there an elegant way to append to a .wav file in LabVIEW? I suppose I could open the file for read, read out the data, close the file, re-open it for write, write in the existing data, then start writing new data. This seems horribly inefficient, but I'm not seeing a better way just yet. I do have LV2012 installed if you don't have 2010 handy to provide an example.
0 Kudos
Message 1 of 6
(3,703 Views)

@RCooper wrote:
Hello, I am using LV2010 to create an application that logs sound data. This works fine. However, the customer has requested the ability to re-open a session and record more data to the .wav file. And when Sound File Open Write VI is passed an existing file, it doesn't append, it overwrites. This is a problem for me. Is there an elegant way to append to a .wav file in LabVIEW? I suppose I could open the file for read, read out the data, close the file, re-open it for write, write in the existing data, then start writing new data. This seems horribly inefficient, but I'm not seeing a better way just yet. I do have LV2012 installed if you don't have 2010 handy to provide an example.

How about stripping the .wav header from the second file and append the second file to the first?

[edited because my first reply sounded a bit harsh]

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 2 of 6
(3,699 Views)

My first post may not have been clear, but I am trying to record additional data to the SAME .wav file.  There is only one file (and writing a second file is not acceptable for this app).

 

The question is whether you can open a .WAV file in append instead of overwrite mode.

0 Kudos
Message 3 of 6
(3,684 Views)

For some reason, the formatting got messed up in my first post; here is it properly formatted:

 

Hello,

 

I am using LV2010 to create an application that logs sound data. This works fine. However, the customer has requested the ability to re-open a session and record more data to the .wav file. And when Sound File Open Write VI is passed an existing file, it doesn't append, it overwrites

 

This is a problem for me. Is there an elegant way to append to a .wav file in LabVIEW? I suppose I could open the file for read, read out the data, close the file, re-open it for write, write in the existing data, then start writing new data. This seems horribly inefficient, but I'm not seeing a better way just yet

 

I do have LV2012 installed if you don't have 2010 handy to provide an example.

0 Kudos
Message 4 of 6
(3,682 Views)

@RCooper wrote:

My first post may not have been clear, but I am trying to record additional data to the SAME .wav file.  There is only one file (and writing a second file is not acceptable for this app).

 

The question is whether you can open a .WAV file in append instead of overwrite mode.


Like you, I have seen that it is not immediately evident if you could do this or not.  That being the case, I think your way would work - it's probably the most elegant way after all, too.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 5 of 6
(3,672 Views)

Yeah, I'm afraid that might be right.  I was just wondering if someone had found a slicker way to add to an existing .wav.  I'll leave this open in case someone else has input.

 

Thanks for having a look, Bill!

0 Kudos
Message 6 of 6
(3,663 Views)