![创建堆 上浮和下沉](https://i-blog.csdnimg.cn/blog_migrate/23356f51c282de9e333154318249dbf6.png)
创建堆 上浮和下沉
I've been up on campus talking at the PNPSummit and in my spare time recording podcasts with interesting people. A particularly cool show that'll be coming up very soon ran pretty long, and filled up my 1 gig CF Card. I had to transfer that now "part 1" off that disk and keep recording "part 2." My editor Lawrence will then stitch the two files together and make the transition sound natural.
我上过校园,在PNPSummit上聊天,并在业余时间与有趣的人录制播客。 即将播出的一个特别酷的节目运行了很长时间,并填满了我的1兆CF卡。 我现在不得不从磁盘上转移“第1部分”,并继续记录“第2部分”。 然后,我的编辑劳伦斯(Lawrence)将两个文件缝合在一起,使过渡听起来自然。
I uploaded the two parts and went along with my day. However, I got a call from the guys saying that the file wouldn't open and that it might be corrupt. Yikes. This has happened before, but it's usually just a transmission error. I opened the original file and....crap!
我上传了两个部分,并一起度过了美好的一天。 但是,我接到了一个电话,说文件无法打开,并且文件可能已损坏。 kes。 这是以前发生的,但通常只是传输错误。 我打开了原始文件,然后...废话!
![Windows Media Player](https://i-blog.csdnimg.cn/blog_migrate/419bb0930963c1e17b0db636aa9bda58.png)
It won't open. Hm. Well, I figured that some WAV file programs are more strict than others. Perhaps I could open it in another program.
它不会打开。 嗯好吧,我发现某些WAV文件程序比其他程序更严格。 也许我可以在另一个程序中打开它。
Well, shoot. It's not opening in any programs. That's not cool. I tried WAV Saver and while I see on the net that lots of folks have had success with it, for me it crashed as I clicked repair. Apparently my file was messed up in a special way.
好吧,拍。 它没有在任何程序中打开。 那不酷。 我尝试了WAV Saver ,当我在网上看到很多人都成功使用它时,对我来说,单击“修复”时它崩溃了。 显然我的文件以一种特殊的方式弄乱了。
As I Googled around for answers and the program "GoldWave" kept coming up. It's apparently very well thought of.
当我在Google周围搜寻答案时,“ GoldWave ”程序不断出现。 这显然是经过深思熟虑的。
When I dragged the corrupt file into GoldWave I got this friendly dialog:
当我将损坏的文件拖到GoldWave中时,出现了以下友好对话框:
![File Format](https://i-blog.csdnimg.cn/blog_migrate/afb7c7aaa3e3ab1f3bf32692a5c37ad5.png)
This is cool because here I can get to the RAW PCM data. I just needed to tell the system what the original recording was in. Since we're on Intel, we're little endian. The recording was in stereo, at 44.1kHz and was 24-bit. Also, anything over 12-bit is usually signed. So, I'm feeling good at this point. However:
这很酷,因为在这里我可以获取RAW PCM数据。 我只需要告诉系统原始记录在哪里。由于我们在Intel上,所以我们很少字节序。 录音为立体声,频率为44.1kHz,为24位。 另外,通常对12位以上的内容进行签名。 所以,我现在感觉很好。 然而:
...I ended up with a screen full of white noise. Bummer. At this point, I'm getting close to giving up. Then, on a whim, I remembered that you can click the tiny down arrow next to the Open button in the Visual Studio Open File Dialog.
...我的屏幕最后充满了白噪声。 笨蛋在这一点上,我快要放弃了。 然后,我一时兴起,记得您可以单击Visual Studio“打开文件”对话框中“打开”按钮旁边的小向下箭头。
I selected Binary Editor and got this:
我选择了二进制编辑器,并得到以下信息:
Now, I'm not an expert on the WAV file format, but I understand it's just a header and some RAW PCM data. It's supposed to be pretty simple, but ALL ZEROS is simpler than even I expected. :)
现在,我不是WAV文件格式的专家,但我知道它只是标题和一些RAW PCM数据。 它应该很简单,但是ALL ZEROS比我预期的还要简单。 :)
So, I opened up Part 1, the valid WAV file, and looked at its header. Then I selected it on a word boundary (guessing) and copied it to the clipboard. Then I flipped over to the broken WAV and pasted in the first 48 bytes of the header of the working file, up to and including the "data" chunk.
因此,我打开了第1部分,即有效的WAV文件,并查看了其标题。 然后,我在单词边界(猜测)上选择了它,并将其复制到剪贴板。 然后,我转到损坏的WAV并粘贴到工作文件的头文件的前48个字节中,一直到“数据”块为止。
Then, I saved the file with a new name and opened it in GoldWave.
然后,我用新名称保存了文件,并在GoldWave中将其打开。
Amazing, it worked! Notice the correct WAV format listed in the status bar. This trick worked, because I stole the WAV Header from a file that was encoded in the identical way. It wouldn't have worked with different files. There was a small warning from GoldWave that the header's length differed from reality, but this was fixed by File|Save As with a new filename.
太神奇了! 请注意状态栏中列出的正确WAV格式。 这个技巧有效,因为我从以相同方式编码的文件中窃取了WAV标头。 它不会与其他文件一起使用。 GoldWave发出一个小警告,标题的长度与实际不同,但这已通过File |另存为并使用新文件名进行了固定。
Miracle of miracles. I thought the show was ruined. This technique was lucky because apparently only the header was missing and I had a header available with the same format. I hope this helps someone with the same problem.
奇迹的奇迹。 我以为演出失败了。 这项技术很幸运,因为显然只有标头丢失了,而且我有可用相同格式的标头。 我希望这对遇到同样问题的人有所帮助。
翻译自: https://www.hanselman.com/blog/that-sinking-feeling-and-repairing-a-corrupt-wav-file
创建堆 上浮和下沉