MahdiDavoodi/Sievere

In some devices, audio processing has a problem - NowPlayingActivity

Closed this issue · 1 comments

Description

Something is for sure: All of those devices are running Android 10.

Fixed ✔️

Andrew Linc

Case 1:
If you want to access audio with java File or by its path, you should

grant permissions (READ_EXTERNAL_STORAGE)
add android:requestLegacyExternalStorage="true" to <application>
Now, Amplituda will process your file without errors.

Case 2:
If you don't want to use requestLegacyExternalStorage

update Amplituda version to 2.1.4 (implementation 'com.github.lincollincol:amplituda:2.1.4')
process audio as InputStream or ByteArray (example code below)

val audioStream = contentResolver.openInputStream(SiQueue.getTrackToPlay().uri)
val newWaveForm = amplituda.processAudio(audioStream)
    .get()
    .amplitudesAsList()
    .toIntArray()