As we were repairing a corrupted .wav file

 
3r3-31. 3r3142. It was an interesting experience when a .wav file was restored with a friend. I decided to describe our tormenting process, suddenly someone will come in handy. 3r3143. 3r33140.  
Prehistory
3r33140.  
3r3142. There are sad stories when a voice recorder hangs /or gives an error when saving a file. Therefore, when we try to open a damaged file, we get errors like: unable to decode format 3r3r166. , [u] Incorrect format. or [u] The program did not recognize the file format 3r3166. .
3r3143. 3r33140.  
Trying to figure out
3r33140.  
3r3142. Since we did not manage to open the file, we decided to google it. We wanted to figure out how to feed the .wav file to the player. Found a bunch of tips: load it in Raw (raw format), play around with settings, etc. All these attempts failed. 3r3143. 3r33140.  
3r3142. We decided to study what wav is, find information about headlines and their 3r-331. Description
:
3r33140.  
3r3142. As we were repairing a corrupted .wav file 3r3143. 3r33140.  
3r3142. Install the hex editor (wxHexEditor), open and try to at least find something similar to the title. 3r3143. 3r33140.  
3r3142. 3r3143. 3r33140.  
3r3142. Failure they were not. 3r3143. 3r33140.  
3r3142. We decided to write a new record with good preservation. Opened it in the editor and see the headers. 3r3143. 3r33140.  
3r3142. 3r3143. 3r33140.  
3r3142. Copy the headers and paste into our broken file (hereinafter referred to as BF)! We convulsively save and run the file in the player, and nothing works! (I, like a real man, began to sob in the corner of the room)
3r33140.  
Before you build something, you need to break something.
3r33140.  
3r3142. We decided to figure out how to break a normal file and get such a ugly picture as a damaged file. 3r3143. 3r33140.  
3r3142. Figure: glued BF on top, normal recording below. 3r3143. 3r33140.  
3r3142. 3r380. 3r3143. 3r33140.  
3r3142. It turned out that if you delete 1 byte in a normal file and save it, the picture becomes similar. And if you return a byte, even an empty one with zeros, then everything becomes normal. 3r3143. 3r33140.  
3r388. Writing a bash script
3r33140.  
3r3142. We decided to delete and save the file by-byte in order to get a normal picture, as in the figure above. Created 2 files, one only headers, and another damaged file (after cutting it a little less than a megabyte). 3r3143. 3r33140.  
3r3142. They wrote a small script that deletes one byte from the file and sticks to the header, and then saves it with a sequence number. 3r3143. 3r33140.  
3r3-300. #! /bin /bash
for i in {11000}
do
cat header.wav> "./wav/$i.wav"
tail -c + $ i raw.wav "./wav/$i.wav"
done

3r33140.  
3r3142. Run the script and with awe, on the edge of the chair, waiting for the result. Unfortunately, we had to look through these files manually, but we didn’t know how to do it differently. Threw 250 files in audacity and looked at the tracks: 3r3143. 3r33140.  
3r3142. 3r3117. 3r3143. 3r33140.  
3r3142. I did not have to scroll long, because on the 537 file we found what we were looking for:
3r33140.  
3r3142. 3r3143. 3r33140.  
3r3142. It remains the case for small. We look at this file in the hash of the editor, where it stopped. Open the BF in the editor and delete after the header we need the length of bytes. That's it, the two-hour file plays normally. 3r3143. 3r33140.  
3r3133. P.S.
3r33140.  
3r3142. Most likely, it could be made easier. Who knows how to facilitate the work or somehow optimize it, write, add to this "guide." 3r3143. 3r33140.  
3r3142. Thank you all for your attention. 3r3143. 3r3151.
3r3148. ! function (e) {function t (t, n) {if (! (n in e)) {for (var r, a = e.document, i = a.scripts, o = i.length; o-- ;) if (-1! == i[o].src.indexOf (t)) {r = i[o]; break} if (! r) {r = a.createElement ("script"), r.type = "text /jаvascript", r.async =! ? r.defer =! ? r.src = t, r.charset = "UTF-8"; var d = function () {var e = a.getElementsByTagName ("script")[0]; e. ): d ()}}} t ("//mediator.mail.ru/script/2820404/"""_mediator") () (); 3r3149.
3r3151.
+ 0 -

Add comment