MediaRecorder getMaxAmplitude - 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 getMaxAmplitude method.

This code example shows how to use the following methods:getMaxAmplitude
	@Kroll.getProperty 
	public int getSoundAmplitude() { 
		if (recorder != null) {
			try { 
				// Convert from 16-bit sample value to dBFS 
				return (int)(20.0 * Math.log10((double)recorder.getMaxAmplitude() / 32767.0));
			} catch (RuntimeException e) {
			} 
		} 
		 
		return 0; 
	} 
	 
	@Kroll.getProperty 
	public boolean getIsRecording() { 
		return recorder != null;
	} 
} 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getMaxAmplitude
    } 
     
    public int getMaxAmplitude() { 
        if (mState != RECORDING_STATE)
            return 0; 
        return mRecorder.getMaxAmplitude();
    } 
     
    public void restoreState(Bundle recorderState) {
        String samplePath = recorderState.getString(SAMPLE_PATH_KEY);
        if (samplePath == null)
            return; 
        int sampleLength = recorderState.getInt(SAMPLE_LENGTH_KEY, -1);
        if (sampleLength == -1)
            return; 
 
        File file = new File(samplePath);
        if (!file.exists())
            return; 
        if (mSampleFile != null
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getMaxAmplitude, release, stop
    		myhandler=h;
    	} 
    	 
    	int timePassed = 0;
    	public void run() { 
    		final int amplitude = recorder.getMaxAmplitude();
    		if(amplitude>thresh) 
    		{ 
    			 
    			final double time = timePassed*(samplingTime/1000.0);
    			final double height = 0.5*9.8*time*time;
    			handler.post(new Runnable() {
    				@Override 
    				public void run() { 
    					tv2.setText("Amp = "+amplitude+"\nTime = "+time+"\n" +
    							"Height = "+height);
    				} 
    			}); 
    			timer.cancel();
    			recorder.stop();

5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getMaxAmplitude
		mRecorder.start();
		 
	} 
	 
	public int getMaxAmplitude(){ 
		return mRecorder.getMaxAmplitude();
	} 
	 
	public void stopRecording () 
	{ 
		if(mRecorder != null){
			try{ 
				mRecorder.stop();
			}catch(Exception e){
				Log.e("AudioManager", e.toString());
			} 
			mRecorder.release();
			mRecorder = null;
		} 
         
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getMaxAmplitude
 
                   } 
 
	public int getMaxAmplitude() { 
 
		return recorder.getMaxAmplitude();
 
	} 
 
} 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getMaxAmplitude
    		myhandler=h;
    	} 
    	 
    	int i = 0;
    	public void run() { 
    		final int amplitude = recorder.getMaxAmplitude();
            Log.e("haha","MicInfoService amplitude: " + amplitude);
            handler.post(new Runnable() {
				@Override 
				public void run() { 
					tv.setText("Amplitude = "+amplitude);
				} 
			}); 
        } 
    } 
     
    int thresh = 10000;
    int samplingTime=250;
    public void setThresh(View v)
    { 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getMaxAmplitude
                int result = cAmplitude;
                cAmplitude = 0;
                return result;
            } else { 
                try { 
                    return mediaRecorder.getMaxAmplitude();
                } catch (IllegalStateException e) {
                    return 0; 
                } 
            } 
        } else { 
            return 0; 
        } 
    } 
 
    /** 
     *  
     * Prepares the recorder for recording, in case the recorder is not in the 
     * INITIALIZING state and the file path was not set the recorder is set to 
     * the ERROR state, which makes a reconstruction necessary. In case 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getMaxAmplitude
			Log.i("NoiseSensorService stopMicrophone", "Stopping the microphone");
		}   
	}     
 
	public double getBufferAmplitude() {   
		if (mRecorder != null)  return (mRecorder.getMaxAmplitude()/2700.0);  
		else  return 0;     
	}     
 
	public double getFinalAmplitude() {   
		double amp = getBufferAmplitude();  
		mEMA = EMA_FILTER * amp + (1.0 - EMA_FILTER) * mEMA;  
		return mEMA ;  
	}    
 
 
 
 
 
} 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getMaxAmplitude
			Log.i("NoiseSensorService stopMicrophone", "Stopping the microphone");
		}   
	}     
 
	public double getBufferAmplitude() {   
		if (mRecorder != null)  return (mRecorder.getMaxAmplitude()/2700.0);  
		else  return 0;     
	}     
 
	public double getFinalAmplitude() {   
		double amp = getBufferAmplitude();  
		mEMA = EMA_FILTER * amp + (1.0 - EMA_FILTER) * mEMA;  
		return mEMA ;  
	}    
 
 
 
 
 
} 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getMaxAmplitude
        } 
    } 
 
    public int getAmplitude() {					//getAmplitude method 
        if (recorder != null)					//check the mediarecorder object has been initialised			
            return  (recorder.getMaxAmplitude());		//return the maximum amplitude measured since the last call
        else 
            return 0; 
    } 
     
    private void updateBackground() {							 
    	float amplF = (float) getAmplitude();			//cast integer value for MaxAmplitude into floating point
    	int alpha = (int) (amplF / MAX_AMPLITUDE * MAX_RGB);	//calculate colour alpha value, cast value back to integer
    	 
	display.setBackgroundColor(Color.argb(alpha, 255, 000, 000));	//set linear layout background colour 
    	 
    } 
} 
4
CodeRank
Experience pair programming with AI  Get Codota for Java

Related MediaRecorder getMaxAmplitude Questions & Answers:

getMaxAmplitude Method Overview
Returns the maximum absolute amplitude that was sampled since the last call to this method.
See Code Examples for other Android MediaRecorder Methods: