Overview
When recording audio, it can be useful to split streams from one another. For example, if you are in a call with someone, you might want to have a recording of your voice and another recording of the other side. This is similar to stereo recording, but is more accurately referred to as interleaved audio. It separates the received audio from the transmitted audio. Interleaved audio was added to chan_spy a while back, and it has now found its way into MixMonitor!
How To Use It
Enabling stereo recording is easy. Just add the ‘D’ option to your MixMonitor Dialplan function:
exten => 123,1,MixMonitor(my_recording.raw,D)
Note that the file extension of the recording is .raw here. This is recommended so that audio editing software can read the two streams separately. For example, if you were to record with the ‘D’ option and produce both a .wav and a .raw file, software like Audacity would not recognize the .wav file as having multiple streams.
The option ‘D’ was used to match chan_spy. There are no extra arguments that need to be passed in. It does work with other options like ‘t’ and ‘r’, so you’re still able to produce those files if you need to.
How Does it Work?
Interleaving the audio sounds like it might be tricky, but it’s not as bad as it sounds. When MixMonitor is running, the frames are processed in the main MixMonitor thread. The read and write frames are processed, and that’s where the ‘t’ and ‘r’ frames are written out to their designated files. These frames can be written to the stereo file at the same time.
How are the frames written, though? A new structure needs to be created that puts a read frame in first and then a write frame and continues to alternate until all frames are processed. If a read frame is present but a write frame is not, then silence can be injected to fill the gap (and vice versa). There must be a write frame for every read frame. Once all of the frames have been arranged, they are written out to the recording.
Use Cases
There are many reasons why you might want to have interleaved audio. It gives the user a large amount of control over the recorded audio. Having two tracks means that volume can be adjusted individually, extra noise can be chopped, and effects can be applied to one side, among other things. We’re excited to see how you use stereo recording with MixMonitor!
The post Stereo Recording in MixMonitor appeared first on Asterisk.
No Comment! Be the first one.