【问题标题】:Detect level of input audio?检测输入音频的电平?
【发布时间】:2016-02-05 02:26:50
【问题描述】:

我有一个应用程序需要使用麦克风来录制用户语音。我正在尝试制作speech to text

我正在使用SpeechKit.framework,下面是我使用的代码:

-(void)starRecording{

  self.voiceSearch = [[SKRecognizer alloc] initWithType:SKSearchRecognizerType
                                           detection:SKShortEndOfSpeechDetection
                                           language:[[USER_DEFAULT valueForKey:LANGUAGE_SPEECH_DIC] valueForKey:@"record"]
                                           delegate:self];
}

- (void)recognizer:(SKRecognizer *)recognizer didFinishWithResults:(SKRecognition *)results {
        long numOfResults = [results.results count];

        if (numOfResults > 0) {
            // update the text of text field with best result from SpeechKit
            self.recordString = [results firstResult];
            [self sendChatWithMediaType:@"messageCall" MediaUrl:@"" ContactDetail:@"{}" LocationDetail:@"{}"];

            [self.voiceSearch stopRecording];
        }


        if (self.voiceSearch) {
            [self.voiceSearch cancel];
        }
        [self starRecording];
    }

这使得SKRecognizer 始终处于打开状态,从而降低了应用程序的性能。

我想在麦克风检测到输入音频时启动SKRecognizer

我有办法吗?当麦克风为我输入声音时调用的方法或始终返回检测到的音频级别的方法?

谢谢!

【问题讨论】:

  • 您是否使用 AvsudioRecorder 类来录制音频?

标签: ios objective-c iphone audio-recording microphone


【解决方案1】:

您需要使用 SpeechKit 类来设置音频。 详情请看这里;

http://www.raywenderlich.com/60870/building-ios-app-like-siri

这个项目展示了如何检测音频阈值;

github.com/picciano/iOS-Audio-Recoginzer

【讨论】:

  • 我已经看到了这个教程,但没有什么可以帮助我。不是一种告诉我何时可以开始录制的方法。那里有一个按钮操作。
  • 我看到该示例适用于按住按钮说话的想法,这不是您的要求。我会编辑我的答案,但是,...这是一个可以满足您需求的项目; github.com/picciano/iOS-Audio-Recoginzer
  • 我把这个文件检查到之前。我已经解决了。我使用 'AVAudioRecorder' 连续记录以检查平均麦克风功率。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-04-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-08-23
相关资源
最近更新 更多