How to merge / concatenate mp3s with PHP


One of the new features of my anti-spam plugin is the ability to create auto-generated mp3 files. The plugin concatenates individual mp3 files representing the sound of each letter in the alphabet, in order to build a word.

Of course, I have no idea how to code something that merges mp3 files, so I had to do some searching and eventually found this site with some working code:

Here is my modified version, with some simplified functionality (I removed the code that added ID3 tags) and an added feature that I modified from FPDF (a script that creates PDFs in PHP) in order to output (to the browser) the merged mp3 file, prompting users to open or save it. This code is compatible with both PHP 4 and PHP 5.

Here’s how I used the class to generate an mp3 file from individual files (in a “sounds” folder) representing each letter. You can, of course, use the above code to concatenate mp3 files for any purpose.

Note: if you need some support using any of the code, I suggest that you visit the original source of the mp3 concatenation code.

10 ماه پیش

دیدگاهتان را بنویسید

نشانی ایمیل شما منتشر نخواهد شد. بخش‌های موردنیاز علامت‌گذاری شده‌اند *

این سایت از اکیسمت برای کاهش هرزنامه استفاده می کند. بیاموزید که چگونه اطلاعات دیدگاه های شما پردازش می‌شوند.