LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

WAV file won't replay in LabView or load in WMP, but works in VLC

Solved!
Go to solution

I'm creating an audio file for an interview with the code snippet attached (VI is very large and does a lot of unrelated processing).  This audio is recorded in the "interview" subvi.  At completion, this subvi is closed and the "process" subvi is opened.  If this process is followed, labview will open and play the WAV file with no problem.  Alternatively, "process" can be run as a stand-alone.  If this is done, I get the error 4810 at Sound File Read Open (possible reason: cannot recognize sound format).  If I try to open the file in Windows Media Player, the wav will open, but will have a length of 0.  If I open the wav in VLC, it plays with no problem.  I haven't tried saving as a new file, but this is a sortof untenable solution anyway.  For what it's worth, this problem arose when the audio recording was changed to a queue-based process.  I've attached the old (working) code for reference.

Thanks,

Brendan

0 Kudos
Message 1 of 6
(3,597 Views)

I'm also adding a screen cap of the working (right) and non-working (left) headers created by the snippets attached above.  I don't have a lot of experience with this, but it strikes me as curious that the non-working (left) header has no value for what I think should be the File Size (data) section (as referenced here http://www.topherlee.com/software/pcm-tut-wavformat.html).  I note also that the header seems to be 12 bytes longer that most references suggest, but this is the case in both the working and non-working headers (I'm looking specifically at offset 36-47 in both).

0 Kudos
Message 2 of 6
(3,572 Views)

Hex update: I realized that the hex editor is not differentiating between big-endian and little-endian.  So the size (the second word of each header) is basically 0 in the non-working example.  To reiteration, this file is being generated by the labview code above (the one with the queues).  Is this a problem with the close file subvi not executing completely?

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

Hello brendan111.

 

First of all, WOW that is a cool application! Anyway back to business, It looks like the sound file is not being closed after writing to it. I would recommend closing it after writing to it , then opening it again when you want to read from it. The file iterator is probably still at the end of the file when you try to start reading from it, which could lead to this error.

 

Although I do have to say that it seems weird that VLC is able to play this extension and the WMP isn't. 

 

I know this may seem obnoxious but have you try debuggging it and see how the VI actually executes? Maybe we can get an overview on how it calls the functions and how it builds the  file.

 

Kind regards, 

Sigi R.

AE CR

 

"everything is achieveable through technology'
0 Kudos
Message 4 of 6
(3,521 Views)
Solution
Accepted by brendan111

Hey,

Went back to basics and redid all my configuring, including doing it locally (not with local variables on mic and speaker device IDs).  It works now. so...I'm not really sure what to make of all this.  I doubt it was an issue of using the local variables to refer to the input/output devices because sound was still being played.  It could have been a small error with the file creation, since I rewrote that, but I can't tell what it might have been.  In any case, thanks.

0 Kudos
Message 5 of 6
(3,508 Views)

Hello brendan111 

 

I am glad to hear that! Yeah sometimes stuff like this happens. But I am glad you resolved the issue.

 

Kind regards,

IronBrotha

 

 

"everything is achieveable through technology'
0 Kudos
Message 6 of 6
(3,497 Views)