0

I am using AVPlayer for playing song from iPod Library. There are very limited methods in AVPlayer compare to AVAudioPlayer.

When I play song using AVPlayer in iPhone, the actual sound is very low compare to the song played in iPod Library.

My code goes as below:

AVPlayer *avPlayer = [[AVPlayer alloc] initWithURL:songURL];
[avPlayer play];

How can I amplify sound or increase volume while playing with AVPlayer??

Edit: I had also gone through this question and tried the apple's link but there is no significant difference in sound. I tried passing volume in float as 0.8, 1.0, 2.0, 10.0, 100.0. But when i pass higher values then disturbance increases... and Volume does not increase.

What are the other ways to increase sound with AVPlayer??

Community
  • 1
  • 1
DShah
  • 9,768
  • 11
  • 71
  • 127
  • See [this](http://stackoverflow.com/questions/3268949/adjusting-the-volume-of-a-playing-avplayer) very similar question. – spudwaffle Sep 16 '11 at 13:23
  • I already referred to this link but I don't understand why should i use such a long code when i am having this two lines of code. Also how can i implement that code with my code above??? – DShah Sep 16 '11 at 13:29

1 Answers1

3

Check out this link.

You cannot set volume greater than 1.0 for AVPlayer. If you increase volume to a value more than 1.0 then the distortion of voice and disturbance will increase.

But you need to check whats the output source of the player. Default is microphone, so try setting it to loudspeaker to get louder output.

Please refer below link for that.

How to record and play sound in iPhone app?

How to increase volume of sound recorded using AVAudioRecorder

Hope this help you.

Community
  • 1
  • 1
Parth Bhatt
  • 19,381
  • 28
  • 133
  • 216
  • @DShah: I still don't get the point why you are using AVPlayer instead of AVAudioPlayer? – Parth Bhatt Sep 20 '11 at 05:36
  • i want to fetch songs from ipod library and AVPlayer supports ipod library. Also because i am using aurioTouch example of Apple in my app, this example supports only AVFoundation Framework. so AVPlayer class has both features i.e. 1. it is under AVFoundation class and 2. it supports ipod library. Also i tried using MPMusicPlayerController but this does not support aurioTouch oscilloscope. – DShah Sep 20 '11 at 05:48
  • Also in first link it is said that `AudioSessionSetProperty` to be used so do i only need to write those two lines before creating my AVPlayer object??? – DShah Sep 20 '11 at 05:49
  • Thank You Parth, that was it... i am able to complete my app with this and got approved... thanx once again.. – DShah Sep 21 '11 at 10:23