Re: [LAU] Input to aplay to make a file instead?

From: John Murphy <rosegardener@email-addr-hidden>
Date: Sun Apr 19 2020 - 16:07:38 EEST

On Sun, 19 Apr 2020 12:29:37 +0200 al3xu5 / dotcommon wrote:

> Sat, 18 Apr 2020 09:50:30 +0100 - John Murphy <rosegardener@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.
_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@lists.linuxaudio.org
https://lists.linuxaudio.org/listinfo/linux-audio-user
Received on Mon Apr 20 04:15:01 2020

This archive was generated by hypermail 2.1.8 : Mon Apr 20 2020 - 04:15:01 EEST