ios - AUGraph 3D Mixer 噼啪声

标签 ios objective-c audio core-audio

我有一个 AUGraph 可以使用此设置播放和录制音频:

RemoteIO      ->                                 -> RemoteIO
                  Mulichannel Mixer -> 3D Mixer 
Read Callback ->                                 -> Write Callback

我的问题是我在录制的声音中有噼啪声。没有 3D 混合器 声音很好。但是我需要他来调整播放率...

音频格式:

    memset(&_audioFormat, 0, sizeof(_audioFormat));
size_t bytesPerSample = sizeof (UInt16);
_audioFormat.mFormatID          = kAudioFormatLinearPCM;
_audioFormat.mFormatFlags       = kAudioFormatFlagsCanonical;
_audioFormat.mBytesPerPacket    = bytesPerSample;
_audioFormat.mFramesPerPacket   = 1;
_audioFormat.mBytesPerFrame     = bytesPerSample;
_audioFormat.mChannelsPerFrame  = 1;
_audioFormat.mBitsPerChannel    = 8 * bytesPerSample;
_audioFormat.mSampleRate        = 22100.0f;

我不知道为什么 3D Mixer 会添加裂纹 -.- 这是一个小样本音频:Click

希望这些信息足以找到解决方案。 谢谢:)

一些附加信息:

有裂纹

    AudioUnitGraph 0x7F8000:
  Member Nodes:
    node 1: 'auou' 'rioc' 'appl', instance 0x1cd66d40 O I
    node 2: 'aumx' 'mcmx' 'appl', instance 0x1e055b40 O I
    node 3: 'aumx' '3dem' 'appl', instance 0x1e05e7a0 O I
  Connections:
    node   1 bus   1 => node   2 bus   1  [ 1 ch,  22000 Hz, 'lpcm' (0x0000000C) 16-bit little-endian signed integer]
    node   2 bus   0 => node   3 bus   0  [ 1 ch,  22000 Hz, 'lpcm' (0x0000000C) 16-bit little-endian signed integer]
    node   3 bus   0 => node   1 bus   0  [ 2 ch,  44100 Hz, 'lpcm' (0x00000C2C) 8.24-bit little-endian signed integer, deinterleaved]
  Input Callbacks:
    {0x12d9c1, 0x1cd65f30} => node   2 bus   0  [1 ch, 22000 Hz]
  CurrentState:
    mLastUpdateError=0, eventsToProcess=F, isRunning=F

没有裂纹

    AudioUnitGraph 0x7E7000:
  Member Nodes:
    node 1: 'auou' 'rioc' 'appl', instance 0x1e888810 O I
    node 2: 'aumx' 'mcmx' 'appl', instance 0x1e88a0e0 O I
    node 3: 'aumx' '3dem' 'appl', instance 0x1e88b200 O  
  Connections:
    node   1 bus   1 => node   2 bus   1  [ 1 ch,  22000 Hz, 'lpcm' (0x0000000C) 16-bit little-endian signed integer]
    node   2 bus   0 => node   1 bus   0  [ 1 ch,  22000 Hz, 'lpcm' (0x0000000C) 16-bit little-endian signed integer]
  Input Callbacks:
    {0x1469b9, 0x1d5bffa0} => node   2 bus   0  [1 ch, 22000 Hz]
  CurrentState:
    mLastUpdateError=0, eventsToProcess=F, isRunning=F

更新:

我认为问题只会在 AudioGraph 重启后发生。

1.) CheckError(AUGraphStart(self.graph), "Error starting graph. - error code");
2.) Recording <- NO CRACKLE!
3.) CheckError(AUGraphStop(self.graph), "Error stopping graph. - error code");
4.) CheckError(AUGraphStart(self.graph), "Error starting graph. - error code");
5.) Recording <- CRACKLE!

最佳答案

我找到了解决方法,但没有找到解决方案。 只需将 3DMixer 替换为 kAudioUnitSubType_Varispeed AU。

speedDescription.componentFlags = 0;
speedDescription.componentFlagsMask = 0;
speedDescription.componentType = kAudioUnitType_FormatConverter;
speedDescription.componentSubType = kAudioUnitSubType_Varispeed;
speedDescription.componentManufacturer = kAudioUnitManufacturer_Apple;

我希望这对某人有帮助!

关于ios - AUGraph 3D Mixer 噼啪声,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14243785/

相关文章:

iphone - 导航 Controller (及其所有 View )仅是纵向的。我怎样才能把它们变成风景呢?

iphone - 配置时立即使用属性还是使用临时变量?

iphone - 从不兼容类型分配给 'NSLineBreakMode'

ios - 在功能启动Objective-C之前按两次

objective-c - 使用 NSDirectoryEnumerator 为文件系统建模

html - 为音乐或视频创建下载链接

ios - 如何获取音频 block 以在核心音频或 AVFoundation 中进行分析

audio - MPEG-4 文件中的多个音频流

javascript - 使用第三方 IME 时,JS keydown keyup keypress 事件在 IOS8 上不起作用

objective-c - Objective C 中存在内存问题的 C 数组