Alsa input sample rate puzzle

View: New views
5 Messages — Rating Filter:   Alert me  

Alsa input sample rate puzzle

by Andrew Lees-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

After trying a number of GUI based recording tools to record my LP collection, and finding issues with them all of one form or another I'm trying ecasound.  I have a slight puzzle though.  I am using an Audigy NX external USB card, and other recording software (arecord, audacity, for example) seem to think that the card supports an input side sample rate of 48000 s/s, but not 44100, while ecasound thinks it supports a 44100 rate but not 48000.  Both camps are set in their ways, and will not be persuaded to operate at the other bit rate.  44100 is probable more convenient, but I wonder if someone has an answer to this conundrum?

A typical ecasound command line that works is:

ecasound -f:s24_le,2,44100 -i:alsahw,1,0 -t:1800 -ge:5,0.02 -B:nonrt -o side2-2.wav (currently lockup are making me wary about rt modes)

whereas ecasound -f:s24_le,2,48000 -i:alsahw,1,0 ... will not work.

Also arecord requires a -f S24_3LE option rather than a -f S24_LE option (which it says is not supported), while ecasound will not work with a -f:s24_3le, option - all very curious.

Any suggestions as to this apparent difference?

Regards,

Andrew Lees



-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Ecasound-list mailing list
Ecasound-list@...
https://lists.sourceforge.net/lists/listinfo/ecasound-list

Re: Alsa input sample rate puzzle

by Julien Claassen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello!
   As to the S24_LE and the arecord way of things, they just developed
seperately and didn't obviously communicate. Weel there's nothing saying, that
the bit-depth option has to be in a certain format. Alas.
   As to your samplerate problem. This is really curious. I started out
recording 44100, but for a long time I've been doing 48000kHz. I work with
JACK though. Question: Does you soundcard have a samplerate setting. Mine has,
it called clock or something. This can be set to different values.
   And there is your /usr/local/share/ecasound/ecasoundrc (if you installed
manually or /usr/share/ecasound/ecasoundrc if you took a package). There is a
setting for standard format. I set it to: s16_le,2,48000,i
maybe this also helps.
   Beyond that, I'm out of it...
   Kindeest regards
         Julien

--------
Music was my first love and it will be my last (John Miles)

======== FIND MY WEB-PROJECT AT: ========
http://ltsb.sourceforge.net
the Linux TextBased Studio guide
======= AND MY PERSONAL PAGES AT: =======
http://www.juliencoder.de

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Ecasound-list mailing list
Ecasound-list@...
https://lists.sourceforge.net/lists/listinfo/ecasound-list

Re: Alsa input sample rate puzzle

by Kai Vehmanen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

On Tue, 17 Jun 2008, Andrew Lees wrote:

> trying ecasound.  I have a slight puzzle though.  I am using an Audigy
> NX external USB card, and other recording software (arecord, audacity,
> for example) seem to think that the card supports an input side sample
> rate of 48000 s/s, but not 44100, while ecasound thinks it supports a
> 44100 rate but not 48000.  Both camps are set in their ways, and will
[...]
> ecasound -f:s24_le,2,44100 -i:alsahw,1,0 -t:1800 -ge:5,0.02 -B:nonrt -o
> side2-2.wav (currently lockup are making me wary about rt modes)
>
> whereas ecasound -f:s24_le,2,48000 -i:alsahw,1,0 ... will not work.

that would suggest the card natively supports only 44100. Arecord should
behave similarly if you pass it:

arecord -D hw:1,0 ...

If you use the ALSA plugin layer (arecord without extra options, or
ecasound with "-i:plughw:1,0"), alsa-lib will resample the audio for you.
But usually (and especially when recording) it's better to record in the
native sample rate supported by HW (so 44100 in this case).

> Also arecord requires a -f S24_3LE option rather than a -f S24_LE option
> (which it says is not supported), while ecasound will not work with a
> -f:s24_3le, option - all very curious.

Yes, ecasound does not recognize '-f:s24_3le'. This is quite complicated
in fact... if you use the ALSA plug layer (-i:plughw:1,0 or arecord -D
plughw:1,0), alsa-lib will make the conversion for you, but otherwise you
need to understand what is going on. Basicly ALSA's S24_3LE is same as
ecasound's '-f:s24_le'. ALSA's S24_LE is in fact a 32bit sample, with
least-significant byte zeroed (so 24bit of information, stored in 32bits).
The latter one is much more common. In ecasound, you can use '-f:s32_le'
for both ALSA types S24_LE and S32_LE (because ecasound doesn't care
whether the lower bits are zeroed out or have valid info).

--

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Ecasound-list mailing list
Ecasound-list@...
https://lists.sourceforge.net/lists/listinfo/ecasound-list

Re: Alsa input sample rate puzzle

by Andrew Lees-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

