Re: [Alsa-user] ice1712 recording

2016-12-08 Thread Ralf Mardorf
On Thu, 8 Dec 2016 12:18:47 -0600, James Shatto wrote:
>As well as a few CLI options for the same.  Sox is good for that.

For SpaceFM I wrote a script to split and/or merge stereo wav. Written
on the fly, so most likely not good shell script writing, but it does
what it should do and IIRC ffmpeg was easier to use.

[rocketmouse@archlinux bin]$ ls -Ggl s2*
lrwxrwxrwx 13 Apr 27  2016 s2a -> s2m
lrwxrwxrwx 13 Apr 27  2016 s2d -> s2m
lrwxrwxrwx 13 Apr 27  2016 s2l -> s2m
-rwxr-xr-x 1 1791 Apr 28  2016 s2m
lrwxrwxrwx 13 Apr 27  2016 s2r -> s2m
[rocketmouse@archlinux bin]$ cat s2m
#!/bin/dash

version="2016-04-28"

usage()
{
  cat< mono.wav:
s2m input_file.wav
  stereo.wav > left.wav:  
s2l input_file.wav
  stereo.wav > right.wav:
s2r input_file.wav
  stereo.wav > dual {left,right}.wav:
s2d input_file.wav
  stereo.wav > all {mono,left,right}.wav:
s2a input_file.wav

EOF
  exit $1
}

outfile()
{
  outfile="$(echo "$infile" | sed 's/\(.*\).wav/\1_'$1.$suffix/I)"
  if [ -f "$outfile" ]; then
echo "$outfile already exists"
usage 1
  fi
}

ex2file()
{
  outfile $1
  echo "Export to $outfile"
  case $1 in
mono)
  ffmpeg -i "$infile" -ac 1 "$outfile"
;;
left)
  ffmpeg -i "$infile" -map_channel 0.0.0 "$outfile"
;;
right)
  ffmpeg -i "$infile" -map_channel 0.0.1 "$outfile"
;;
  esac
}

case $1 in
  -h|--help)
usage 0
  ;;
esac

infile="$1"
if [ ! -f "$infile" ]; then
  echo "No file $infile"
  usage 1
fi

num_ch=$(exiftool "$infile" | grep -v "File Name" | grep -v "Directory" | grep 
"Num Channels" | cut -d: -f2 | sed s/\ //)
plural=""
if [ "$num_ch" = "" ]; then
  num_ch="No"
else 
  if [ "$num_ch" -ge "2" ]; then
plural="s"
  fi
fi
if [ "$num_ch" != "2" ]; then
  echo "$num_ch channel$plural, not a stereo file"
  usage 1
fi

suffix=$(echo "$infile" | rev | cut -d. -f1 | rev)
if [ "$(echo "$suffix" | tr [:upper:] [:lower:])" != "wav" ]; then
  echo "Suffix is \"$suffix\", must be \"wav\", case sensitivity is not 
required"
  usage 1
fi

case $(basename $0) in
  s2m)
ex2file mono
  ;;
  s2l)
ex2file left
  ;;
  s2r)
ex2file right
  ;;
  s2d)
outfile right
ex2file left
ex2file right
  ;;
  s2a)
outfile left
outfile right
ex2file mono
ex2file left
ex2file right
  ;;
esac

exit



--
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/xeonphi
___
Alsa-user mailing list
Alsa-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-user


Re: [Alsa-user] ice1712 recording

2016-12-08 Thread James Shatto
> You can mix all 4 inputs down into one stream and then record that, but
do you really mean that you can record to 4 separate application threads
concurrently without mixing?

No, I mean you can record all four channels as input at the same time
with the same app.  Hence the -c 4 aka 4 channels.  In audacity you
just select 4 channels and press record.  Once recorded you can break
them out into 4 mono channels and save each individually (unmixed).
There's no mixing involved until you configure it to do so.  WAV files
and other audio formats often contain multiple tracks.  Individual
unmixed tracks.  They are mixed at the time of playback if configured
to do so.

By default sound is often configured for stereo with one track panned
left and one track panned right.  But it's two tracks, not mixed
(until reproduced and analog-illy mixed in air).  Baring cheap sound
devices that have bleed over between tracks with unintentional mixing.
In audacity you can separate the channels and unpan them for two true
mono tracks.  As well as a few CLI options for the same.  Sox is good
for that.

With unix-isms you can send your output to stdout and pipe to stdin of
another app.  Like tee which can then save a file and redirect the
same output to another file.  I've sometimes gone this route to output
the raw WAV and a compressed MP3 at the same time to two different
storage devices / locations.

I seem to recall an arecord option to output each channel as it's own
mono file.  Which you could tail -f on other terminals to pipe that to
other things.  Seems like --separate-channels is that option.

$ arecord --help

- James

--
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/xeonphi
___
Alsa-user mailing list
Alsa-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-user


Re: [Alsa-user] Multi and Format

2016-12-08 Thread Clemens Ladisch
Ed Stark wrote:
> I cannot seem to get the linear to work after a multi, even if after a multi 
> -> rate -> linear -> slave.

The "plug" plugin combines all needed automatic conversions; replace
"rate->linear" with "plug".

> Anything that I do that specifies a format after the multi

... is a secret.


Regards,
Clemens

--
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/xeonphi
___
Alsa-user mailing list
Alsa-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-user