Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Volume of audio sound is decreased permanently after audio recording #19220

Closed
aikewoody opened this issue Sep 22, 2022 · 4 comments
Closed

Volume of audio sound is decreased permanently after audio recording #19220

aikewoody opened this issue Sep 22, 2022 · 4 comments
Labels
needs validation Issue needs to be validated

Comments

@aikewoody
Copy link

aikewoody commented Sep 22, 2022

Summary

Playing sound with the audio plugin expo-av works normally but after recording audio with the same plugin the volume of the iPhone is buggy within the app.

Steps to reproduce:

  1. Set the volume to 100%, programatically we also use await sound.setVolumeAsync(1)
  2. Play an audio file with expo-av, this all works as expected
  3. Record audio with expo-av
  4. Play the first audio file and notice that the volume barely hits 25%

This behaviour only happens on iOS

What platform(s) does this occur on?

iOS

Environment

expo-env-info 1.0.5 environment info:
System:
OS: macOS 12.6
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.16.0 - ~/.nvm/versions/node/v16.16.0/bin/node
Yarn: 3.2.3 - ~/.nvm/versions/node/v16.16.0/bin/yarn
npm: 8.11.0 - ~/.nvm/versions/node/v16.16.0/bin/npm
Watchman: 2022.03.21.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.11.3 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 16.0, macOS 12.3, tvOS 16.0, watchOS 9.0
IDEs:
Android Studio: 2021.2 AI-212.5712.43.2112.8609683
Xcode: 14.0/14A309 - /usr/bin/xcodebuild
npmPackages:
expo: ~46.0.9 => 46.0.10
react: 18.0.0 => 18.0.0
react-native: 0.69.5 => 0.69.5
npmGlobalPackages:
eas-cli: 2.1.0
expo-cli: 6.0.5
Expo Workflow: managed

Minimal reproducible example

https://github.com/ristrettostudio/expo-example-audio

@aikewoody aikewoody added the needs validation Issue needs to be validated label Sep 22, 2022
@keith-kurak
Copy link
Contributor

keith-kurak commented Sep 27, 2022

Hi @aikewoody! I think I was able to reproduce this using your example. What it sounds like to me is that, prior to recording, all sound is going through the speaker, and, after recording, all audio is then going through the earpiece, which is why it sounds so soft.

Per this comment on a previous issue, it looks like you need to change the audio mode so the phone is no longer setup for recording by putting this line after you stop recording:

 await Audio.setAudioModeAsync({
        allowsRecordingIOS: false,
      });

Once I added this line, I was able to hear the recorded audio through the speaker at the expected volume. You can see a demonstration of this in the snack here: https://snack.expo.dev/@keith-kurak/ios---recording-sound-forces-future-playback-to-earpiece.

Apologies for the confusion- we will update the Audio documentation to make this more clear.

Let me know how it goes!

@aikewoody
Copy link
Author

aikewoody commented Sep 30, 2022

@keith-kurak Thanks for the reply! This is exactly the issue and also the solution, fantastic! And great that you will also update the documentation 👍

@FRCassarino
Copy link

Same issue. Does not work with expo-speech.

@zero19124
Copy link

Hi @aikewoody! I think I was able to reproduce this using your example. What it sounds like to me is that, prior to recording, all sound is going through the speaker, and, after recording, all audio is then going through the earpiece, which is why it sounds so soft.

Per this comment on a previous issue, it looks like you need to change the audio mode so the phone is no longer setup for recording by putting this line after you stop recording:

 await Audio.setAudioModeAsync({
        allowsRecordingIOS: false,
      });

Once I added this line, I was able to hear the recorded audio through the speaker at the expected volume. You can see a demonstration of this in the snack here: https://snack.expo.dev/@keith-kurak/ios---recording-sound-forces-future-playback-to-earpiece.

Apologies for the confusion- we will update the Audio documentation to make this more clear.

Let me know how it goes!
very helpful!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs validation Issue needs to be validated
Projects
None yet
Development

No branches or pull requests

4 participants