On Fri, 2008-06-20 at 01:07 +0300, Kai Vehmanen wrote:
Hi,

On Tue, 17 Jun 2008, Andrew Lees wrote:

> trying ecasound.  I have a slight puzzle though.  I am using an Audigy
> NX external USB card, and other recording software (arecord, audacity,
> for example) seem to think that the card supports an input side sample
> rate of 48000 s/s, but not 44100, while ecasound thinks it supports a
> 44100 rate but not 48000.  Both camps are set in their ways, and will
[...]
> ecasound -f:s24_le,2,44100 -i:alsahw,1,0 -t:1800 -ge:5,0.02 -B:nonrt -o
> side2-2.wav (currently lockup are making me wary about rt modes)
>
> whereas ecasound -f:s24_le,2,48000 -i:alsahw,1,0 ... will not work.

that would suggest the card natively supports only 44100. Arecord should 
behave similarly if you pass it:

arecord -D hw:1,0 ...
Which is exactly what I did to get the 48000 rate, with 44100 not being supported by arecord.  So for example, this is a session:
~/Audio $ arecord -D hw:1,0 -f cd xxx.wav
Recording WAVE 'xxx.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
Warning: rate is not accurate (requested = 44100Hz, got = 48000Hz)
         please, try the plug plugin 
~/Audio $ arecord -D hw:1,0 -f dat xxx.wav
Recording WAVE 'xxx.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
Happy at 48000, unhappy at 44100.  The same for other formats, and the converse of the situation with ecasound.  Is there some setup that configurs the card to do one rate vs another?  I can sample at integer multiples  and ratios of 44100 with ecasound, and similarly wrt 48000 with arecord, so some basic parameter of the card must be being set up differently in the two cases, perhaps?


If you use the ALSA plugin layer (arecord without extra options, or 
ecasound with "-i:plughw:1,0"), alsa-lib will resample the audio for you. 
But usually (and especially when recording) it's better to record in the 
native sample rate supported by HW (so 44100 in this case).

> Also arecord requires a -f S24_3LE option rather than a -f S24_LE option
> (which it says is not supported), while ecasound will not work with a
> -f:s24_3le, option - all very curious.

Yes, ecasound does not recognize '-f:s24_3le'. This is quite complicated 
in fact... if you use the ALSA plug layer (-i:plughw:1,0 or arecord -D 
plughw:1,0), alsa-lib will make the conversion for you, but otherwise you 
need to understand what is going on. Basicly ALSA's S24_3LE is same as 
ecasound's '-f:s24_le'. ALSA's S24_LE is in fact a 32bit sample, with 
least-significant byte zeroed (so 24bit of information, stored in 32bits).
The latter one is much more common. In ecasound, you can use '-f:s32_le' 
for both ALSA types S24_LE and S32_LE (because ecasound doesn't care 
whether the lower bits are zeroed out or have valid info).
OK, that make sense.

By the way, I am using ecasound to record my LPs, and I've patched the amplitude gate (ge) to take an optional loop count argument, so that I can record multiple sides into one wav file with the gate opening and closing as required.  Any interest in the patch?

Thanks for the assistance, but still puzzled!

--

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Ecasound-list mailing list
Ecasound-list@...
https://lists.sourceforge.net/lists/listinfo/ecasound-list

Re: Alsa input sample rate puzzle

by Kai Vehmanen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

On Fri, 20 Jun 2008, Andrew Lees wrote:

> Which is exactly what I did to get the 48000 rate, with 44100 not being
> supported by arecord.  So for example, this is a session:
>
> ~/Audio $ arecord -D hw:1,0 -f cd xxx.wav
> Recording WAVE 'xxx.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
> Warning: rate is not accurate (requested = 44100Hz, got = 48000Hz)
>         please, try the plug plugin
> ~/Audio $ arecord -D hw:1,0 -f dat xxx.wav
> Recording WAVE 'xxx.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo

aa, ok. So my guess was definitely wrong...

> Happy at 48000, unhappy at 44100.  The same for other formats, and the
> converse of the situation with ecasound.  Is there some setup that

Hmm, it is really weird you get different behaviour with arecord and
ecasound. Could you send me a private mail with a log of running ecasound
with full debugging (-ddd)?

> configurs the card to do one rate vs another?  I can sample at integer
> multiples  and ratios of 44100 with ecasound, and similarly wrt 48000
> with arecord, so some basic parameter of the card must be being set up
> differently in the two cases, perhaps?

Some cards in fact do have rather bizarre limitations (channel count
and/or sample width impact the possible values for other settings), but
this is not very common. Plus in your tests, you've requested the very
same params with both arecord and ecasound, so there shouldn't be any
difference.

--

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Ecasound-list mailing list
Ecasound-list@...
https://lists.sourceforge.net/lists/listinfo/ecasound-list
LightInTheBox - Buy quality products at wholesale price