Record audio from text to speech ios AVAudioSession

337 views Asked by At

I am using Xamarin to develop an iOS app. I need to be able to record the audio from AVSpeechUtterance to a file, or stream the audio buffer from internal audio to a method that will populate a byte array.

I've searched high and low on how to record internal audio (from text to speech api). I'm only able to use the internal microphone for recording, not the audio being played by app.

Currently using Xamarin's example for text to speech:

    public void Speak (string text)
    {
        var speechSynthesizer = new AVSpeechSynthesizer ();

        var speechUtterance = new AVSpeechUtterance (text) {
            Rate = AVSpeechUtterance.MaximumSpeechRate/2,
            Voice = AVSpeechSynthesisVoice.FromLanguage ("en-US"),
            Volume = 0.5f,
            PitchMultiplier = 1.0f
        };

        speechSynthesizer.SpeakUtterance (speechUtterance);
    }

Hints/solution can be C#, Swift or Objective C. I just need to be pointed in the general right direction.

0

There are 0 answers