我正在编写一个使用 CoreAudio 的音频单元 API 的 iOS 应用程序,并且在某个时刻我会进行调用AudioUnitGetProperty(audioUnit, kAudioUnitProperty_StreamFormat, ...)。此时我设置了一个断点来查看 ASBD,我发现该mFormatFlags字段是41. 问题是,我可以从该数字中解码实际的标志名称(例如kAudioFormatFlagIsNonInterleaved | kAudioFormatFlagIsPacked | ...)吗?
多谢。
我正在用 Audio Units 编写一个简单的 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;
Run Code Online (Sandbox Code Playgroud)
图表设置
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); …Run Code Online (Sandbox Code Playgroud) 我正在尝试为远程 I/O 音频单元的输入流设置不同的采样率(如 32kHz、24kHz 等)。但是输出总是以这些采样率之一播放 - 22.05kHz、33.1kHz、11.0kHz,无论我设置什么。令人奇怪的是,当我叫 AudioUnitGetProperty上kAudioUnitScope_Output了kAudioUnitProperty_SampleRate,它总是返回44.1
- (void)startToneUnit
{
AudioComponentDescription defaultOutputDescription;
defaultOutputDescription.componentType = kAudioUnitType_Output;
defaultOutputDescription.componentSubType = kAudioUnitSubType_RemoteIO;
defaultOutputDescription.componentManufacturer = kAudioUnitManufacturer_Apple;
defaultOutputDescription.componentFlags = 0;
defaultOutputDescription.componentFlagsMask = 0;
// Get the default playback output unit
AudioComponent defaultOutput = AudioComponentFindNext(NULL, &defaultOutputDescription);
NSAssert(defaultOutput, @"Can't find default output");
// Create a new unit based on this that we'll use for output
OSErr err = AudioComponentInstanceNew(defaultOutput, &toneUnit);
NSAssert1(toneUnit, @"Error creating unit: %hd", err);
// Set our tone rendering function …Run Code Online (Sandbox Code Playgroud) 我设置了音频单元渲染回调:
AURenderCallbackStruct input;
input.inputProc = RenderAudioBuffer;
input.inputProcRefCon = self;
err = AudioUnitSetProperty(audioPlaybackUnit,
kAudioUnitProperty_SetRenderCallback,
kAudioUnitScope_Input,
0,
&input,
sizeof(input));
Run Code Online (Sandbox Code Playgroud)
这是回调方法:
OSStatus RenderAudioBuffer( void *inRefCon,
AudioUnitRenderActionFlags *ioActionFlags,
const AudioTimeStamp *inTimeStamp,
UInt32 inBusNumber,
UInt32 inNumberFrames,
AudioBufferList *ioData)
{
}
Run Code Online (Sandbox Code Playgroud)
在回调方法中,inNumberFrames始终为1024。如何更改它?我一次渲染有超过1024帧(64K)。
AUParamInfo()似乎不存在于iOS7框架(CoreAudio,AudioUnit,AudioToolbox)中.我想知道如何获得单位的所有参数.也就是说,在不知道它是什么类型或子类型的情况下,因为如果不是,那么答案就是在音频单元参数参考中查找.
我正在研究一种MIDI效果(一种VST插件,可以使用C++中的Juce Framework修改传入的MIDI生成新数据并将其转发出来).我看到技术上可以生成一个新的MIDI消息,每个样本使我的MIDI流流量为16到24位,每秒41,000次或更多.对于MIDI硬件来说,这似乎完全不可能.
有什么指导或规则我必须遵守什么时候我决定我的带USB接口到硬件合成器,无论新老?
编辑:我应该补充说,我想要做的是,更高的带宽会有所帮助,但应该使用Arturia Minibrute等硬件.我试图做一些新颖的事情,比如将信封和LFO应用到调制和音高轮上.
使用AudioKit进行声音管理,我注意到这个非常简单的代码问题(bug?).
import AudioKit
class MainViewController: UIViewController {
var audioFile: AKAudioFile?
var audioPlayer: AKAudioPlayer?
override func viewDidLoad() {
super.viewDidLoad()
}
@IBAction func onPlayButtonClick(_ sender: Any) {
do {
audioFile = try AKAudioFile(forReading: Bundle.main.url(forResource: "3e", withExtension: "mp3")!)
audioPlayer = try AKAudioPlayer(file: audioFile!)
AudioKit.output = audioPlayer
AudioKit.start()
audioPlayer!.play()
} catch {
print(error)
}
}
}
Run Code Online (Sandbox Code Playgroud)
使用play()方法启动播放时,日志和进程中的所有内容都是正常的(播放器持续时间,currentTime).但是我没有听到扬声器中的音频(只有一种风噪声).一旦我插入耳机并再次点击按钮,我通常会听到音频.然后,我拔下我的耳机并点击按钮,我听不到音频(只有风声).
我在iPhone 5S上面对此问题.
我在iPad5上没有面对这个问题,我在模拟器上没有面对这个问题.我没有其他设备尝试重现.
两种设备:iOS 11.1.2和AudioKit:v4.0.4
注意:我的扬声器与任何其他应用程序正常工作,我已经检查了音量.未插入耳机时,默认outputDevice设置为Speakers.
在我的 iOS AU 主机应用程序中,我使用 AVAudioUnitComponentManager.components 方法来检索可用音频单元的列表。大多数时候它都按预期工作。但有时它仅返回 Apple 创建的音频单元,而不返回设备上安装的第三方音频单元。有趣的是,如果我在应用程序中遇到此问题后,我转到 GarageBand 并打开那里的音频单元列表,那么当我返回到我的应用程序时,所有第三方 AU 都会出现。所以我想知道在调用 GarageBand 正在执行的 AVAudioUnitComponentManager.components 方法之前可能应该完成一些其他初始化,我也应该在我的应用程序中执行。
有什么建议么?
我正在使用Apple的MixerHost示例项目,该项目设置了一个音频单元处理图,其中包含一个连接到远程I/O音频单元的多声道混音器音频单元.我试图在两者之间放置一个格式转换器音频单元,这样我就可以转换混音器输出的格式.
复制两个现有音频单元的设置似乎很简单,当我输出图形设置时,它看起来是正确的:
Member Nodes:
node 1: 'auou' 'rioc' 'appl', instance 0x1cdf10 O
node 2: 'aufc' 'conv' 'appl', instance 0x1ce890 O
node 3: 'aumx' 'mcmx' 'appl', instance 0x1ceba0 O
Connections:
node 3 bus 0 => node 2 bus 1
node 2 bus 0 => node 1 bus 0 [ 2 ch, 0 Hz, 'lpcm' (0x0000000C) 16-bit little-endian signed integer]
Run Code Online (Sandbox Code Playgroud)
但是,当我初始化图形时,我得到错误-10877,无效元素,图形无法启动.任何人都可以看到什么是错的?这是完整的设置代码:
NSLog (@"Configuring and then initializing audio processing graph");
OSStatus result = noErr;
//............................................................................
// Create a new audio processing graph.
result …Run Code Online (Sandbox Code Playgroud) 我正在开发一个卡拉OK软件.并打算通过使用audiounit混合音频,但我不知道如何设置范围和元素?例如:
UInt32 busCount = 2;
OSStatus result = AudioUnitSetProperty (
mixerUnit,
kAudioUnitProperty_ElementCount
kAudioUnitScope_Input,
0,
&busCount,
sizeof (busCount
);
Run Code Online (Sandbox Code Playgroud)
为什么范围是'kAudioUnitScope_Input'而元素是'0',这是什么意思?
audiounit ×10
core-audio ×8
ios ×8
avfoundation ×2
iphone ×2
audioformat ×1
audiokit ×1
c++ ×1
callback ×1
ios7 ×1
juce ×1
midi ×1
objective-c ×1
vst ×1