All Projects → junyuecao → AndroidSoundTouch

junyuecao / AndroidSoundTouch

Licence: LGPL-3.0 license
A SoundTouch java wrapper library for Android

Programming Languages

C++
36643 projects - #6 most used programming language
java
68154 projects - #9 most used programming language
kotlin
9241 projects
Makefile
30231 projects
c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to AndroidSoundTouch

SoundTouch-NodeJS
Bose SoundTouch Node JS API
Stars: ✭ 33 (+22.22%)
Mutual labels:  soundtouch
libsoundtouch
Bose Soundtouch Python library
Stars: ✭ 87 (+222.22%)
Mutual labels:  soundtouch
php-bpm-detect
php class for bpm detection
Stars: ✭ 22 (-18.52%)
Mutual labels:  soundtouch
soundy
Simple GTK client to control your Bose SoundTouch speaker
Stars: ✭ 12 (-55.56%)
Mutual labels:  soundtouch

AndroidSoundTouch

Build Status

A handy SoundTouch java wrapper library for Android

This repo is a java wrapper of SoundTouch for Android.

  • Keep APIs of soundtouch and provide a Java class to process audio streams so you can do it without any C/C++ code.
  • Support ENCODING_PCM_16BIT samples.
  • Support mono(1)/stereo(2) channels.
  • Support short/byte array input/output

Demo

Demo apk download link

Note: You should grant audio record permission manually before using.

Usage

Gradle:

repositories {
    jcenter()
}

// For gradle plugin 2.x
dependencies {
    compile 'io.github.junyuecao:soundtouch:1.0.1'
}

// For gradle plugin 3.x
dependencies {
    implementation 'io.github.junyuecao:soundtouch:1.0.1'
}

The APIs are almost the same with the C/C++ version.

  • in Java
public void onVoiceStart() {
    mSoundTouch = new SoundTouch();
    mSoundTouch.setChannels(1);
    mSoundTouch.setSampleRate(VoiceRecorder.SAMPLE_RATE);
}

public void onVoice(byte[] data, int size) {
    mSoundTouch.setRate(mRate);
    mSoundTouch.setPitch(mPitch);
    mSoundTouch.putSamples(data, size);
    int bufferSize = 0
    do {
        bufferSize = mSoundTouch.receiveSamples(mTempBuffer, BUFFER_SIZE);
        if (bufferSize > 0) {
            mTestWavOutput.write(mTempBuffer, 0, bufferSize);
        }
    } while (bufferSize != 0);

}

public void onVoiceEnd() {
    mSoundTouch.release();
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].