|
From: Kevin C. <ke...@do...> - 2004-02-23 20:48:45
|
On 5 February 2004 at 22:43, Chris Bagwell <ch...@cn...> wrote: > Mind expanding on what you mean by invert? Positive peaks would become negative peaks, and visa versa. My two uses for this feature are: - Suppression of vocals in music. Typically vocals are centered in a mix, so will get reduced in gain via Rch minus Lch. This is done in some dedicated hardware disc recorders. A friend of mine has one of those and the effect works pretty well; don't expect it to be perfect though. - Creation of a phase calibration sound file. To check for proper phase in a sound system one can play an in phase signal and then an out of phase signal. It's pretty easy to tell if the phase alignment is good, at least within 180deg, doing such a test. > Or do you mean you want to mess with the phase? You can change > the volume by -1 which will not change its volume at all but > will flip the digital values (-1 becomes 1, 1 becomes -1, etc). Perfect, I hadn't thought to try gains < 0. "Duh" on my part now. > This is more useful for encoding audio like TV's do. They > merge left&right audio into a single channel. Then they take > the left channel (or is it the right one?) and invert it and > place this as a second channel. If you have a mono-system > then you play the one channel without needing a mixer. If > you want just the right channel you mix left&right channel > to inverse-left channel together which leaves just the right > speakers sounds. If you want just the left then you use the > second channel; optionally inversing it again. It's been so long since I went through my TV modulation stuff in school, I'd forgotten that. Thanks for the trip down memory lane. > SoX will almost-but-not-quite do what you want either way. You > can split the file into two seperate audio files using the > "avg" effect. Run either the "reverse" effect or "-v -1" on > the channel-file of interest and then find a way to merge the > files back together: > > sox infile.wav outfile-left.wav avg -l sox infile.wav > outfile-right.wav avg -r sox outfile-right.wave > outfile-right-reverse.wav reverse > > Now the tricky part. The program called "soxmix" will mix the > two files back together: > > sox outfile.left.wav outfile-right-reverse.wave newfile.wav > > The problem is that is this "mix" operation meaning that it > mixes the sound together like your sound card mixer is doing. > ie. mix 2 1-channel files together and you still have only > 1-channel. Rats, I was almost there. I think I might be able to merge the two resulting 1-ch files into one 2-ch file using TkEca, a Tk GUI on top of ecasound. > I've been meaning to make a version of this called "soxmerge" > that will interleave the channels instead of mixing them. If > you have some spare time, look at sox.c in the places were > it does "#if SOXMIX". You'll notice it does something like > output_buffer[i] = (input_buffer1[i]/2 + input_buffer2[i]/2) to > do the mix. Change that to somelike closer to output_buffer[j] > = input_buffer1[i]; output_buffer[j+1} = intput_buffer2[i];. I'll keep this message so I can have a look as soon as Santa brings me some of that "spare time". ;-) I'll have a little less of that, as my wife is having our 2nd child this Thurdsay. Weeha! Thanks Chris..... |