Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
hube6416ypublic void writeToFile(byte[] array) {
try {
String path = "Your path.mp3";
File file = new File(path);
if (!file.exists()) {
file.createNewFile();
}
FileOutputStream stream = new FileOutputStream(path);
stream.write(array);
}
catch (FileNotFoundException e1) { e1.printStackTrace(); } } -
CptFox16166y@R1100 @hube Calling a file an MP3 doesn't make it one, that format is somewhat close to a WAVE file. But if you want no loss, writing your buffer directly into a file is the simplest way. To read it back, FileInputStream should do the job. Make sure your casts don't destroy your data. If your byte array isn't 8 times the length of your double array, you can be sure something isn't going the way you want
Hi devs!
I've seeked the world but found no answer to this:
I want an android code to convert double[] to a sound file and be able to get that double[] from the file.
And yes I've tried stdAudio library but it did not work as I expected.
Give a replay, save my life 😁
question