MediaRecorder setAudioChannels - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for MediaRecorder setAudioChannels method.

This code example shows how to use the following methods:prepare, setAudioChannels, setAudioEncoder, setAudioEncodingBitRate, setAudioSource
      File output=
          new File(
                   Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS),
                   BASENAME);
 
      recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
      recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
      recorder.setOutputFile(output.getAbsolutePath());
 
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD_MR1) {
        recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
        recorder.setAudioEncodingBitRate(160 * 1024);
      } 
      else { 
        recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
      } 
 
      recorder.setAudioChannels(2);
 
      try { 

8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setAudioChannels, setAudioEncoder, setAudioEncodingBitRate, setAudioSamplingRate, setAudioSource
	boolean setUrl(String path) {
 
                Log.i("Error Bitch", path);
 
		try { 
			m_MediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
			m_MediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
			m_MediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);
			m_MediaRecorder.setAudioChannels(2);
			m_MediaRecorder.setAudioEncodingBitRate(128);
			m_MediaRecorder.setAudioSamplingRate(44100);
			m_MediaRecorder.setOutputFile(path);
		} catch (Exception e) {
			e.printStackTrace();
            return false; 
		} 
		return true; 
	} 
 
 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:prepare, setAudioChannels, setAudioEncoder, setAudioSource, setOutputFile
        mPlayer = null;
    } 
 
    private void startRecording( ) 
    { 
        mRecorder = new MediaRecorder( );
        mRecorder.setAudioSource( MediaRecorder.AudioSource.MIC );
        mRecorder.setOutputFormat( MediaRecorder.OutputFormat.THREE_GPP );
        mRecorder.setAudioChannels(2);
        mRecorder.setOutputFile( mFileName );
        mRecorder.setAudioEncoder( MediaRecorder.AudioEncoder.AMR_NB );
 
        try 
        { 
            mRecorder.prepare( );
            mRecorder.start( );
        } 
        catch( IOException e )
        { 
            Log.e( LOG_TAG, "prepare() failed" );
        } 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:prepare, setAudioChannels, setAudioEncoder, setAudioEncodingBitRate, setAudioSource
	 */ 
	@Override 
	protected void onPreExecute() { 
		super.onPreExecute(); 
 
		mRecorder = new MediaRecorder();
		mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
		mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
		mRecorder.setAudioChannels(2);
		mRecorder.setAudioEncodingBitRate(44100);
		mRecorder.setOutputFile(mFileName); 
		mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_WB);
		try { 
            mRecorder.prepare();
		} catch (IOException e) {
            Log.e("AudioRecordTest", "prepare() failed");
        } 
		 
		 
		//prepare for a progress bar dialog 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:prepare, setAudioChannels, setAudioEncoder, setAudioEncodingBitRate, setAudioSamplingRate
	    Button btn_stop = ((Button) findViewById(R.id.btnStop));
	    System.out.println(" ---- " + Environment.getExternalStorageDirectory() + " ---- ");
	    btn_start.setOnClickListener(new Button.OnClickListener(){
	    	public void onClick(View v) {
	    		System.out.println("======== start button");
	    		recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
	    	    recorder.setOutputFormat(MediaRecorder.OutputFormat.DEFAULT);
	    	    recorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);
	    	    recorder.setAudioSamplingRate(16);
	    	    recorder.setAudioEncodingBitRate(96000);
	    		recorder.setAudioChannels(1);
	    	    recorder.setOutputFile(mUri);
				try { 
					recorder.prepare();
				} catch (IllegalStateException e) {
					// TODO Auto-generated catch block 
					e.printStackTrace();
				} catch (IOException e) {
					// TODO Auto-generated catch block 
					e.printStackTrace();

5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:prepare, setAudioChannels, setAudioEncoder, setAudioSamplingRate, setAudioSource
		this.databaseHelper = databaseHelper;
	} 
 
	public void start() { 
		if (mRecorder == null) {
			mRecorder = new MediaRecorder();
			mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
			mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
			mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
 
			mRecorder.setAudioChannels(1);
			mRecorder.setAudioSamplingRate(8000);
 
			mRecorder.setOutputFile("/dev/null");
 
			try { 
				mRecorder.prepare();
			} catch (IllegalStateException e) {
				e.printStackTrace();
			} catch (IOException e) {

5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:prepare, setAudioChannels, setAudioEncoder, setAudioEncodingBitRate, setAudioSamplingRate
	    regtooth.mkdir();
	    File dir=new File("mnt/sdcard/RegTooth/"+this.nome);
	    dir.mkdir();
	    regtooth.getParentFile();
 
		recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
		recorder.setOutputFormat(this.formato);
		recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
		recorder.setAudioChannels(qual); 				//1 mono - 2 stereo
		recorder.setAudioEncodingBitRate(8 * qual);   	//BIT
		if(qualita.charAt(13) == '4'){					//BIT RATE
		recorder.setAudioSamplingRate(44100);
		}else recorder.setAudioSamplingRate(96000);
	    rec=new File("mnt/sdcard/RegTooth/"+this.nome);
	    direc="mnt/sdcard/RegTooth/"+this.nome;
	    recorder.setOutputFile("mnt/sdcard/RegTooth/"+this.nome+path);
		try { 
			recorder.prepare();
		} catch (IOException e) {
			Log.e(LOG_TAG, "prepare() FALLITO");

5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:prepare, setAudioChannels, setAudioEncoder, setAudioSamplingRate, setAudioSource
			return; 
		} 
		 
		Log.i(TAG, "Start voice recording.");
         
		mediaRecorder = new MediaRecorder();
        mediaRecorder.setAudioSource(MediaRecorder.AudioSource.VOICE_RECOGNITION);
        mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
        mediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);
        mediaRecorder.setOutputFile(SAVE_DIR + "record" + System.currentTimeMillis() + ".3gp");
        mediaRecorder.setAudioChannels(1);
        mediaRecorder.setAudioSamplingRate(22050);
        mediaRecorder.setMaxDuration(5000);
        mediaRecorder.setOnInfoListener(this);
        try { 
			mediaRecorder.prepare();
		} catch (IllegalStateException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();

4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:prepare, release, reset, setAudioChannels, setAudioEncoder
	private boolean initAudioRecorder() { 
		if (audioRecorder != null) {
			audioRecorder.reset();
			audioRecorder.release();
		} 
		audioRecorder = new MediaRecorder();
		audioRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
		audioRecorder.setOutputFormat(MediaRecorder.OutputFormat.RAW_AMR);
		final int mono = 1;
		audioRecorder.setAudioChannels(mono);
		audioRecorder.setAudioSamplingRate(8000);
		audioRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
		audioRecorder.setOutputFile(sender.getFileDescriptor());
 
		boolean ret = true;
		try { 
			audioRecorder.prepare();
			audioRecorder.start();
		} catch (Exception e) {
			releaseMediaRecorder(); 

3
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:prepare, setAudioChannels, setAudioEncoder, setAudioEncodingBitRate, setAudioSamplingRate
        this.deleteButton.setEnabled(playAndDelete);
    } 
 
    public void record(View v) {
        Log.d(TAG, "record");
        this.mediaRecorder = new MediaRecorder();
        this.mediaRecorder.setAudioChannels(1);
        this.mediaRecorder.setAudioSamplingRate(44100);
        this.mediaRecorder.setAudioEncodingBitRate(64000);
        this.mediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
        this.mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
        this.mediaRecorder.setOutputFile(this.file.getAbsolutePath());
        this.mediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
        try { 
            this.mediaRecorder.prepare();
            this.mediaRecorder.start();
 
            // update the buttons 
            this.setButtonsEnabled(false, true, false);
        } catch (IOException e) {
            Log.e(TAG, "Failed to record()", e);
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
setAudioChannels Method Overview
Sets the number of audio channels for recording.
See Code Examples for other Android MediaRecorder Methods: