Become a Site Supporter and Never see Ads again!

Author Topic: Homegrown WAVE header repair utility  (Read 104182 times)

0 Members and 1 Guest are viewing this topic.

Offline pigiron

  • Trade Count: (0)
  • Taperssection Member
  • ***
  • Posts: 250
  • Gender: Male
  • I just did what I did
Homegrown WAVE header repair utility
« on: October 03, 2006, 02:04:30 AM »
I saw that a few folks are getting corrupted headers in their wave files and having a struggle with the existing utilities trying to fix the problem. So I cobbled together a wave header repair utility this last weekend that may help... 'cause I hate to see good music go to waste ;D

But it's a butt ugly command line program... if you want pretty, try next door.

Since it's mostly "universal" C coding, I was able to get it to compile on both Linux and Winders... don't own a Mac, sorry.

Beat the hell out of it and it seems to be working, but I'd be surprised if there wasn't some bugs still down in the cracks... so for sure, only use it on a backup copy.

Here's a sample output where it successfully repaired a wave file that had nothing but zeroes in the entire header and a partially truncated audio data sample (about as bad as it get's)...

# ./fixwav junk.wav

Existing header data. Look for the words 'RIFF', 'WAVE', 'fmt',
or 'data' to see if this is even a somewhat valid WAVE header:

00000000:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000010:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000020:  00 00 00 00 00 00 00 00 00 00 00 00             ............

Exit the program now? [y/n] n
The total file size is 32617577 bytes
Chunk Size of 0 at offset 4 is incorrect... repairing
Chunk Format at offset 8 is incorrect... repairing
Subchunk1 ID at offset 12 is incorrect... repairing
Subchunk1 Size at offset 16 is incorrect... repairing
Subchunk1 Format at offset 20 is incorrect... repairing
Is the file recorded in 0 channels?  [y/n] n
Enter number of channels... 1=Mono, 2=Stereo, etc: 2
Is the number of samples per second = 0?  [y/n] n
Enter number of samples per second: 44100
Is the number of bits per sample = 0?  [y/n] n
Enter number of bits per sample: 16
Subchunk1 Format at offset 24 is incorrect... repairing
Subchunk1 Bytes Per Sample at offset 32 is incorrect... repairing
Subchunk2 ID at offset 36 is incorrect... repairing
Subchunk2 Size at offset 40 is incorrect... repairing
Found incorrect number of audio samples. This means that either
   the new WAVE header data is incorrect, or the audio samples
   in the existing file were clobbered. Do you wish to add silent
   audio samples to the end of the file?
   WARNING: this will modify the existing file. [y/n] y

Header repair is required!
   Overwrite the existing file? [y/n] y

File repair successful

As you see, you need to know a little about the file... the number of bits, the samples per second, and the number of mics... while that might stump a n00b, I don't think you'll have any problem.

One caveat... it assumes you're feeding it a "normal" wave file... i.e. only a single data "Subchunk"... if it ain't such an animal... or if it simply has junk data appended to it (there's some dumb ass programs that add ID3 tags like that), it's gonna hose up.

anyway, they're attached below... enjoy... and remember... you got it free  ;D
skm184, lsd2
v2, sd722, mini-me, jb3

Offline udovdh

  • Trade Count: (0)
  • Taperssection Member
  • ***
  • Posts: 986
Re: Homegrown WAVE header repair utility
« Reply #1 on: October 03, 2006, 04:41:51 AM »
Interesting. Thanks.
No source?

Offline strsng

  • Trade Count: (0)
  • Taperssection Newbie
  • *
  • Posts: 1
Re: Homegrown WAVE header repair utility
« Reply #2 on: October 25, 2006, 11:57:17 PM »
Great, Thanks a lot. This is what I've been looking for!

Offline Will_S

  • Trade Count: (15)
  • Needs to get out more...
  • *****
  • Posts: 2217
Re: Homegrown WAVE header repair utility
« Reply #3 on: October 26, 2006, 01:04:50 AM »
If you're willing to share the source code, I'll take a crack at compiling it for the Mac.

Offline pigiron

  • Trade Count: (0)
  • Taperssection Member
  • ***
  • Posts: 250
  • Gender: Male
  • I just did what I did
Re: Homegrown WAVE header repair utility
« Reply #4 on: October 26, 2006, 03:22:46 AM »
sounds good... only ask that you throw it back up here so that all can share... unless someone has a better idea of where to keep it... it's too small, simple, and ugly for something like sourceforge.

It's created on linux, but surprisingly, the windoze compiler I used ate it without any CR/LF conversions (and without having to create a new Makefile)... and hopefully not too many changes required for the mac.

fixes and enhancements welcome  :)
skm184, lsd2
v2, sd722, mini-me, jb3

