[linux-audio-user] Wave file conversion (multi-mono->stereo, then downsample/downsize, then dither)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Sep 09, 2004 at 01:22:45PM -0700, Mark Knecht wrote:
> On Thu, 2004-09-09 at 12:32, Eric Dantan Rzewnicki wrote:
> > On Thu, Sep 09, 2004 at 11:21:35AM -0700, Mark Knecht wrote:
> > > On Thu, 2004-09-09 at 11:02, Eric Dantan Rzewnicki wrote:
> > > > ecasound!
> > > > ecasound -a:1 -i:mono1.wav \
> > > >     -a:2 -i:mono2.wav \
> > > >     -a:1,2 -f:24,2,96000 -o:stereo.wav \
> > > >     -a:2 -erc:1,2 -eac:0,1
> > > Thanks. I'll give that a try. At least that handles step one, assuming
> > > no audio problems are created.
> > If step 2 was downsampling to 16 bit 44.1kHz, then just change the -f
> > above to: -f:16,2,44100 ... sorry I missed that bit.
> Eric,
>    How would I be sure that my emerge of ecasound uses libsamplerate
> capabilities? Can this be observed at runtime? Or in the output files
> somehow? Anywhere else?
>    Anyway, If I'm going to downsize from 24-bits to 16-bits then I want
> to add dithering, but I see no mention of dithering in man ecasound. I
> know jack has an option to dither it's outputs, but from some dark
> remote part of my memory I seem to remember that this only effects the
> output going to the sound card and not what's going to a file. Comments
> anyone?

Here is one way to be sure ecasound uses libsamplerate:

ecasound -f:16,2,44100 -i:resample-hq,auto,hi-quality.wav -o:lower-quality.wav

The resample-hq input object type, with the auto flag, is a special type
that causes ecasound to automatically read the format of the input .wav
and resample it using libsamplerate to match the format set for the rest
of the chain. I imagine the above command will fail if ecasound is not 
compiled with src support. There is a similar resample object that uses
the internal linear interpolation. For both object types auto can be
replaced with the actual sample format if your input file format lacks 
that info. One example would be raw input files.

Rewriting the earlier example, your whole conversion can be done with
one commandline:

ecasound -f:16,2,44100 \
    -a:1 -i:resample-hq,auto,mono1.wav \
    -a:2 -i:resample-hq,auto,mono2.wav \
    -a:1,2 -o:stereo.wav \
    -a:2 -erc:1,2 -eac:0,1

(untested, but as far as I know, it should work)

-Eric Rz.

[Index of Archives]     [Linux Sound]     [ALSA Users]     [Pulse Audio]     [ALSA Devel]     [Sox Users]     [Linux Media]     [Kernel]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux