Question

I am interested in finding out if there exists a program or library which can perform the following task, and would be suitable for running as part of a server side process on a web site. (It's okay if it takes longer than the 200 milisecond maximum that is reasonable for a single page request - I can run it as an asynchronous process.)

The task is this: I have as input a set of audio files, and I have some data about when each audio file should start playing in a timeline. The program should output an audio file which is a mix of the input audio, combined using the timeline data. That is, I want an audio mixer that operates in batch mode, and not in real time.

I've done some Google searches, but came up a bit frustrated because I'm not exactly sure what I should be looking for. Most audio mixers seem geared towards real time applications like games, and I'm not sure how to find something that does this task as something like a command line utility - purely taking input, and producing output as fast as it can.

I hope this question makes sense.

Edit: Someone commented about Csound, and then deleted it. What is Csound? Is it relatively straightforward to do what I'm asking? Keep in mind that my input sound files may be between 10-50 seconds long, and I'm not interested in pitch distortion.

How would you accomplish this in Csound?

Is there anything other than Csound that can do this sort of thing?

Was it helpful?

Solution

You can definitely use Csound for this, and it could be implemented a number of ways. Unfortunately, my still fairly nascent study of Csound has been more involved with audio synthesis and algorithmic composition than sampling and processing, so I can't offer suggestions for a robust implementation.

However, I would guess that your project's orchestra file (the part of a Csound program that contains audio synthesis and processing information, contained in modules called instruments) would involve the soundin opcode, which reads from an audio file, and then it would scale the amplitude of various streams and mix them before passing to output.

The timeline would probably be handled in the score file (the part of a Csound program that handles initialization of instruments and function tables), which would translate your timeline data into playback timing.

You might also look up Csound's GEN01 subroutine, which reads audio data from a file into a function table.

OTHER TIPS

If you are willing to consider running batch scripts as part of this process, you might find SoX useful. Its "mixer" and "remix" commands look like they might be helpful, although you would possibly need to render empty space at the start of sound files to handle offsets.

You should have a look at SuperCollider. Maybe that would do the trick for you.

Something like PHP's OpenAL bindings?

You might look at the BASS Audio Library. I'm unable to see if it can mix faster-than-real-time, as it's blocked at the firewall, but I've found it friendly to use in the past.

You are probably getting a lot of suggestions towards real-time audio solutions because of the way you have phrased your question:

The program should output an audio file which is a mix of the input audio, combined using the timeline data.

"Input audio" is very vague. To me it sounds like a live input stream (like a microphone). If you are not dealing with live I/O streams at all, then yes, Csound would be a likely candidate. There are plenty of Csound tutorials online.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top