Usages of

android.media.audiofx.NoiseSuppressor.create(?)
public static void enableNS(int sessionId) { if (NoiseSuppressor.isAvailable()) { NoiseSuppressor ns = NoiseSuppressor.create(sessionId); if (ns != null) ns.setEnabled(true); } }
public void enableNoiseSuppressor() { if (NoiseSuppressor.isAvailable() && noiseSuppressor == null) { noiseSuppressor = NoiseSuppressor.create(microphoneId); noiseSuppressor.setEnabled(true); Log.i(TAG, "NoiseSuppressor enabled"); } else { Log.e(TAG, "This device don't support NoiseSuppressor"); } }
/** * ��������������������� * @param enable */ private void setNoiseSuppressor(boolean enable){ if (mNoiseSuppressor == null){ mNoiseSuppressor = NoiseSuppressor.create(mMediaPlayer.getAudioSessionId()); mNoiseSuppressor.setEnabled(enable); } }
@Override public void run() { minBufferSize = AudioRecord.getMinBufferSize(SAMPLE_RATE, CHANNEL, FORMAT); AudioRecord record = new AudioRecord(AUDIO_SOURCE, SAMPLE_RATE, CHANNEL, FORMAT, minBufferSize); if(NoiseSuppressor.isAvailable()) { NoiseSuppressor.create(record.getAudioSessionId()); } //System.out.println(NoiseSuppressor.isAvailable()); record.startRecording(); writeToFile(minBufferSize, record); }
//Test case 1.1: test NS creation and release public void test1_1NsCreateAndRelease() throws Exception { AudioRecord ar = getAudioRecord(); assertNotNull("could not create AudioRecord", ar); boolean isAvailable = NoiseSuppressor.isAvailable(); NoiseSuppressor ns = NoiseSuppressor.create(ar.getAudioSessionId()); assertTrue("NS not available but created or available and not created", isAvailable == (ns != null)); if (ns != null) { ns.release(); } ar.release(); }
/** * Initialize the audiorecord instance, AcousticEchoCanceler instance, AudioTrack instance and noise suppressor instance * respectively. */ private void initRecordAndTrack() { int min = AudioRecord.getMinBufferSize(8000, AudioFormat.CHANNEL_IN_MONO, AudioFormat.ENCODING_PCM_16BIT); record = new AudioRecord(MediaRecorder.AudioSource.VOICE_COMMUNICATION, 8000, AudioFormat.CHANNEL_IN_MONO, AudioFormat.ENCODING_PCM_16BIT, min); ns = NoiseSuppressor.create(record.getAudioSessionId()); if (AcousticEchoCanceler.isAvailable()) { AcousticEchoCanceler echoCancler = AcousticEchoCanceler.create(record.getAudioSessionId()); echoCancler.setEnabled(true); } int maxJitter = AudioTrack.getMinBufferSize(8000, AudioFormat.CHANNEL_OUT_MONO, AudioFormat.ENCODING_PCM_16BIT); track = new AudioTrack(AudioManager.MODE_IN_COMMUNICATION, 8000, AudioFormat.CHANNEL_OUT_MONO, AudioFormat.ENCODING_PCM_16BIT, maxJitter, AudioTrack.MODE_STREAM); }
@SuppressLint("NewApi") public void enableNoiseSuppressor() { if (!NoiseSuppressor.isAvailable()) { Log.e("AudioProcessor", "NoiseSuppressor is not supported in this device!"); } else { NoiseSuppressor noiseSuppressor = NoiseSuppressor.create(mAudioRecorder.getAudioSessionId()); if (!noiseSuppressor.getEnabled()) { noiseSuppressor.setEnabled(true); Log.i(LOG_TAG, "NoiseSuppressor is enabled!"); } else { Log.i(LOG_TAG, "NoiseSupporessor is already enabled!"); } } }
/** * �������� * @param ar */ public static void aec(AudioRecord ar) { if (AcousticEchoCanceler.isAvailable()) { AcousticEchoCanceler aec = AcousticEchoCanceler.create(ar.getAudioSessionId()); if (aec != null && !aec.getEnabled()) { aec.setEnabled(true); } } if (NoiseSuppressor.isAvailable()) { NoiseSuppressor noise = NoiseSuppressor.create(ar.getAudioSessionId()); if (noise != null && !noise.getEnabled()) { noise.setEnabled(true); } } }
public void turnOffAllEffects (AudioRecord recorder) { if (recorder == null) { Log.e(TAG, "Recorder not initialized"); return; } int rid = recorder.getAudioSessionId(); AutomaticGainControl.create(rid).setEnabled(false); AcousticEchoCanceler.create(rid).setEnabled(false); //new BassBoost(1000, rid).setEnabled(false);//BassBoost.create? //new EnvironmentalReverb(1000, rid).setEnabled(false);//EnvironmentalReverb? //new Equalizer(1000, rid).setEnabled(false); //new LoudnessEnhancer(rid).setEnabled(false); NoiseSuppressor.create(rid).setEnabled(false); }
@TargetApi(Build.VERSION_CODES.JELLY_BEAN) public static void aec(AudioRecord ar) { if (AcousticEchoCanceler.isAvailable()) { AcousticEchoCanceler aec = AcousticEchoCanceler.create(ar.getAudioSessionId()); if (aec != null && !aec.getEnabled()) { aec.setEnabled(true); } } if (NoiseSuppressor.isAvailable()) { NoiseSuppressor noise = NoiseSuppressor.create(ar.getAudioSessionId()); if (noise != null && !noise.getEnabled()) { noise.setEnabled(true); } } }
Usage snippet has been bookmarked! Review your bookmarks
Thank you! Review your likes