在 Windows 上存储压缩声音的好格式是什么?
目前,我们使用 .wav 文件来存储我们产品的声音。然而,这些可能会变得很大。我知道有许多不同的声音文件,但是最好使用的声音文件是什么:
1) 适用于所有基于 Windows 的系统 (XP+) 2) 不会添加很多额外的代码(即:包含一个 3 mb 的库来播放 mp3 将抵消我从删除 .wav 文件中获得的任何收益) 3)不是GPL或一些我无法使用的代码(理想情况下只是Windows SDK中的某些内容,或者可能只是.wav的不同压缩方案,可以更好地压缩并与sndPlaySound(..)或类似的东西一起很好地工作。
任何想法将不胜感激,谢谢!
Currently we use .wav files for storing our sounds with our product. However, these can get large. I know there are many different sound files out there, however what is the best sound file to use that will:
1) Work on all windows-based systems (XP+)
2) Doesn't add a lot of extra code (ie: including a 3 mb library to play mp3's will offset any gains I get from removing the .wav files)
3) Isn't GPL or some code I can't use (ideally just something in the windows SDK, or maybe just a different compression scheme for .wav that compresses better and works nicely with sndPlaySound(..) or something similar.
Any ideas would be appreciated, thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
虽然 WAV 文件通常是未压缩的,但它们可以使用各种编解码器进行压缩,并且仍然可以使用系统 API 进行播放。总体大小中最大的因素是通道数(单声道或立体声)、采样率(11k、44.1k 等)和样本大小(8 位、16 位、24 位)。此链接讨论 WAV 文件支持的各种压缩方案和相关文件大小:
http://en.wikipedia。 。
除此之外,您还可以将数据编码为 WMA 文件,这些文件在没有第三方库的情况下也得到了丰富的支持,但可能需要使用 Windows Media SDK 或 DirectShow 进行播放
本文讨论 WMA 编解码器和预期的压缩级别:
http ://www.microsoft.com/windows/windowsmedia/forpros/codecs/audio.aspx
While WAV files are typically uncompressed, they can be compressed with various codecs and still be played with the system API's. The largest factors in the overall size are the number of channels (mono or stereo), the sample rate (11k, 44.1k, etc), and the sample size (8 bit, 16 bit, 24 bit). This link discusses the various compression schemes supported for WAV files and associated file sizes:
http://en.wikipedia.org/wiki/WAV
Beyond that, you could resort to encoding the data to WMA files, which are also richly supported without third party libraries, but would probably require using the Windows Media SDK or DirectShow for playback.
This article discusses the WMA codecs and levels of compression that can be expected:
http://www.microsoft.com/windows/windowsmedia/forpros/codecs/audio.aspx
如果整个文件而不是单个文件“变大”,那么额外步骤所花费的时间不会妨碍及时采取行动,您可能会考虑自己压缩文件并根据需要解压缩它们。我意识到这听起来(在许多情况下可能是)效率低下,但如果排除 mp3,则可能值得考虑,具体取决于其他(问题中未提及)考虑因素。
If the totality of the files is what 'gets large' rather than individual files, so that the time taken by the extra step does not prevent timely action, you might consider zipping up the files yourself and unzipping them as needed. I realize this sounds, and in many cases may be, inefficient, but if mp3 is ruled out it may be worth looking at depending on other (not mentioned in your question) considerations.
我会查看 DirectShow,看看是否可以使用 DirectShow MP3 或 WMA 编解码器来压缩音频流。所有 DLL 均在 Windows 上内置,因此无需额外的可再发行组件。
I'd look at DirectShow and see if you can use the DirectShow MP3 or WMA codecs to compress the audio stream. All the DLLs are in-box on Windows so there's no additional redistributable needed.