newventuresoftware / WaveformControl

Android Waveform control
236 stars 67 forks source link

how to incorperate the waveform view into an app #13

Open mgood7123 opened 5 years ago

mgood7123 commented 5 years ago

how would I go about incorporating your waveform view into my audio player application?

mgood7123 commented 5 years ago

as when I render audio the audio is cropped even though the same file rendered in your app is full length, and both use the same settings and the same audio file

mgood7123 commented 5 years ago

apparently it is an issue with how my samples are obtained, as both play exactly the same yet

    val samples1 = audioSample
    val samples2 = media.samples

samples1 = {short[192000]@11138} samples2 = {short[96001]@11139}

with a 48khz stereo 1.818 ms raw audio sample FUNKY_HOUSE.zip

mgood7123 commented 5 years ago

why do i need to give double the sample size for it to render correctly?

        val a = mutableListOf<Short>()
        // this WILL read incur a buffer overrun by twice its size
        // | [] [] [] [] | -> | [] [] [] [] | [] [] [] [] |
        // |    DATA     | -> |    DATA     | RANDOM DATA |
        // a.size == Oboe_SampleCount()*2
        for (i in 0 until ((Oboe_SampleCount()*2)-1)) a.add(Oboe_SampleIndex(i))
        wave.samples = a.toTypedArray().toShortArray()