On Tue, May 25, 2021 at 03:45:17PM +0200, Jan Stary wrote:
> This is current/amd64. I am trying to use the -c option of aucat,
> specifying the channels to be played from a multichannel file.
>
> As an example, here is a quad audio file produced by sox:
>
> $ sox -n -b 16 quad.wav synth 10 sin 200 sin 300 sin 400 sin 600 gain -6
> $ soxi quad.wav
>
> Input File : 'quad.wav'
> Channels : 4
> Sample Rate: 48000
> Precision : 16-bit
> Duration : 00:00:10.00 = 48 samples ~ 750 CDDA sectors
> File Size : 3.84M
> Bit Rate : 3.07M
> Sample Encoding: 16-bit Signed Integer PCM
>
>
> Now trying to use aucat -c to play the individual channels
> doesn't seem to do what it says:
>
> $ aucat -dd -c 0:0 -i quad.wav
> quad.wav: skipped unknown chunk
> quad.wav,pst=cfg: play, chan 0:3, 48000Hz, s16le, bytes 80..3840080, vol 32768
> default: 48000Hz, play 0:3, 36 blocks of 480 frames
> quad.wav,pst=cfg: allocated 17280 frame buffer
> cmap: nch = 4, ostart = 0, onext = 0, istart = 0, inext = 0
> quad.wav,pst=ini: chain initialized
> quad.wav,pst=run: started
> started
> ^Cquad.wav,pst=ini: stopped
> stopped
> quad.wav,pst=ini: closed
>
>
> Indeed quad.wav has channels 0:3, but why does auact play channels 0:3
> with -c 0:0 specified? Specifying other channels seem even more confusing:
>
> $ aucat -dd -c 2:2 -i quad.wav
> quad.wav: skipped unknown chunk
> quad.wav,pst=cfg: play, chan 2:5, 48000Hz, s16le, bytes 80..3840080, vol 32768
> default: 48000Hz, play 0:5, 36 blocks of 480 frames
> quad.wav,pst=cfg: allocated 17280 frame buffer
> cmap: nch = 4, ostart = 2, onext = 0, istart = 0, inext = 0
> quad.wav,pst=ini: chain initialized
> quad.wav,pst=run: started
> started
> ^Cquad.wav,pst=ini: stopped
> stopped
> quad.wav,pst=ini: closed
>
> Now it considers quad.wav to have channels 2 to 5
> and it plays channels 0:5, given -c 2:2.
>
> Maybe I am misunderstanding the -c option
> (or what the -dd messages say):
>
> -c min:max The range of audio file channel numbers.
> The default is 0:1, i.e. stereo.
>
> When playing a file with aucat -i, does that mean
> "use these channels from the file"?
>
> If not, how does one specify "play just channel 2, out of 0,1,2,3"?
>
> There is a chunk that aucat skips; this is what sndfile-info says:
>
> File : quad.wav
> Length : 384080
> RIFF : 384072
> WAVE
> fmt : 40
> Format: 0xFFFE => WAVE_FORMAT_EXTENSIBLE
> Channels : 4
> Sample Rate : 48000
> Block Align : 8
> Bit Width : 16
> Bytes/sec : 384000
> Valid Bits: 16
> Channel Mask : 0x33 (L, R, Ls, Rs)
> Subformat
> esf_field1 : 0x1
> esf_field2 : 0x0
> esf_field3 : 0x10
> esf_field4 : 0x80 0x0 0x0 0xAA 0x0 0x38 0x9B 0x71
> format : pcm
> fact : 4
> frames : 48000
> data : 384000
> End
>
>
> Sample Rate : 48000
> Frames : 48000
> Channels: 4
> Format : 0x00130002
> Sections: 1
> Seekable: TRUE
> Duration: 00:00:01.000
> Signal Max : 16424 (-6.00 dB)
>
>
> With 1 second instead of 10 seconds of audio (synth 1) the file
> is small enough, I am attaching it.
>
> Thanks for any clue.
>
Hi,
The -c, -e, and -r options are used to specify file's channels,
encoding and rate in case they are undefined, typically for raw data
files. The .wav file header of quad.wav contains the number of
channels (but not the initial channel). So, in your example, the
number of channel is taken from the .wav header, that's why you hear
all channels. The -c option is used only to determine the starting
channel.
For output .wav files -c make sense, though. For instance:
aucat -n -i quad.wav -c 1:1 -o quad-1.wav
extracts channel 1 into a mono file. Here -c 1:1 specifies channels
selection of the output file. Then, playing quad-1.wav will, in turn,
play channel 1 of the quad.wav file.