0
I’m writing an app where I have a list of byte[]
and need to create files .mp3
from these byte vectors. When prompted, the app zips all these files into one file .zip
, but later the player is not able to play any of these audios. The byte[]
originates from a openStream()
, where it is transformed into a byte array so that the app can have all audios "in memory", so that only then all are transformed into a file.
Creates archive
private File createFile(String name, byte[] data) {
try {
FileOutputStream out = getContext().openFileOutput(name, Context.MODE_PRIVATE);
out.write(data);
out.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return getContext().getFileStreamPath(name);
}
You’d have to write a header
to the archive? If yes, how?
https://stackoverflow.com/questions/22319372/to-convert-byte-array-to-mp3-file
I had a notion that an mp3 file was something complex, but not that complex. It left me interested in researching about. About the app: I’m considering changing the format to wav
– Ivan Silva