GithubHelp home page GithubHelp logo

nieldeokar / whatsappaudiorecorder Goto Github PK

View Code? Open in Web Editor NEW
22.0 22.0 7.0 623 KB

Simple audio recorder using Android's AudioRecorder with .aac File extention.

Kotlin 17.36% Java 82.64%
android audio-player audio-recorder java

whatsappaudiorecorder's Issues

Amplitude

Hello Nieldeokar,
Can you tell me how to calculate amplitude from your code ? I have added this code , I am getting Amplitude but not more than 55 in any case
private boolean handleCodecInput(AudioRecord audioRecord,
MediaCodec mediaCodec, ByteBuffer[] codecInputBuffers,
boolean running) throws IOException {
byte[] audioRecordData = new byte[bufferSize];
int length = audioRecord.read(audioRecordData, 0, audioRecordData.length);
computedbAmp(audioRecordData); ///this is amplitude code
if (length == AudioRecord.ERROR_BAD_VALUE ||
length == AudioRecord.ERROR_INVALID_OPERATION ||
length != bufferSize) {

        if (length != bufferSize) {
            if (onRecorderFailedListener != null) {
                Log.d(TAG, "length != BufferSize calling onRecordFailed");
                onRecorderFailedListener.onRecorderFailed();
            }
            return false;
        }
    }

//code
//compute here
public double computedbAmp(byte[] audioData) {
//System.out.println("::::: audioData :::::"+audioData);
double amplitude = 0;
double sum=0;
for (int i = 0; i < audioData.length/2; i++) {
double y = (audioData[i2] | audioData[i2+1] << 8);
sum += yy;
}
double rms = sum / audioData.length/2;
amplitude = 20.0
Math.log10(rms/32768.0);

    return amplitude;

}

Api 16 compatibility

I would like to integrate the library in my application with a minSdkVersion 16, some tips or recommendations ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.