# Using L+R and L-R encoding via AC3, a case study # Copyright Jan Panteltje 2005 all rights reserved, # Microsoft is prohibited from using any of these ideas. # The AC3 version # Here is the test script: if [ "$1" = "" ] then echo "Usage mono_stereo_test cd_track_number": exit 1; fi # RIP cdparanoia "$1" # ENCODE sox cdda.wav -c 1 -v .5 l.wav avg -l sox cdda.wav -c 1 -v .5 r.wav avg -r substract_wave -m l.wav -s r.wav -f 100 > l-r.wav substract_wave -m l.wav -s r.wav -f 100 -r > l+r.wav ffmpeg -i l-r.wav -ab 32 -ac 1 -acodec ac3 l-r.ac3 ffmpeg -i l+r.wav -ab 32 -ac 1 -acodec ac3 l+r.ac3 # So we send l+r.ac3 as mono over the first link. # And we can optionally use l-r.ac3 to add the stereo information via a second link. # DECODE a52dec -o wav l+r.ac3 > sum.wav a52dec -o wav l-r.ac3 > diff.wav # a52 dec does not want to make mono out? sox diff.wav -c 1 diff_mono.wav avg -l sox sum.wav -c 1 sum_mono.wav avg -l substract_wave -m sum_mono.wav -s diff_mono.wav -f 100 > dec-r.wav substract_wave -m sum_mono.wav -s diff_mono.wav -f 100 -r > dec-l.wav multimux dec-l.wav dec-r.wav -o result-ac3.wav # PLAY play result-ac3.wav exit 0 # software # multimux: # http://panteltje.com/panteltje/dvd/multimux-0.2.3.tgz # substract_wave: # http://panteltje.com/panteltje/dvd/substract_wave-0.2.tgz # I can hear some distortion at this low bitrate, stereo image seems sort of OK, but sound is bad though. # Copyright Jan Panteltje 2005.