Concatenate mp3

(hello.mp3) + (hi.mp3) ===> welcome.mp3
length: 3 + length: 5 =====> length: 8

I want to concatenate hello.mp3 file and hi.mp3 file into one file to make welcome.mp3 file.
Is there a way to AS3?
Is there a related library?
I have to solve this.

Extracting each ByteArray and combining them into one doesn’t seem to work.
What should I do?
Who has experienced such a project?


you ask a lot of questions but you don’t say what you have researched or tried

you also don’t provide context of where you try to do that?
is it an AIR app? mobile? desktop?

maybe show some source code ?

from a quick google search, it should be possible to just combine the raw data of the 2 files, so yeah using ByteArray should work

see for ex C# : concatenate 2 MP3 files

see also MP3 Frame headers

in general yeah you should take into account the different bitrate, the mp3 headers etc.
but as a quick job, slaming the two files into one bytearray should work (with maybe a little glicth this and there)

otherwise you can try a library, for ex as3-mp3-decoder (but seems old/unsupported?), based out of JLayer MP3 Library, and adapt some code to do what you need

other ref that might help

I would say, something like as3-mp3-decoder can give you a good starting point to do it in AS3, even if it does not do everything or there are bugs, and the other libraries/references can help to add the functionalities you need, or at worse you can reuse some of the C libraries and build an ANE

It depends of what you are trying to do and which kind of results you want
if you need a quick dirty job, merging bytearray should do
if you need pro quality output for a software that will manipulate a lot of audio, writing your own AS3 lib or an ANE seems the way to go

1 Like