Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Multiple audio channel sources multiplexing in single audio channel si (Read 9046 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Multiple audio channel sources multiplexing in single audio channel si

Hello,

I am a newbie to audio channel multiplexing.  I would like to learn how multiple channel sources are multiplexed in sone audio channel.  The digital signal processing part should be interesting.  Could anyone give me pointers on where and how to start testing audio channel multiplexing using C or similar code. 
Thank you.

Regards,

Tapan.

Multiple audio channel sources multiplexing in single audio channel si

Reply #1
I don't quite understand your question...

Multiplexing  usually means interleaving the audio & video files into a single file.

Are you talking about Dolby Surround?  Like on a VHS tape?  That requires 2-channels, and that's actually called "matrixed".    The concept is fairly simple, involving out-of-phase left & right signals that are subtracted to extract the difference signal.

I'd like to make sure I understand what you're trying to do before I go-off in the wrong direction.

Multiple audio channel sources multiplexing in single audio channel si

Reply #2
I don't quite understand your question...

Multiplexing  usually means interleaving the audio & video files into a single file.

Are you talking about Dolby Surround?  Like on a VHS tape?  That requires 2-channels, and that's actually called "matrixed".    The concept is fairly simple, involving out-of-phase left & right signals that are subtracted to extract the difference signal.

I'd like to make sure I understand what you're trying to do before I go-off in the wrong direction.


Thank you for the response.  I am working on an application where simple audio source channels are to be multiplexed (simple summing node), where for e.g. 2 audio sources can be summed to transmit over one channel.  I have not come across a simple C code where I could get started with customizing according to my requirements.  So all I would probably need is a comment or suggestion on how to perform an analog sum of two audio channels so that it could be transmitted over one channel using C/C++ code.

Multiple audio channel sources multiplexing in single audio channel si

Reply #3
Hmmmm...  The "left channel" on a CD cannot contain more than one channel of data, and you simply cannot save stereo data in a mono WAV file.  Again, there are "tricks" for surround encoding if you use both the left & right channels. 

Quote
I am working on an application where simple audio source channels are to be multiplexed (simple summing node), where for e.g. 2 audio sources can be summed to transmit over one channel.
  When you sum 2 channels, the result is simply mono.  You can recover the stereo only if you also create a difference channel.  This  means you still need 2 channels to store/transmit the stereo signal! (See the FM radio example below.)

It's possible to send several analog channels over a single wire with time division multiplexing.  The telephone companies used to do that (I think it's all digital now).  This has never been used in Hi-Fi or home audio/video, and I dont think it relates to whatever you are trying to do.

It's also possible (and very common) for a single file or a single digital stream to contain multiple channels...

In a WAV file, the left & right channels are alternated.  For example, if you've got a 16-bit file, the first two bytes (following the header) are the left channel, and the next two bytes are the right, then two left-bytes. etc...  Multi-channel files are the same, with a longer repeated sequence.  There are links to the WAV spec at wotsit.org.  I think an uncompressed PCM stream over a S/PDIF connection uses the same method, but I've never studied the S/PDIF spec. 

A multiplexed A/V file (or stream) uses a similar concept (but more than one or two bytes at a time).  On a DVD, the VOB file (MPEG-2 formatted) can have a short bit of video data, a short bit of English audio, a short bit of French audio, a short bit of subtitle, etc... repeat...    You can find programs to "demux" the audio & video into separate streams and programs to "mux" the audio & video together.  In this case, any multichannel audio is pre-encoded before multiplexing (so you're not multiplexing the channels).  So, you might have one video file, one surround-sound AC3 file, and one stereo AC3 file before multiplexing these together into one MPEG-2 file.

FM stereo uses something called "multiplexing" too.  In this case, two separate channels are still broadcast.  The left & right are summed and broadcast "normally" to be received by a mono radio/receiver.  The channels are also subtracted and the L-R channel is broadcast over a "carrier signal".  A stereo receiver does the addition/subtraction to reconstruct the left & right channels.  (The addition & subtraction can easily be done with analog circuits.)

MP3 and other compressed formats also (optionally) convert the Left & Right into sum & difference channels (for different reasons).  In this case, it's called "joint stereo" instead of multiplexing.  Again, you must save two channels (sum & difference) to reconstruct stereo.

Quote
...using C/C++ code.
  I don't know where to find exactly what you're looking for, but you should probably start with a DSP book.  I have a book called   Digital Audio Processing by Doug Coulter[/u].  It's a good introductory book.  There is a really good FREE online DSP book at DSPguru.com.  And, here is HydrogenAudio's list of books.

You can also find plenty of open source code to study at SourceForge.net[/u], and there is also a ton of sample code at MSDN.

This stuff is NOT EASY!  If you're a beginning programmer it might take you a week to learn how to open a WAV file, change the volume and re-save.  Half the battle.... or more than half the battle, is finding the information or sample code.  I don't know of any books or websites for "beginning audio programming". 

BTW - I'm not an expert, so I don't know the answers either.  I've been a "beginning programmer" for many years!  And , I've done very little audio programming.