Search Unity

Sound very low on iPhone 4

Discussion in 'iOS and tvOS' started by totsboy, Sep 18, 2013.

  1. totsboy

    totsboy

    Joined:
    Jul 12, 2013
    Posts:
    253
    I'm having a problem specifically with iPhone 4, the sound is really low even at maximum volume. All other devices I tested (iPod, iPad 2, iPad 3) are fine. Other apps on the same iPhone are also fine.
    The iPhone has iOS 6.1.3, and I'm using Unity 4.2.0.
     
  2. totsboy

    totsboy

    Joined:
    Jul 12, 2013
    Posts:
    253
    Just realized the sound is coming form the upper speaker only, not the bottom ones! This is really weird!
    When using earphones works fine also!
    Any ideas what this could be?
     
  3. Mantas-Puida

    Mantas-Puida

    Joined:
    Nov 13, 2008
    Posts:
    1,864
    Did you enable sound recording in Player Settings?
     
  4. totsboy

    totsboy

    Joined:
    Jul 12, 2013
    Posts:
    253
    Nop, never did.
    Tested today in another iPhone 4 to be sure and the problem also occurs.
     
  5. totsboy

    totsboy

    Joined:
    Jul 12, 2013
    Posts:
    253
    Tried different versions of Unity (4.2.1, 4.2.0, 4.1.3 and 4.0), all the same.
    Will try a different version of XCode now, but I'm starting to get worried :/
     
  6. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    The iPhone only has one speaker.

    --Eric
     
  7. totsboy

    totsboy

    Joined:
    Jul 12, 2013
    Posts:
    253
    There's one that you use when you receive calls (above the screen) and two on the bottom, where the sound is supposed to come out. The sound is coming out from the one above the scree, therefore it is very very low volume.
     
  8. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    One of those "two" is a mic, not a speaker.

    --Eric
     
  9. cbaltzer

    cbaltzer

    Joined:
    Jan 11, 2012
    Posts:
    120
    I ran into this issue when using the microphone (voice chat in my game). Here's a fix that forces the audio out of the speaker, not the headset: https://github.com/cbaltzer/UnitySpeakerFix

    Though, that was written for Unity 4.1, haven't tested it with 4.2.
     
    Last edited: Sep 23, 2013
  10. u3dxt

    u3dxt

    Joined:
    Jul 6, 2013
    Posts:
    317
    cbaltzer is correct. There are some API discrepancies with the iPhone4. For that device, you have to route the audio to the speaker. If you are developing a plugin that uses the audio APIs, this is the code to fix it:
    Code (csharp):
    1.  
    2. [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord error:nil];
    3. UInt32 audioRouteOverride = kAudioSessionOverrideAudioRoute_Speaker;
    4. AudioSessionSetProperty(kAudioSessionProperty_OverrideAudioRoute,
    5.                         sizeof(audioRouteOverride), &audioRouteOverride);
    6.  
     
  11. totsboy

    totsboy

    Joined:
    Jul 12, 2013
    Posts:
    253
    Just confirming what cbaltzer and u3dxt said, that was the issue :)
    Thank you everyone!
     
  12. gabeturow

    gabeturow

    Joined:
    Jan 21, 2013
    Posts:
    3
    Hey! I was having same problem, and just solved it, with no software change in Unity 4.6. Just uncheck Prepare iOS for recording in Player Settings.
     
    Baxop likes this.
  13. Baxop

    Baxop

    Joined:
    Feb 28, 2015
    Posts:
    2
    You saved my life ^^