IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
Switch Left & Right without re-encoding, Binary modify mp3 to switch left & right channels
ChuckBevitt
post Nov 13 2011, 19:44
Post #1





Group: Members
Posts: 1
Joined: 13-November 11
Member No.: 95137



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.
Go to the top of the page
+Quote Post
robert
post Nov 13 2011, 20:12
Post #2


LAME developer


Group: Developer
Posts: 783
Joined: 22-September 01
Member No.: 5



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.
Go to the top of the page
+Quote Post
saratoga
post Nov 14 2011, 02:31
Post #3





Group: Members
Posts: 4718
Joined: 2-September 02
Member No.: 3264



QUOTE (ChuckBevitt @ Nov 13 2011, 14:44) *
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.

QUOTE (ChuckBevitt @ Nov 13 2011, 14:44) *
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.
Go to the top of the page
+Quote Post
Aquares
post Jan 29 2012, 14:49
Post #4





Group: Members
Posts: 9
Joined: 5-April 09
Member No.: 68690



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?
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 21st April 2014 - 03:42