views:

150

answers:

2

Ok does anybody have any idea for good ways to accomplish the following: A user programs some drum loops in flash and is somehow able to download or save an mp3 of the loop.

I thought that the pattern could be composted on the server side. Then a link to the file is sent to the user.

I had thought there might be something like imageGD or imageMagick for sound out there?

Also, if it is possible for flash to generate something that the user could save on the fly? That would work too, but I am unaware of any such functionality in flash.

I suppose something could be done in processing, but I am totally unfamiliar with that.

Any ideas about how this sort of thing might be accomplished? It seems like an interesting concept, right?

Thanks

A: 

Check out this MP3 class.

I'm using it for a project that was deployed just today.

It can read MP3's, extract a part of them, and merge files, among other things, except it doesn't overlap sounds.

Provided you already have those sound pieces (drums, guitar, etc) and that you don't need overlapping, it seems this is what you're looking for.

Seb
+1  A: 

If you have control over your server environment, I suppose you could use ffmpeg to do the job.

In your PHP code:

exec(escapeshellcmd("/path/to/ffmpeg -i /path/to/audiofile1.mp3 -i /path/to/audiofile2.mp3 -itsoffset 10 -i /path/to/audiofile3.mp3 -itsoffset 20 -acodec mp3 /path/to/outputfile.mp3"),$output,$status);

Notice that -itsoffset is the offset in seconds you want the audio file to be placed in. So this is not ideal if you want very minute control over the timing, but I don't know if you need that.

Andrew
I wonder if a bunch of 1/32 second samples could be prepended before the sample to produce more finely grained sample control? That sounds "inelegant" though.
Trass Vasston
Agreed. I do not think this is an ideal solution, but it's the simplest option I could think of that PHP could utilize.
Andrew