I need to be able trim wav audio files for an application I'm building.. but I have several problems. I tried using FFmpeg-android, but if you target the latest SDK, and in the future, android no longer allows using "FFmpeg.execute". I also tried with the newer mobile-FFmpeg, but the developer stopped maintaining it a few months ago... I also would like to avoid heavy frameworks to also work with video, since I only need to work with audio. I can't find answers anywhere, what am I supposed to do?
Asked
Active
Viewed 723 times
0
-
When you say "trim" are you referring to trimming the volume (changing the volume) or to changing the size/length of the audio resources? – Phil Freihofner Apr 25 '21 at 20:06
-
I mean cutting, changing the length of an audio track – Andrea Zaffanella Apr 26 '21 at 17:09
1 Answers
1
You can use AudioTrack to write PCM.
I don't know how one translates input files into PCM data. But once it is in that form, you can edit it to suit your needs and then use AudioTrack
to play back the result.
Maybe the MediaExtractor.readSampleData method can be used to read the audio data into an array where you can get to it and do your trimming. I've not done enough with Android to know if this is a viable plan or not.

Phil Freihofner
- 7,645
- 1
- 20
- 41