Offline udovdh

  • Trade Count: (0)
  • Taperssection Member
  • ***
  • Posts: 986
Re: Homegrown WAVE header repair utility
« Reply #5 on: October 27, 2006, 01:18:54 PM »
Thanks for the source!

Offline Chris K

  • Trade Count: (5)
  • Needs to get out more...
  • *****
  • Posts: 3141
  • Bound to cover just a little more ground
Re: Homegrown WAVE header repair utility
« Reply #6 on: November 25, 2006, 10:48:27 AM »
bumping this up, because this program helped save an encore to a recent show

thanks for this
My gear: JK Labs AKG DVC > M10
              AKG 460 ck61/ck62/ck63 > DR-70D
             
A live concert to me is exciting because of all the electricity that is generated in the crowd and on stage. It's my favorite part of the business, live concerts.
-Elvis Presley

Offline kuba

  • Trade Count: (0)
  • Taperssection Regular
  • **
  • Posts: 119
  • Gender: Male
  • king of snake
Re: Homegrown WAVE header repair utility
« Reply #7 on: November 25, 2006, 11:01:50 AM »
This seems to be galaxies better than the one I made. +T
AT831 > bb > iRiver H120

Offline sleepypedro

  • Trade Count: (4)
  • Needs to get out more...
  • *****
  • Posts: 4140
  • Gender: Male
Re: Homegrown WAVE header repair utility
« Reply #8 on: November 26, 2006, 07:17:58 AM »
thank you bob!   ;D

Offline ashevillain

  • Trade Count: (25)
  • Needs to get out more...
  • *****
  • Posts: 3368
Re: Homegrown WAVE header repair utility
« Reply #9 on: November 26, 2006, 09:45:01 PM »
If you're willing to share the source code, I'll take a crack at compiling it for the Mac.

Did this ever happen?

Offline Will_S

  • Trade Count: (15)
  • Needs to get out more...
  • *****
  • Posts: 2217
Re: Homegrown WAVE header repair utility
« Reply #10 on: November 26, 2006, 09:53:03 PM »
If you're willing to share the source code, I'll take a crack at compiling it for the Mac.

Did this ever happen?

Wayne got it running:

http://taperssection.com/index.php?topic=74508.msg998132#msg998132

Offline ashevillain

  • Trade Count: (25)
  • Needs to get out more...
  • *****
  • Posts: 3368
Re: Homegrown WAVE header repair utility
« Reply #11 on: November 26, 2006, 10:04:31 PM »
If you're willing to share the source code, I'll take a crack at compiling it for the Mac.

Did this ever happen?

Wayne got it running:

http://taperssection.com/index.php?topic=74508.msg998132#msg998132

Thanks!

...however, now I can't even see the files on the "NONAME" drive. So I can't transfer them to the Mac in order to fix them.

Offline funk_pie

  • Victim of comfort
  • Trade Count: (0)
  • Taperssection Member
  • Posts: 878
  • Gender: Male
  • O hai!
    • My db list...
Re: Homegrown WAVE header repair utility
« Reply #12 on: April 19, 2007, 12:17:24 AM »
(so i wasn't used to having the hold button on, jb3 user)...first time out with the the iriver, i put it on hold, but forgot at the end. i hit reset to turn it off.  everything was saved but the saved file wouldn't play.  transferred 1.3 GB of data.  still won't play.  found this application, did the trick.  beautifully done.  :coolguy:
As a child, a library card takes you to exotic, faraway places. When you're grown up, a credit card does it.  -Sam Ewing

Offline pigiron

  • Trade Count: (0)
  • Taperssection Member
  • ***
  • Posts: 250
  • Gender: Male
  • I just did what I did
Re: Homegrown WAVE header repair utility
« Reply #13 on: May 15, 2007, 12:45:07 AM »
never even thought about sample shifts... good idea!... PM sent for more info.
skm184, lsd2
v2, sd722, mini-me, jb3

Offline kgreener

  • Trade Count: (4)
  • Taperssection All-Star
  • ****
  • Posts: 1448
  • Gender: Male
Re: Homegrown WAVE header repair utility
« Reply #14 on: May 21, 2007, 02:48:12 PM »
plus freakin' T dude, this just saved my ass!

another one in 12...

thanks

 

RSS | Mobile
Page created in 0.113 seconds with 44 queries.
© 2002-2024 Taperssection.com
Powered by SMF