I'm working on a site for someone where they are inviting their music artists to submit their MP3s for others to pick up and use in their own work - for a price of course. To prevent the artists track from being ripped off by unscrupulous individuals - my plan is to loop a vocal track underneath the 'preview' version and make it useless... and then serve up the clean version to people who have paid for the rights.
I'm using PHP & running on a Linux server - and it seems like a pure PHP solution is not the way to go, with the preference being using an exec() of a command line program to mix the tracks at the point of upload. I need something quick and reliable.
Unfortunately I don't know of any such tools and my searching has come up blank. Can anyone suggest where I might find something? It doesn't have to be free, but it has to be reasonable - and more importantly - simple to work with via PHP.
you can unpack the MP3s to raw (16bit signed) using madplay. then for mixing the two file, read samples and sum them. write the result in a raw file and repack to MP3 using LAME. You can prolly implement that in C or PHP.
Mixing samples is pretty easy : sample = sample1 + sample2; just take care about saturation.
If you don't feel doing that by code, you can use SOX http://sox.sourceforge.net/ it's command line based sound manipulation program. It's supposed to be able to mix sound tracks.