4

I am looking for a way 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.

How might this sort of thing might be accomplished?

Trass Vasston
  • 661
  • 2
  • 6
  • 18

3 Answers3

2

Take a look at SoX.

SoX is a cross-platform (Windows, Linux, MacOS X, etc.) command line utility that can convert various formats of computer audio files in to other formats. It can also apply various effects to these sound files, and, as an added bonus, SoX can play and record audio files on most platforms.

Mohammad Salehe
  • 350
  • 1
  • 6
1

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 Ensley
  • 10,940
  • 15
  • 57
  • 72
  • 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 Mar 19 '09 at 01:32
  • 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 Ensley Mar 19 '09 at 02:04
0

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
  • 24,063
  • 5
  • 57
  • 82