在 Audacity 中,您必须在首选项的 Import/Export 部分中选中“Use custom mix”单选按钮。这将允许您导出多通道文件,并手动将轨道分配给通道。
除此之外,普通的旧 .wav 可以正常工作。
但您也可以使用SoX以更自动化的方式创建文件。
您可以手动将五个不同的文件组合(或文档中提到的“合并”)到一个五通道文件中,如下所示:
sox -M chan1.wav chan2.wav chan3.wav chan4.wav chan5.wav multi.wav
为了自动化这个过程,我整理了一个简短的 Bash 例程,用于生成具有交错测试音的多通道文件:
NUM=5 # Number of channels
LEN=2 # Length of each test tone, in seconds
OVL=0.5 # Overlap between test tones, in seconds
# A one-channel base file containing simple white noise.
# faded at both end with a quarter wave envelope to ensure
# smooth equal power transitions
sox -n -b 24 -c 1 out.wav synth $LEN whitenoise fade q $OVL -0 $OVL
# Instead of white noise you can for example make a 1kHz tone
# like this:
# sox -n -b 24 -c 1 out.wav synth $LEN sine 1k fade q $OVL -0 $OVL
# Or a sweep from 10Hz to 10kHz like this:
# sox -n -b 24 -c 1 out.wav synth $LEN sine 10-10k fade q $OVL -0 $OVL
# Produces a sequence of the number of seconds each channel
# shall be padded with
SEQ=$(for ((i=1; i<=NUM; i++))
do
echo "$i 1 - [$LEN $OVL -]x * p" | dc # reverse-Polish arithmetic
done)
echo $SEQ
# Padding the base file to various degrees and saving them separately
for j in $SEQ
do
sox -c 1 out.wav outpad${j}.wav pad $j
done
# Finding the just-produced individual files
FIL=$(ls | grep ^outpad)
# Merging the individual files into a single multi-channel file
sox -M $FIL multi.wav
rm $FIL # removing the individual files
# Producing a multi-channel waveform plot
ffmpeg -i multi.wav -y -filter_complex "showwavespic=s=2400x900:split_channels=1" -frames:v 1 waveform.png
# displaying the waveform plot
open waveform.png
正如波形图清楚地显示的那样,结果由一个包含五个通道的文件组成,每个通道具有相同的内容,只是在时间上移动了一些:
更多关于反向波兰算法使用dc
:http ://wiki.bash-hackers.org/howto/calculate-dc
更多关于使用显示波形ffmpeg
:https ://trac.ffmpeg.org/wiki/Waveform