Delphi:BASS.dll - 如何将 MP3 流的一部分复制到另一个文件
我正在使用 BASS.dll 库,我想做的就是使用 BASS_StreamCreateFile 等将正在播放的 MP3 部分“重定向”到另一个文件(可能是 MP3 或 WAVe)。我不知道如何开始?我试图使用帮助来找到答案,但仍然一无所获。我可以播放这个流。读取一些我需要的数据。现在我需要复制文件,例如从 2:00 到 2:10(或按位置)。 有什么想法我应该如何开始?
问候, 杰康
Im using BASS.dll library and all I want to do is to "redirect" part of MP3 Im playing using for example BASS_StreamCreateFile to another file (may be MP3 or WAVe). I dont know how to start? Im trying to use help to find an answer, but still nothing. I can play this stream. Read some data I need. Now I need to copy ile for example from 2:00 to 2:10 (or by position).
Any ideas how should I start?
Regards,
J.K.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
嗯,我不太了解 BASS,但我对音乐播放和压缩数据格式有一点了解,并且正确复制数据涉及中间解码步骤。您需要执行以下操作:
(LengthInSeconds * SamplesPerSecond * Channels * BytesPerSample)
字节。因此,如果是 10 秒的 CD 品质音频,则为 10 * 44100 * 2(立体声)* 2(16 位音频)= 1764000 字节。如果 BASS 具有解码到外部缓冲区以及将缓冲区编码为 MP3 的功能,那就很好了;您所要做的就是弄清楚要使用哪些。如果没有,您将不得不寻找另一个 MP3 编码和解码库。
另外,请注意世代损失。 MP3 使用有损压缩,因此如果多次解压缩和重新压缩数据,会损害音质。
Well, I don't know BASS specifically, but I know a little about music playing and compressed data formats in general, and copying the data around properly involves an intermediate decoding step. Here's what you'll need to do:
(LengthInSeconds * SamplesPerSecond * Channels * BytesPerSample)
bytes. So if it's 10 seconds of CD quality audio, that's 10 * 44100 * 2 (stereo) * 2 (16-bit audio) = 1764000 bytes.If BASS has functions for decoding to an external buffer and for encoding a buffer to MP3, you're good; all you have to do is figure out which ones to use. If not, you'll have to find another library for MP3 encoding and decoding.
Also, watch out for generational loss. MP3 uses lossy compression, so if you decompress and recompress the data multiple times, it'll hurt the sound quality.