2016-07-29 52 views
0

Ich habe bereits einen Beispielcode zum Aufzeichnen mit AVAudioEngine & gefunden, um sampleRate 22050 aac format audioFile auszugeben.Record und Resample zu aac Format mit AVAudioEngine, AVAudioSession setCategory AVAudioSessionCategoryRecord?

Nachdem ich den Code überprüft habe, gibt es ein Problem, dass ich Category AVAudioSessionCategoryPlayAndRecord anstelle von AVAudioSessionCategoryRecord festlegen muss.

How to improve the code for using "AVAudioSessionCategoryRecord" without "PlayAndRecord"?

(In diesem Fall sollte ich "AVAudioSessionCategoryRecord", nicht wahr?)

Wenn ich AVAudioSessionCategoryRecord setCategory, bekomme ich eine Fehlermeldung:

AVAudioEngineGraph.mm:1070: Initialize: required condition is false: IsFormatSampleRateAndChannelCountValid(outputHWFormat)

Terminating app due to uncaught exception 'com.apple.coreaudio.avfaudio', reason: 'required condition is false: IsFormatSampleRateAndChannelCountValid(outputHWFormat)'

Es ist ein Beispiel über Mikrofon In AVAudioSessionCategoryRecord scheint es mir, dass wir nur mit inputNode aufnehmen können. https://developer.apple.com/library/prerelease/content/samplecode/SpeakToMe/Introduction/Intro.html

Der folgende Code kann jetzt funktionieren.

Related Link

How can I specify the format of AVAudioEngine Mic-Input?

Recording audio file using AVAudioEngine

Antwort

0

Die AVAudioMixerNode nicht fähig ist, zwischen nicht-komprimierten und komprimierten Formate zu konvertieren. Dafür benötigen Sie die AVAudioConverter.