[LAU] Input to aplay to make a file instead?
John Murphy
rosegardener at freeode.co.uk
Sun Apr 19 15:07:38 CEST 2020
On Sun, 19 Apr 2020 12:29:37 +0200 al3xu5 / dotcommon wrote:
> Sat, 18 Apr 2020 09:50:30 +0100 - John Murphy <rosegardener at freeode.co.uk>:
>
> > I use a program which plays regions of various .wav files. Its
> > output pipes into aplay like: '| aplay -f FLOAT_LE -c 2 -r 48000'
> >
> > To where can I pipe its output, instead, to make a new .wav file,
> > or make a compressed file? Preferably faster than the region(s)
> > take to play.
> >
> > Or, if not, make aplay write to a file instead of playing?
> >
> > Thank you.
>
>
> Use sox:
>
> sox source.wav -L -c 2 -r 48000 new.wav trim <start_second> <duration_seconds>
>
> where:
>
> -L : little endian
> -c 2 : 2-channels stereo
> -r 48000 : freq (Hz)
> <start_second> : region start (second)
> <duration_seconds> : region duration (seconds)
>
That works a treat. Thank you. sox works so much better when it has
an actual file as input that it works just as well without -L -c -r
As the region lines I get give the start and end positions, I can use
'=' before duration and give it the end position directly like:
REGION "Fri0304.wav" 00:00:01.14181 00:00:05.07359 works in sox like:
sox Fri0304.wav new.wav trim 1.14181 =5.07359
$ soxi new.wav
Input File : 'new.wav'
Channels : 2
Sample Rate : 48000
Precision : 16-bit
Duration : 00:00:03.93 = 188725 samples ~ 294.883 CDDA sectors
File Size : 755k
Bit Rate : 1.54M
Sample Encoding: 16-bit Signed Integer PCM
I should be able to write a script to get the filename and start/end
seconds from the region lines and tell sox what to do.
Many thanks and best regards to all who have responded. I'll be fine
now and I may even try some of the other ways, because they're there. :)
--
John.
More information about the Linux-audio-user
mailing list