- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用音频单元编写一个简单的 iOS 应用程序。我想添加混响效果。所以该图看起来像 RemoteIO_Input -> Reverb -> RemoveIO_Output。但是在尝试为混响单元设置流格式时出现错误 - kAudioUnitErr_FormatNotSupported
。该代码在不使用混响单元(图中的单个远程 IO)的情况下工作正常,因此其他配置似乎没问题,我没有提供他们的代码。
UPD:使用 iOS 6
所以问题:
允许的格式有限制吗?
我应该使用什么格式的参数?
应在 RemoteIO 输出元素的任何范围内设置格式?
感谢关注。
代码:说明:
desc.componentType = kAudioUnitType_Output;
desc.componentSubType = kAudioUnitSubType_RemoteIO;
desc.componentFlags = 0;
desc.componentFlagsMask = 0;
desc.componentManufacturer = kAudioUnitManufacturer_Apple;
descRev.componentType = kAudioUnitType_Effect;
descRev.componentSubType = kAudioUnitSubType_Reverb2;
descRev.componentFlags = 0;
descRev.componentFlagsMask = 0;
descRev.componentManufacturer = kAudioUnitManufacturer_Apple;
图形设置
NewAUGraph(&graph);
AUNode ioNode;
AUNode rNode;
AUGraphAddNode(graph, &desc, &ioNode);
AUGraphAddNode(graph, &descRev, &rNode);
AUGraphOpen(graph);
AUGraphConnectNodeInput(graph, ioNode, 1, rNode, 0);
AUGraphConnectNodeInput(graph, rNode, 0, ioNode, 0);
格式说明及设置
// Describe format
audioFormat.mSampleRate = rate;//44100.00;
audioFormat.mFormatID = kAudioFormatLinearPCM;
audioFormat.mFormatFlags = kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked;
audioFormat.mFramesPerPacket = 1;
audioFormat.mChannelsPerFrame = 1;
audioFormat.mBitsPerChannel = 16;
audioFormat.mBytesPerPacket = 2;
audioFormat.mBytesPerFrame = 2;
OSStatus err = AudioUnitSetProperty(unit,
kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Output,
kInputBus,
&audioFormat,
sizeof(audioFormat));
if (noErr != err) {
[self showStatus:err];
}
err = AudioUnitSetProperty(unitRev,
kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Input,
0,
&audioFormat,
sizeof(audioFormat));
if (noErr != err) {
[self showStatus:err];
}
最佳答案
Are there restrictions for the allowed formats?
是的,他们通常非常严格。
What format params should I use?
使用单位的默认 ASBD 或使用基于预先构建的标志集(kAudioFormatFlagsAudioUnitCanonical
和 kAudioFormatFlagsCanonical
) .就像这样,而不是像这样组成你自己的格式:
audioFormat.mFormatFlags = kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked;
你会这样做:
audioFormat.mFormatFlags = kAudioFormatFlagsAudioUnitCanonical;
一般来说,如果您只是将两个装置相互连接起来,它们就能自行解决问题。如果您需要提供自己的音频,则必须指定输入格式(并且它可能需要基于kAudioFormatFlagsAudioUnitCanonical
,这是非交错的线性 PCM,每个样本都是在 SInt32
容器中表示为固定的 8.24 数字。
如果您需要更大的灵 active ,您可以在混响单元之前放置一个 AUConverter
音频单元,因为 AUConverter
将能够处理更多的输入格式(例如适当的浮点样本)。请注意,这伴随着增加处理的警告,因为 AUConverter 必须实时转换音频格式。
您可以在 Core Audio Essentials 上看到完整的 ASBD 示例Canonical Audio Data Formats 标题下的页面。
Should set the format in any scope of RemoteIO output element?
如果您的混响单元直接连接到 RemoteIO 输出,这些单元应该能够自行解决。
关于iOS 音频单元混响流格式问题 -10868 kAudioUnitErr_FormatNotSupported,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13687092/
您能给我推荐一些简单、免费的库来修改输入 wav 文件吗?我发现并尝试使用irrKlang,但它缺少自定义效果(它没有任何级别的自定义。您可以只使用效果失真,但不能设置任何内容) 如果有类似的库,那就
是否可以用于 channel 化声音四混响类型?并使用 4 channel 混响(两个立体声文件:LR 和 RL)。Web Audio Api 支持四模式吗?我在工作中使用 Web Midi Api。
我是一名优秀的程序员,十分优秀!