pitchup

Android wear guitar tuner

View on GitHub

Awesome Kotlin Badge Hex.pm Platform Travis-ci

Get it on Google Play

PitchUp

PitchUp is an open source project that provides a tuner for instruments(for now only guitars) based on pitch using the smartphone or smartwatch microphone. The aim of the project is to get people to contribute towards the core development of the library adding new instruments and improving the algoritm to detect tunes.

The project consists of 4 main components:

PitchUp Core </h2>

How to include the library in your project:

compile 'com.lbbento.pitchup:core:1.0.0'

Usage:

//Create a new PitchHandler object
val pitchHandler = PitchHandler(InstrumentType.GUITAR)

//Call handle pitch to obtain a musical note from a given pitch
val pitchResult = pitchHandler.handlePitch(somePitchFloatValue)

//Do something with the value returned
doSomethingWithResult(pitchResult)

PitchUp Android Tuner </h2>

How to include the library in your project:

compile 'com.lbbento.pitchup:tuner:1.0.0'

Usage:

The android module provides a listener that can be used as bellow:

//Create audio recorder
val audioRecorder = PitchAudioRecorder(AudioRecord(MediaRecorder.AudioSource.DEFAULT,
        44100,
        AudioFormat.CHANNEL_IN_DEFAULT,
        AudioFormat.ENCODING_PCM_16BIT,
        AudioRecord.getMinBufferSize(44100, AudioFormat.CHANNEL_IN_DEFAULT, AudioFormat.ENCODING_PCM_16BIT)))


//Create listener
val guitarTunerListener = object: GuitarTunerListener {

    override fun onNoteReceived(tunerResult: TunerResult) {
        doSomethingWithResult(tunerResult)
    }

    override fun onError(e: Throwable) {
        showError(e)
    }
}

//Start listening to Guitar tuner
val guitarTuner = GuitarTuner(audioRecorder, guitarTunerListener)
guitarTuner.start()

//Stop listening
guitarTuner.stop()

If you prefer, you can also use the Rx interface:


//Create audio recorder
val audioRecorder = PitchAudioRecorder(AudioRecord(MediaRecorder.AudioSource.DEFAULT,
    44100,
    AudioFormat.CHANNEL_IN_DEFAULT,
    AudioFormat.ENCODING_PCM_16BIT,
    AudioRecord.getMinBufferSize(44100, AudioFormat.CHANNEL_IN_DEFAULT, AudioFormat.ENCODING_PCM_16BIT)))

//Guitar tuner reactive interface - RxJava
val guitarTunerReactive = GuitarTunerReactive(audioRecorder)

//Subscribe to start listening for notes
guitarTunerReactive.listenToNotes()
    .subscribeOn(appSchedulers.io())
    .observeOn(appSchedulers.ui())
    .subscribe(
        { tunerResult -> doSomethingWithResult(tunerResult) },
        { e -> showError(e) }
    )
    

The tuner result contains the following information:

Property Type Definition
note String A, A#, B etc.
tuningStatus TuningStatus DEFAULT(silence or out of range) - TUNED - TOO_LOW - TOO_HIGH, etc.
expectedFrequency Double The expected frequency for the closer note given the pitch.
diffFrequency Double Difference from the pitch given to the expected frequency.
diffCents Double Difference in cents from the current frequency to the expected frequency.

Contributing

Please, drop me an email if you have any suggestions, problems or feedback. Feel free to submit a pull request if you improved the library and want to share it.

Privacy Policy

This page informs you of our policies regarding the collection, use and disclosure of Personal Information when you use our Service.

PitchUp don’t store or share any kind of information when tuning an instrument. No data is saved or shared through any means.

Contact Us

If you have any questions about this Privacy Policy, please contact me at lucasbento7[at]gmail.com