AVAudioEngine 和 AVAudioPlayer。 setVoiceProcessingEnabled 低音量输出

问题描述 投票:0回答:1

正如标题所示,我使用 AVAudioEngine 进行 SFSpeechRecognition 输入,使用 AVAudioPlayer 进行声音输出。

Apple 在本次talk 中表示,setVoiceProcessingEnabled 函数非常有用地取消从扬声器到麦克风的输出。我在 AVAudioInputNode 和 AVAudioOutputNode 上设置了 voiceProcessing。

当speechRecognitionEnabled:YES 运行 xcode 时,会抛出以下错误:

throwing 18,446,744,073,709,551,615
  from AU (0x13bf98dd0): auou/vpio/appl, render err: 18,446,744,073,709,551,615

设置节点时没有抛出任何错误,并且似乎可以工作,但音量很低,即使系统音量调高也是如此。任何对此问题的解决方案将不胜感激。

我尝试了各种 AVAudioEngine 节点设置。一种设置带有混音器节点,一种设置没有。我期望音频电平与系统音量一起很大。

ios objective-c avaudioplayer avaudioengine sfspeechrecognizer
1个回答
0
投票

您是否在输入和输出节点上都启用了语音处理?

这是我尝试过的方法,它(在某种程度上)有效:

audioInputNode=engine.inputNode 
    audioInputNode.volume=0
    do{
        try audioInputNode.setVoiceProcessingEnabled(true)
    }
    catch{
        print("Could not enable voice processing in audioinputnode")
    }
    let outputNode = engine.outputNode
    do{
        try outputNode.setVoiceProcessingEnabled(true)
    }
    catch{
        print("Could not enable voice processing in output")
    }

我说“有点”有效,因为当我录制麦克风输入时,扬声器发出的声音肯定被抵消了,但是录制到文件中的麦克风音频有点断断续续

© www.soinside.com 2019 - 2024. All rights reserved.