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: Switch Left & Right without re-encoding (Read 5228 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Switch Left & Right without re-encoding

I need to be able to switch the left and right channels in mp3 files. I'd like to do this in a lossless manner by writting a little applet to binary modify the mp3 file and simply swap whatever left and right identifiers exist in the file. I would rather not have to import the mp3 file into something like Audacity and then reencode it after swaping the channels.

I am a computer programmer; however, I write business applicaiton in .Net and I'm not familiar with the mp3 file format. What I'm looking for is enough information on the mp3 file format to, at a binary level, to identify and modify the left and right channel data. Or maybe just some links to information on the mp3 file format at the level I'd need to do this.

Appreciate all help.
Chuck Bevitt


PS: If anyone's curious, the reason why I need to do this is that I recently started learning to sing and I'm a member of a chapter chrous of the Barbershop Harmony Society. To help us learn our music, we have learning tracks provided as mp3s. These will have a performance of the song with three of the four voice parts (tenor, lead, baritone, & bass) combined in one channel with the fourth part alone on the other channel. Four learning tracks are available for each song, one to isolate each of the four voices. When learning a song, the singer first listens to his part alone, then begins moving the balance control to blend in the other voices, finally moving the balance control to sing with only the other three parts.

The problem is that there is no standardization as to which channed gets the solo part and which channel gets the other three parts. Sometimes I like to load several parts on a USB stick and play it on my car radio with the radio balance set to the solo part (I live in Los Angeles, so I have plenty of time for this!) Unfortunately, this doesn't work well unless my part is on the same channel on all the songs (accessing the car radio balance control while driving is not practical - i'ts buried in the digital menus). So a little applet to just swap left & right will be very handy.

Switch Left & Right without re-encoding

Reply #1
FWIW, LAME 3.99 has some new switch "--swap-channel" which allows you to swap left and right channel while encoding. Though you would have to re-encode your MP3s, there is no need to open them in Audacity to just switch the channels.

Switch Left & Right without re-encoding

Reply #2
I need to be able to switch the left and right channels in mp3 files. I'd like to do this in a lossless manner by writting a little applet to binary modify the mp3 file and simply swap whatever left and right identifiers exist in the file.


Skimming libmad, I think you could go through the bitstream parsing and huffman decode, then when you get to the stereo decoding stage, flip the samples and reencode the stereo flipped.  I think this could all be lossless, or at least have just some tiny rounding error.  There may be some easier way, I'm not too familiar with the MP3 bitstream syntax.

Or maybe just some links to information on the mp3 file format at the level I'd need to do this.


Overview:

http://www.mp3-tech.org/programmer/docs/mp3_theory.pdf

Also:

http://svn.rockbox.org/viewvc.cgi/trunk/ap...amp;view=markup

specifically the "III_decode" function where huffman decoding and stereo decoding happen.

 

Switch Left & Right without re-encoding

Reply #3
I'm looking for a software to losslessly switch channels in an MP3.

@ChuckBevitt: Have you managed to develop a tool to do that and if so, could you post it here please?