Allegro.cc - Online Community

Allegro.cc Forums » Off-Topic Ordeals » Corrupt WAV fix?

Credits go to BAF, Edgar Reynaldo, gnolam, Joel Pettersson, Slartibartfast, Thomas Harte, and Todd Cope for helping out!
This thread is locked; no one can reply to it. rss feed Print
Corrupt WAV fix?
FMC
Member #4,431
March 2004
avatar

I have this WAV file recorded with an mp3 pen which batteries failed before saving the file.
The file is there (25megs of it) so something has been saved, but when i try opening it i always get an error.

I tried using Wav Saver, but it crashes as soon as i ask it to repair the file.
I also tried opening the file with Mplayer, to no avail.

Any good software (free or not) you'd recommend?

[FMC Studios] - [Caries Field] - [Ctris] - [Pman] - [Chess for allegroites]
Written laws are like spiders' webs, and will, like them, only entangle and hold the poor and weak, while the rich and powerful will easily break through them. -Anacharsis
Twenty years from now you will be more disappointed by the things that you didn't do than by the ones you did do. So throw off the bowlines. Sail away from the safe harbor. Catch the trade winds in your sails. Explore. Dream. Discover. -Mark Twain

Edgar Reynaldo
Member #8,592
May 2007
avatar

Hmm - try learning the data structure of a .wav file. You might be able to recognize the header and see how the data is organized. It probably got cut off in the middle of writing a chunk of sound data. If you clip the extra bit maybe the file will be sound again (no pun intended but I still like it).

Joel Pettersson
Member #4,187
January 2004

Or load it as raw sound data chunk in the appropriate format (stereo/mono, correct sample rate) in an editor that supports it; if lucky, you'll get a tiny bit of garbage (the header) at the start, but the rest is raw data and should sound fine if properly aligned.

Edgar Reynaldo
Member #8,592
May 2007
avatar

As an addition to what I suggested earlier , you might have to slightly alter the header as well since the number of sound chunks it was supposed to write will not be the same as the number that are actually there.

Slartibartfast
Member #8,789
June 2007
avatar

FMC
Member #4,431
March 2004
avatar

Quote:

Hmm - try learning the data structure of a .wav file. You might be able to recognize the header and see how the data is organized. It probably got cut off in the middle of writing a chunk of sound data. If you clip the extra bit maybe the file will be sound again (no pun intended but I still like it).

Unluckily i don't have the time for this.

Quote:

Or load it as raw sound data chunk in the appropriate format (stereo/mono, correct sample rate) in an editor that supports it; if lucky, you'll get a tiny bit of garbage (the header) at the start, but the rest is raw data and should sound fine if properly aligned.

Uhm, good idea i'll try it. I just have to figure out the appropriate format (the pen recorder isn't mine)

Quote:

Try Goldwave, maybe? Should work well with Joel Pettersson's suggestio

I find myself well with Audacity.

[FMC Studios] - [Caries Field] - [Ctris] - [Pman] - [Chess for allegroites]
Written laws are like spiders' webs, and will, like them, only entangle and hold the poor and weak, while the rich and powerful will easily break through them. -Anacharsis
Twenty years from now you will be more disappointed by the things that you didn't do than by the ones you did do. So throw off the bowlines. Sail away from the safe harbor. Catch the trade winds in your sails. Explore. Dream. Discover. -Mark Twain

BAF
Member #2,981
December 2002
avatar

Record another wave on the pen recorder and save it to see what the format is. Then import it as raw data into Audacity using that format info.

FMC
Member #4,431
March 2004
avatar

Quote:

Record another wave on the pen recorder and save it to see what the format is. Then import it as raw data into Audacity using that format info.

I'll try this, but right now i don't have access to it.

Any idea on which could be some reasonable settings i could try?

[FMC Studios] - [Caries Field] - [Ctris] - [Pman] - [Chess for allegroites]
Written laws are like spiders' webs, and will, like them, only entangle and hold the poor and weak, while the rich and powerful will easily break through them. -Anacharsis
Twenty years from now you will be more disappointed by the things that you didn't do than by the ones you did do. So throw off the bowlines. Sail away from the safe harbor. Catch the trade winds in your sails. Explore. Dream. Discover. -Mark Twain

BAF
Member #2,981
December 2002
avatar

Low quality mono. Worst case, you can try different settings until something works.

FMC
Member #4,431
March 2004
avatar

Quote:

Low quality mono. Worst case, you can try different settings until something works.

Easier said than done.
Audacity has the following settings:
-20ish choice "format" settings (16 PCM, 32 PCM, ...)
-4 choice endianness setting (big, little,no endianness, default)
-20ish choice channel settings (this is easy, mono or stereo 2)
-Start offsert (not important)
-Percentage to convert (not import)
-Frequency

[FMC Studios] - [Caries Field] - [Ctris] - [Pman] - [Chess for allegroites]
Written laws are like spiders' webs, and will, like them, only entangle and hold the poor and weak, while the rich and powerful will easily break through them. -Anacharsis
Twenty years from now you will be more disappointed by the things that you didn't do than by the ones you did do. So throw off the bowlines. Sail away from the safe harbor. Catch the trade winds in your sails. Explore. Dream. Discover. -Mark Twain

Thomas Harte
Member #33
April 2000
avatar

Quote:

-20ish choice "format" settings (16 PCM, 32 PCM, ...)

It's almost certain to be 8 or 16 bit PCM, though a 4 or 8bit logarithmic format is a possibility if it's primary use is as a voice recorder. I'd say that far and away more likely is 16 bit PCM.

Quote:

4 choice endianness setting (big, little,no endianness, default)

Forget 'no' and 'default' endianness - just try big and little. My guess would be that little is most likely.

