iPhone: Adjusting playback volume in app during a phone call - iphone

I have a soundboard application that plays mp3 files using AVAudioPlayer. The sound can be adjusted to high while listening to any of the clips.
My problem is when the phone is in use and I navigate to the app to play the soundboard the volume is set very low. I'm trying to make it so the the sound from my app can be heard by the person on the other line. They can currently hear the sound but its very low and hard to make out. Is there a way to raise the volume in my app while the phone is in use?

Have you tried setting the AVAudioPlayer volume (playback gain) property to 1.0 (max)?

This could be something to do with the hardware volume settings, i.e. when you're in a call the rocker buttons on the side of the phone control the volume of the call. This volume may be controlling the volume of the app as well. May be worth increasing the volume of the call and see if this increases the volume of the app too. If so, then work for a solution to that problem such as implementing an MPVolumeView in the app and customising its behaviour.

If a phone call is answered, while your app is launched, your app is no longer running until the phone call terminates. At the end of the call you could adjust the AVAudioPlayer volume to 1.0 (100%).

Related

Controlling the Sound of Audio

I am playing the sound in my App and sound still continue play even when App enter into background i want to control the Volume of that audio when it enter into background . Like in this APP example.I want audio volume remain maximum even user try to turn off the volume. I am unable to splve it can any one out there help me out.
if you are using AVAudioPlayer the just use AVAudioPlayer instance say player like this:
player.volume=1; //for maximum volume
This is AVAudioPlayer's volume, and in reply to your question that even if user minimizes volume of Iphone it should remain in full, then you should know that according to apple policies, there are things which have control for user only, this is what they call user privilege, your app can not control iphone volume,
and for controlling player volume (you don't need any effort if you talk about iphone volume) , i am little doubtful how you want to do this, i mean you must have some button or horizontal slider to achieve this, anyhow proceed with your logic with the delegate method
- (void)applicationDidEnterBackground:(UIApplication *)application
in your appdelegate class

AudioToolbox decreases sound volume when app starts

In my app I use the AudioToolbox framework so that I can use the iSpeech SDK. If music is playing (in the background, from the Apple music app), when the app starts, the music skips (stops playing completely) for just a moment (half a second), then resumes at a diminished volume. I'm not at all sure why this is happening, but Google had nothing to say about it. Has anyone experienced a problem like this? Thanks!
Core Audio needs to insert a mixer in the audio output path so that your app has a way to make sounds. (Think of the "skip" as pulling out and plugging in patch cords.) The mixer allocates some volume to your app; what's left for the music player is less than 100%, thus the disminished volume.

iPod Volume Level Affects App Volume Level

I am writing an iPad app that uses the "Flite" text-to-speech engine to announce specific events. The Flite engine uses an AVAudioPlayer instance to play the speech audio once it renders. For fun, I decided to add some simple controls to my app to allow the user to control iPod playback (next, prev, play/pause and volume - the basics) while my app is running using MPMusicPlayerController (of course).
The problem I am having is that when I adjust the iPod volume using MPMusicPlayerController, all of my audio is affected, including other sound effects and the speech audio. I set the volume for these other audio players (AVAudioPlayer instances) to 1.0 before playing the sound but it seems that the volume is always capped at whatever the iPod player volume is set to...
Is this normal? And what can I do to get around it? I want my app's audio to play at system full volume regardless of the volume level of the iPod player. (Example: The user had set the system volume to 80% of the device's max. I want my app to play audio at 100% of that 80% while allowing the user to adjust the iPod audio playback to 0-100% of that 80%.) Note: I am not interested in "ducking" but setting the iPod volume lower at all times while my app is running (background music).
I also have the problem, that -sometimes- when you first launch the app and press play on the iPod player (which sends the [player play] call), the iPod does not respond. If I press the home button, go into the iPod app and start playback then, once returning to my app, it works fine. What the deal with that?
Thanks in advance for any help!!
It could be something to do with the audio session category you've specified. Check out the Audio Session Programming Guide to see if you've chosen the right category.
The volume buttons on the side control the system volume and by extension the volume of your app's sounds.
I guess it's considered to be the Master volume control.
you can set the volume for specific samples or sounds using the AVItem's setVolume
[item setVolume]
You can create an AVItem to reference an existing sound file in your application or on the iphone. The code is pretty simple and looks like this -->
AVItem *item [[AVItem alloc]
initWithPath:#"the file"];
[item setVolume];
btw, this will not affect the rest of the audio channel (instantiated by some kinda AVController object) and the volume that you've set in your code will not be displayed on you screen so im not sure if you can change it at run time.

Iphone Speaker Buttons used as App Controls

Is it possible to use the external speaker volume controls of iphone as a control for an App you have developed?
For example as a control of a timer app for which the enable button for the timer to start counting is the top external volume button and disable timer is the lower external button.
If so, which classes of iOS 4 sdk can override those external buttons for an application or those external buttons are locked only for volume controls and nothing else?
I have seen a video of the Camera+ app that supposedly uses the volume key to snap a picture (instead of touching the button on the screen). http://taptaptap.com/blog/volumesnap/
I, myself, was pretty confused when I saw that and thought it must have been a mock up or something. But I asked around and apparently, if you're running an audio player, you get notifications when the volume keys are pressed.
The idea was put forward that if you can run a silent audio on a loop and hook into the volume key notifications to do what you want.
However, I've looked at both the AVAudioPlayer and the MPMoviePlayerController class documentation and can't see any such notifications. I suspect they're private, which isn't very useful.

iPhone (SDK 2.2): adusting playback volume while NOT actively playing music w/ AVFoundation?

So I have an app which plays many short sound clips. I need to know when the sounds are finished playing, and I need to use mp3s, so I'm using AVFoundation for the sound playback.
When a sound is actively playing, and the user uses the hardware volume buttons, the playback volume changes. Problem is, the app is NOT constantly playing sounds, and when it's not, and the hardware buttons are used, the RINGER volume gets adjusted instead.
How do I set it up so, as long as the app is running, the user can adjust the playback volume?
Thanks!
Turns out this can be accomplished by allocating an AVAudioPlayer with any valid sound file and calling the prepareToPlay method, without ever calling the play method.
Works perfectly.
Start an AudioSession and don't stop it when you're not playing sounds.
so you want to disable ringer playback volume as long as the app is running? therefore the hardware controls will only adjust the app playback sounds?
i dont think this is possible unless you are "always playing sound" for example, many games are always playing background music or what have you.
You might be able to accomplish this by constantly playing a 0 volume sound as long as your app is running. You could then play your sound clips over it.
How do I play multiple sounds simultaneously?