Setting KaudiosessionMode in Apple’s SpeakHere Example will cause the volume to drop sharply. Any solution?

I encountered the problem of too low audio in my own application whenever I used the VoiceChat mode, so as an idiot, I checked and downloaded Apple’s audio unit programming sample code (SpeakHere) and added the VoiceChat mode to the app. It turns out that the problem also occurs there: running in this mode will cause everything to be around 20% of the required volume.

I immediately added this code to line 267 of SpeakHereController.mm after the PlayAndRecord category was set:

// set mode - this results in audio being too soft
UInt32 mode = kAudioSessionMode_VoiceChat;

error = AudioSessionSetProperty(kAudioSessionProperty_Mode, sizeof(mode), &mode);
if (error) printf("couldn't set audio session mode!");

I am using the VoiceChat mode with RemoteIO to get the echo cancellation function when the speaker phone is used. VoiceProcessingIO works (a bit), but the performance of the old iPhone (3GS) is very poor and cannot be used-this That’s why I use RemoteIO. I have confirmed that the speaker route is correct. I even tried setting the measurement mode and manually increasing the gain-I cannot detect any improvement.

About preventing loud volume when using AudioSession mode Any suggestions for dropping?

It turns out that when the VoiceChat mode is set to determine the best settings for gain, echo cancellation, etc. , Use the /current/audio route. This means that if you want to set a specific route, you need to do this before setting the mode-not after.

Doing this in this order can solve My volume problem:

>Set PlayAndRecord>Set speaker’s route>Set mode>Use VoiceProcessingIO in my audio unit>Keep the hardware sampling rate low (8k), so that it can be used on old devices such as 3GS Maintain good performance

I encountered the problem of too low audio in my own application any time I used the VoiceChat mode, so I checked as an idiot and downloaded it Apple’s audio unit programming sample code (SpeakHere) and added VoiceChat mode to the app. It turns out that the problem also occurs there: running in that mode will cause everything to be around 20% of the required volume.

I added this code to line 267 of SpeakHereController.mm immediately after the PlayAndRecord category was set:

// set mode - this results in audio being too soft
UInt32 mode = kAudioSessionMode_VoiceChat;

error = AudioSessionSetProperty(kAudioSessionProperty_Mode, sizeof(mode), &mode);
if (error) printf("couldn't set audio session mode!");

I am using VoiceChat mode with RemoteIO in order to get echo cancellation when speakerphone is used. VoiceProcessingIO works (a bit), but the performance of the old iPhone (3GS) Very bad and unusable-this is why I use RemoteIO. I have confirmed that the speaker route is correct. I even tried setting the measurement mode and manually increasing the gain-I cannot detect any improvement.

About Any suggestions to prevent large volume drops when using AudioSession mode?

It turns out that when the VoiceChat mode is set to determine the best settings for gain, echo cancellation, etc., the /current/audio route is used. This means that if You want to set a specific route, you need to do this before setting the mode-not after.

Doing this in this order can solve my volume problem:

>Set PlayAndRecord>Set speaker’s route>Set mode>Use VoiceProcessingIO in my audio unit>Keep the hardware sampling rate low (8k) to maintain good performance on old devices such as 3GS

< p>

Leave a Comment

Your email address will not be published.