Quote:

20ish choice channel settings (this is easy, mono or stereo 2)

Likely to be mono, given your description of the recorder. But try stereo until the other settings seem to be right, since I think WAV just interleaves left/right samples (doesn't it?) so using stereo when you mean mono will just cause a lower quality version of the true wave to come out of both speakers in a slightly different way whereas using mono when you mean stereo could lead to a lot of random noise on top of your true wave.

Quote:

Frequency

Try numbers around 11, 22 and 44Khz before anything else. 8Khz may not be out of the question if it's meant for low quality recording.

A key question that will give strong hints about the likely formats is: (roughly) how many minutes of audio should the 25mb of WAV file produce?

FMC
Member #4,431
March 2004
avatar

I tried playing around with it, following Thomas's suggestions, but to no avail.

I finally managed to get another, working, wav file from the same pen.
The weird things it that neither Audacity, neither Winamp, can open it - but Windows Media player can.

The other, even stranger, thing is that the file is only 6.54mb but it's long 28 minutes long, VERY weird for a wav, isn't it?!

How should i proceed to learn the specific format of this wave(frequency, bitrate, ...)?

[FMC Studios] - [Caries Field] - [Ctris] - [Pman] - [Chess for allegroites]
Written laws are like spiders' webs, and will, like them, only entangle and hold the poor and weak, while the rich and powerful will easily break through them. -Anacharsis
Twenty years from now you will be more disappointed by the things that you didn't do than by the ones you did do. So throw off the bowlines. Sail away from the safe harbor. Catch the trade winds in your sails. Explore. Dream. Discover. -Mark Twain

Slartibartfast
Member #8,789
June 2007
avatar

You could try opening it with Goldwave, as it seems give out that information at the bottom of the window. :)
(I opened a random file to see what kind of information it gives and I can see:
MPEG Audio Layer-3, 44100 HZ, 320 kbps, stereo)

FMC
Member #4,431
March 2004
avatar

I'll soon try Goldwave, but using Wav file info i got:
sample rate = 8000
bits/sample = 4
number of channels = 1

I tried opening it using the VOX ADPCM (which i guessed might work) setting, and i finally got something sensible, only with much noise. (the same file opened under Windows Media Player works well [of course i'm speaking of the second file])

[FMC Studios] - [Caries Field] - [Ctris] - [Pman] - [Chess for allegroites]
Written laws are like spiders' webs, and will, like them, only entangle and hold the poor and weak, while the rich and powerful will easily break through them. -Anacharsis
Twenty years from now you will be more disappointed by the things that you didn't do than by the ones you did do. So throw off the bowlines. Sail away from the safe harbor. Catch the trade winds in your sails. Explore. Dream. Discover. -Mark Twain

gnolam
Member #2,030
March 2002
avatar

Slartibartfast said:

You could try opening it with Goldwave, as it seems give out that information at the bottom of the window. :)

Or just right-click it in Explorer and check out the "Properties" dialog:
{"name":"595398","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/4\/f\/4f57b3ddaee536b26e8786353644c403.png","w":367,"h":502,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/4\/f\/4f57b3ddaee536b26e8786353644c403"}595398

[EDIT]
I'm slow. :P

--
Move to the Democratic People's Republic of Vivendi Universal (formerly known as Sweden) - officially democracy- and privacy-free since 2008-06-18!

Todd Cope
Member #998
November 2000
avatar

Quote:

sample rate = 8000
bits/sample = 4
number of channels = 1

If that's right then it is Microsoft ADPCM format. GoldWave might be able to open it. You can import raw data as "Dialogix (vox)" with the attributes "ADPCM 4 bit, 8000hz, 32kbps, mono."

FMC
Member #4,431
March 2004
avatar

Actually, you win!
Using this method i found out the audio format is IMA ADPCM :D

The problem now is that Audacity, while giving me the option to use this format to import the data, disables the "Import" button ???

Maybe i'm missing some plug-ins, i'll check it.

[FMC Studios] - [Caries Field] - [Ctris] - [Pman] - [Chess for allegroites]
Written laws are like spiders' webs, and will, like them, only entangle and hold the poor and weak, while the rich and powerful will easily break through them. -Anacharsis
Twenty years from now you will be more disappointed by the things that you didn't do than by the ones you did do. So throw off the bowlines. Sail away from the safe harbor. Catch the trade winds in your sails. Explore. Dream. Discover. -Mark Twain

Slartibartfast
Member #8,789
June 2007
avatar

Quote:

Or just right-click it in Explorer and check out the "Properties" dialog:

That doesn't give me the Audio Format for some reason.

rechecks

Ah! I see that the information it gives depends on the file type, so it wouldn't give me anything interesting for an mp3, but for a wav I get everything I need.

FMC
Member #4,431
March 2004
avatar

DONE! :D

And i did it sort of using Edgar's suggestion.

The header of the file was corrupted, but audacity (and Goldwave) couldn't fix it because it was using some weird format. Also when i tried to hand edit the header i found out there where too many extra bits which shouldn't be there.

Long story short, i just copied the header from the other file and then fixed it up for the new file size. :)
Cookies!

[FMC Studios] - [Caries Field] - [Ctris] - [Pman] - [Chess for allegroites]
Written laws are like spiders' webs, and will, like them, only entangle and hold the poor and weak, while the rich and powerful will easily break through them. -Anacharsis
Twenty years from now you will be more disappointed by the things that you didn't do than by the ones you did do. So throw off the bowlines. Sail away from the safe harbor. Catch the trade winds in your sails. Explore. Dream. Discover. -Mark Twain

Edgar Reynaldo
Member #8,592
May 2007
avatar

Go to: