1

How to increase audio file volume? My app records calls, and its volume is low. Is there a way to increase the recorded call volume? Here is my code:

mediaRecorder = new MediaRecorder();
mediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
mediaRecorder.setAudioSamplingRate(44100);
mediaRecorder.setAudioEncodingBitRate(AudioFormat.ENCODING_PCM_16BIT);
mediaRecorder.setAudioChannels(2);
mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
mediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
assylias
  • 321,522
  • 82
  • 660
  • 783

2 Answers2

0

While using MediaPlayer you can call the setVolume(float,float) method with your object.

For eg-

MediaPlayer media = MediaPlayer.create(this,R.raw.your_file); media.setVolume(0,0);

The value passed as parameters are on a logarithmic scale from 0 to 1.

0

you can use Something like this

  player = MediaPlayer.create(this, R.raw.got);

 @Override
    public int onStartCommand(Intent intent, int flags, int startId) {

        new Thread(new Runnable() {
            @Override
            public void run() {

                player.start();
                player.setAudioStreamType(AudioManager.STREAM_MUSIC);
                player.setLooping(false);
                player.setVolume(100, 100);
                playAudioWithDelaysound();
                stopSelf();
            }
        });

        return super.onStartCommand(intent, flags, startId);

    }

use as you needed

seon
  • 1,050
  • 2
  • 13
  • 27