在 iPhone 上混合声音文件

发布于 2024-08-29 00:23:25 字数 232 浏览 4 评论 0原文

我有几个 wav 文件,可能还有一个 mp3,我想将它们混合成一个 wav 或 mp3 文件。我正在使用 C/C++/Obj-C (iPhone)。我对这类事情确实没有经验。如果有人能给我一些指示,我将非常感激。

基本上我想做的是类似的事情,例如 Audacity 可以做的事情,但是以编程方式进行。是否没有一个声音库,您可以轻松地打开音频文件并将它们“粘贴”到新文件中的指定位置?哪里混合是您不必担心的事情?

谢谢。

I've got a couple of wav files and possibly a mp3 that I'd like to mix down to a single wav or mp3-file. I'm using C/C++/Obj-C (iPhone). I have really no experience with this sort of thing. If anyone could give me some pointers, I would be very grateful.

Basically what I want to do is similar things like for example Audacity can do, but programmatically. Isn't there a sound library where you can easily open audio files and "paste" them into a new one at defined positions? Where mixing is something you don't have to worry about?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

一袭水袖舞倾城 2024-09-05 00:23:25

混合线性 PCM 的两个声音缓冲区只需将它们中的每个样本值相加即可,当然要确保不会溢出。通常,您会在缓冲区中使用浮点值,因此问题出在您返回文件时。您还应该在 iPhone 上使用 CoreAudio,它具有打开/读取/写入不同格式的声音文件的所有方法。我认为 iPhone 上还有一个 mac 上没有的更高级的 api,请查阅苹果文档。

Mixing two sound buffers of linear PCM is only a matter of adding each sample value in them together, and of course make sure you don't overflow. Normally you would use floating point values in the buffers though, so the issue is when you go back to the file. You should also have CoreAudio available on the iPhone, it has all the means to open/read/write sound files in different formats. I think there is also a more high level api available to the iPhone that isn't on the mac, look up the apple docs.

裂开嘴轻声笑有多痛 2024-09-05 00:23:25

如果您专门寻找 Audacity 的功能,它在底层使用 PortAudio (看起来像 MIT 许可证) )。也许你可以尝试使用它?

If you are specifically looking for the features of Audacity, it uses PortAudio under the hood (looks like an MIT license). Perhaps you can just try to use that?

白鸥掠海 2024-09-05 00:23:25

首先阅读多媒体支持点它包含很多信息。以下是摘录:

iPhone 上有 3 种混合音频的方法:

  • Audio Unit 框架
    • 多通道混合器 - “让您将多个音频流混合到一个流中”
    • 3D 混合器单元 - “让您混合多个音频流、指定立体声输出平移、操纵采样率”
  • 在游戏开发中使用 OpenAl

另请检查以下示例出: iPhoneMultichannelMixerTest< /a>:

创建了两个输入总线,每个总线都带有输入音量控件。还提供整体混音器输出音量控制,并且可以启用或禁用每条总线

Read Multimedia support as a starting point it contains alot info. Here is an extract:

There are 3 ways to mix the audio on iphone:

  • Audio Unit framework
    • Multichannel Mixer - "lets you mix multiple audio streams to a single stream"
    • 3D Mixer unit - "lets you mix multiple audio streams, specify stereo output panning, manipulate sample rate"
  • OpenAl used in games development

Also check the following sample out: iPhoneMultichannelMixerTest:

Two input busses are created each with input volume controls. An overall mixer output volume control is also provided and each bus may be enabled or disabled

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文