Upsampling wav file for Android Devices (Bluetooth LE)

405 views Asked by At

I have been trying for about a week now to get an extremely difficult concept completed for a project. I am attempting to use the 19 bytes BLE allows to transfer raw PCM data through Bluetooth LE to all other Android devices in the vicinity.

I used Audacity to reduce a FLAC format song into a mono, 2000Hz sample rate, 8-bit unsigned WAV file, which still sounds semi-decent. The problem is that the BLE loads the data through to nearby devices at a rate half of what is needed to stream the file on the other side (part of my plan is to have the song streamed live on each device).

My plan is to send the data to the other device, upsample the 2000Hz audio data into 4000Hz audio data; This is the lowest sample rate supported by AudioTrack that I know of. In regular Java I could use the Tritonus packages to change the sample rate up to the necessary Hz level, but I can't get the package to load in Android (I'm using Android Studio).

Basically I am asking, is there a known package or algorithm that can upsample raw music data that is Android-compatible? I am digging through the Tritonus page for code snippets that might help me along the way. I am getting very little sleep... all programming and no play makes omikey a dull boy...

2

There are 2 answers

0
zave On BEST ANSWER

Maybe you should look into 7zip. It has the best compression rate and runs at a decent speed.

0
omikes On

I ended up adding some of the Tritonus files I mentioned before, but they required a java package not included with Android. This is a bit hacky, but I just ended up taking the code from the original java packages I needed and included them in my library files. Now it works! Well... the sound quality is still abysmal, but the sample rate conversion works quickly.