|
List Info
Thread: Set fragment size for USB sound card
|
|
| Set fragment size for USB sound card |
  Australia |
2007-04-08 02:04:17 |
System: NEC Versa M540 laptop
Dist: Debian Sarge/Etch
Kernel: 2.6.18
Alsa: using drivers in kernel, although no difference when
compiled from
alsa-source package.
Card in question: C-Media USB sound card (more info below)
I recently purchased a C-Media USB sound card, and
eventually figured
out that it only works with a fragment size of 2048 or less.
I can use
alsaplayer with the '-f' option to hear sound through them,
but I want
to tell ALSA in general that it can only handle this range
for the
fragment size (and only for this card). Hopefully then I'll
be able to
hear all my other applications.
I'm not even sure where to start -- udev, ALSA
configuration, module
configuration...
I've read every resource on ALSA configuration files that I
can find,
and tried a whole lot of plugin definitions and parameters
with no luck
whatsoever. I also tried forcing the index of the card by
adding the
following to /etc/modprobe.d/alsa-base, but even this only
works half of
the time:
--
# Prevent abnormal drivers from grabbing index 0
options snd-bt87x index=-2
options snd-cx88_alsa index=-2
options snd-atiixp-modem index=-2
# options snd-intel8x0m index=-2
options snd-via82xx-modem index=-2
options snd-intel8x0 index=0
options snd-intel8x0m index=1
options snd-usb-audio index=2 vid=0d8c pid=000c
options snd-usb-audio index=3
--
The contents of '/proc/asound/cards' are:
--
0 [I82801DBICH4 ]: ICH4 - Intel 82801DB-ICH4
Intel 82801DB-ICH4 with ALC655 at
0xf0000400, irq
5
1 [Modem ]: ICH-MODEM - Intel 82801DB-ICH4 Modem
Intel 82801DB-ICH4 Modem at 0xe200,
irq 5
2 [default ]: USB-Audio - C-Media USB Headphone Set
C-Media USB Headphone Set at
usb-0000:00:1d.1-1,
full speed
--
...although sometimes the ICH-MODEM is missing and the
C-Media card is
at #1.
Card information from 'lsusb':
Bus 002 Device 003: ID 0d8c:000c C-Media Electronics, Inc.
Audio Adapter
Usually I boot with the card plugged in, but if I plug it in
after
booting, the new modules loaded are: snd_hwdep,
snd_rawmidi,
snd_usb_audio and snd_usb_lib.
By the way, nowhere could I find in the documentation what
the various
synonyms were for 'fragment size' -- what else is this
parameter called?
What is the equivalent in ALSA configuration files? I
figured it was
'packet_bytes', but I wasn't sure.
Anyway, I would appreciate any advice on this.
Thanks,
Jason
------------------------------------------------------------
-------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the
chance to share your
opinions on IT & business topics through brief
surveys-and earn cash
http://www.techsay.com/default.
php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Alsa-user mailing list
Alsa-user lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-user
|
|
| Re: Set fragment size for USB sound
card |

|
2007-04-09 18:46:18 |
You may look for settings like "playback buffer"
or "buffer size".
One option you might try is running jackd with a buffer size
of 512 or
1024, and using an .asoundrc file in your home directory to
create a
jackd PCM and set it as the default PCM.
Mike Bourgeous
On 4/8/07, Jason Heeris <heerij01 student.uwa.edu.au>
wrote:
> System: NEC Versa M540 laptop
> Dist: Debian Sarge/Etch
> Kernel: 2.6.18
> Alsa: using drivers in kernel, although no difference
when compiled from
> alsa-source package.
> Card in question: C-Media USB sound card (more info
below)
>
> I recently purchased a C-Media USB sound card, and
eventually figured
> out that it only works with a fragment size of 2048 or
less. I can use
> alsaplayer with the '-f' option to hear sound through
them, but I want
> to tell ALSA in general that it can only handle this
range for the
> fragment size (and only for this card). Hopefully then
I'll be able to
> hear all my other applications.
>
> I'm not even sure where to start -- udev, ALSA
configuration, module
> configuration...
>
> I've read every resource on ALSA configuration files
that I can find,
> and tried a whole lot of plugin definitions and
parameters with no luck
> whatsoever. I also tried forcing the index of the card
by adding the
> following to /etc/modprobe.d/alsa-base, but even this
only works half of
> the time:
>
> --
> # Prevent abnormal drivers from grabbing index 0
> options snd-bt87x index=-2
> options snd-cx88_alsa index=-2
> options snd-atiixp-modem index=-2
> # options snd-intel8x0m index=-2
> options snd-via82xx-modem index=-2
>
> options snd-intel8x0 index=0
> options snd-intel8x0m index=1
> options snd-usb-audio index=2 vid=0d8c pid=000c
> options snd-usb-audio index=3
> --
>
> The contents of '/proc/asound/cards' are:
>
> --
> 0 [I82801DBICH4 ]: ICH4 - Intel 82801DB-ICH4
> Intel 82801DB-ICH4 with ALC655 at
0xf0000400, irq
> 5
> 1 [Modem ]: ICH-MODEM - Intel 82801DB-ICH4
Modem
> Intel 82801DB-ICH4 Modem at
0xe200, irq 5
> 2 [default ]: USB-Audio - C-Media USB Headphone
Set
> C-Media USB Headphone Set at
usb-0000:00:1d.1-1,
> full speed
> --
>
> ...although sometimes the ICH-MODEM is missing and the
C-Media card is
> at #1.
>
> Card information from 'lsusb':
>
> Bus 002 Device 003: ID 0d8c:000c C-Media Electronics,
Inc. Audio Adapter
>
> Usually I boot with the card plugged in, but if I plug
it in after
> booting, the new modules loaded are: snd_hwdep,
snd_rawmidi,
> snd_usb_audio and snd_usb_lib.
>
> By the way, nowhere could I find in the documentation
what the various
> synonyms were for 'fragment size' -- what else is this
parameter called?
> What is the equivalent in ALSA configuration files? I
figured it was
> 'packet_bytes', but I wasn't sure.
>
> Anyway, I would appreciate any advice on this.
>
> Thanks,
> Jason
>
>
>
------------------------------------------------------------
-------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the
chance to share your
> opinions on IT & business topics through brief
surveys-and earn cash
> http://www.techsay.com/default.
php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Alsa-user mailing list
> Alsa-user lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/alsa-user
>
------------------------------------------------------------
-------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the
chance to share your
opinions on IT & business topics through brief
surveys-and earn cash
http://www.techsay.com/default.
php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Alsa-user mailing list
Alsa-user lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-user
|
|
| Re: Set fragment size for USB sound
card |
  Australia |
2007-04-09 19:48:13 |
But will this still allow ALSA to revert to the laptop
speakers when the
card is not plugged in? And will it work when the index of
the card
changes, seemingly arbitrarily?
I attempted to define a slave PCM as follows, but with no
success:
--
pcm.usbtest {
type dmix
ipc_key 192837465
ipc_key_add_uid true
slave {
pcm "hw:2,0"
# period_size 2048
buffer_size 2048
}
}
--
I switched and combined the 'period_size' and 'buffer_size'
to see what
would work, but only got:
--
$ alsaplayer -i text -o alsa -d usbtest
/usr/share/sounds/generic.wav
ALSA lib pcm_direct.c:985:(snd_pcm_direct_initialize_slave)
unable to
install hw params
ALSA lib pcm_dmix.c:876:(snd_pcm_dmix_open) unable to
initialize slave
snd_pcm_open: Broken pipe (usbtest)
Failed to initialize plugin!
Failed to register plugin:
/usr/lib/alsaplayer/output/libalsa_out.so
Failed to load output plugin "alsa". Trying
defaults.
ALSA lib pcm_direct.c:985:(snd_pcm_direct_initialize_slave)
unable to
install hw params
ALSA lib pcm_dmix.c:876:(snd_pcm_dmix_open) unable to
initialize slave
snd_pcm_open: Broken pipe (usbtest)
Failed to initialize plugin!
/usr/lib/alsaplayer/output/libalsa_out.so failed to load
jack: server not running?
/usr/lib/alsaplayer/output/libjack_out.so failed to load
...done playing
--
- Jason
On Mon, 2007-04-09 at 17:46 -0600, Michael Bourgeous wrote:
> You may look for settings like "playback
buffer" or "buffer size".
> One option you might try is running jackd with a buffer
size of 512 or
> 1024, and using an .asoundrc file in your home
directory to create a
> jackd PCM and set it as the default PCM.
>
> Mike Bourgeous
>
> On 4/8/07, Jason Heeris <heerij01 student.uwa.edu.au> wrote:
> > System: NEC Versa M540 laptop
> > Dist: Debian Sarge/Etch
> > Kernel: 2.6.18
> > Alsa: using drivers in kernel, although no
difference when compiled from
> > alsa-source package.
> > Card in question: C-Media USB sound card (more
info below)
> >
> > I recently purchased a C-Media USB sound card, and
eventually figured
> > out that it only works with a fragment size of
2048 or less. I can use
> > alsaplayer with the '-f' option to hear sound
through them, but I want
> > to tell ALSA in general that it can only handle
this range for the
> > fragment size (and only for this card). Hopefully
then I'll be able to
> > hear all my other applications.
> >
> > I'm not even sure where to start -- udev, ALSA
configuration, module
> > configuration...
> >
> > I've read every resource on ALSA configuration
files that I can find,
> > and tried a whole lot of plugin definitions and
parameters with no luck
> > whatsoever. I also tried forcing the index of the
card by adding the
> > following to /etc/modprobe.d/alsa-base, but even
this only works half of
> > the time:
> >
> > --
> > # Prevent abnormal drivers from grabbing index 0
> > options snd-bt87x index=-2
> > options snd-cx88_alsa index=-2
> > options snd-atiixp-modem index=-2
> > # options snd-intel8x0m index=-2
> > options snd-via82xx-modem index=-2
> >
> > options snd-intel8x0 index=0
> > options snd-intel8x0m index=1
> > options snd-usb-audio index=2 vid=0d8c pid=000c
> > options snd-usb-audio index=3
> > --
> >
> > The contents of '/proc/asound/cards' are:
> >
> > --
> > 0 [I82801DBICH4 ]: ICH4 - Intel 82801DB-ICH4
> > Intel 82801DB-ICH4 with
ALC655 at 0xf0000400, irq
> > 5
> > 1 [Modem ]: ICH-MODEM - Intel
82801DB-ICH4 Modem
> > Intel 82801DB-ICH4 Modem at
0xe200, irq 5
> > 2 [default ]: USB-Audio - C-Media USB
Headphone Set
> > C-Media USB Headphone Set
at usb-0000:00:1d.1-1,
> > full speed
> > --
> >
> > ...although sometimes the ICH-MODEM is missing and
the C-Media card is
> > at #1.
> >
> > Card information from 'lsusb':
> >
> > Bus 002 Device 003: ID 0d8c:000c C-Media
Electronics, Inc. Audio Adapter
> >
> > Usually I boot with the card plugged in, but if I
plug it in after
> > booting, the new modules loaded are: snd_hwdep,
snd_rawmidi,
> > snd_usb_audio and snd_usb_lib.
> >
> > By the way, nowhere could I find in the
documentation what the various
> > synonyms were for 'fragment size' -- what else is
this parameter called?
> > What is the equivalent in ALSA configuration
files? I figured it was
> > 'packet_bytes', but I wasn't sure.
> >
> > Anyway, I would appreciate any advice on this.
> >
> > Thanks,
> > Jason
> >
> >
> >
------------------------------------------------------------
-------------
> > Take Surveys. Earn Cash. Influence the Future of
IT
> > Join SourceForge.net's Techsay panel and you'll
get the chance to share your
> > opinions on IT & business topics through brief
surveys-and earn cash
> > http://www.techsay.com/default.
php?page=join.php&p=sourceforge&CID=DEVDEV
> > _______________________________________________
> > Alsa-user mailing list
> > Alsa-user lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/alsa-user
> >
------------------------------------------------------------
-------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the
chance to share your
opinions on IT & business topics through brief
surveys-and earn cash
http://www.techsay.com/default.
php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Alsa-user mailing list
Alsa-user lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-user
|
|
| Re: Set fragment size for USB sound
card |
  Australia |
2007-04-13 21:20:13 |
I've kept trying different configurations, but nothing
works. All the
examples I could find are either trivial or amazingly
complicated. If
anyone at all could send me some pointers, or even where to
look, I
would appreciate it.
Thanks,
Jason
On Tue, 2007-04-10 at 08:48 +0800, Jason Heeris wrote:
> I attempted to define a slave PCM as follows, but with
no success:
>
> --
> pcm.usbtest {
> type dmix
> ipc_key 192837465
> ipc_key_add_uid true
> slave {
> pcm "hw:2,0"
> # period_size 2048
> buffer_size 2048
> }
> }
> --
------------------------------------------------------------
-------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the
chance to share your
opinions on IT & business topics through brief
surveys-and earn cash
http://www.techsay.com/default.
php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Alsa-user mailing list
Alsa-user lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-user
|
|
| Re: Set fragment size for USB sound
card |

|
2007-04-13 21:28:08 |
On 4/13/07, Jason Heeris <heerij01 student.uwa.edu.au>
wrote:
> I've kept trying different configurations, but nothing
works. All the
> examples I could find are either trivial or amazingly
complicated. If
> anyone at all could send me some pointers, or even
where to look, I
> would appreciate it.
Please be more specific about the exact problem you're
trying to
solve. In what way does it "not work" with a
larger period size?
Lee
------------------------------------------------------------
-------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the
chance to share your
opinions on IT & business topics through brief
surveys-and earn cash
http://www.techsay.com/default.
php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Alsa-user mailing list
Alsa-user lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-user
|
|
| Re: Set fragment size for USB sound
card |
  Australia |
2007-04-13 22:33:27 |
The exact problem I'm trying to solve is specified in my
previous posts,
which for some reason aren't threaded with this one on the
SF website:
http://sourceforge.net/mailarchive/forum.ph
p?thread_name=1176015858.4497.9.camel%40localhost.localdomai
n&forum_name=alsa-user
...this followed from a post here:
http://www.linuxquestions.org/questions/showthrea
d.php?t=540205
But to answer your question, if I try:
--
$ alsaplayer -i text -o alsa -d hw:2 -f
4096 /usr/share/sounds/generic.wav
Unable to install hw params:
ACCESS: RW_INTERLEAVED
FORMAT: S16_LE
SUBFORMAT: STD
SAMPLE_BITS: 16
FRAME_BITS: 32
CHANNELS: 2
RATE: 44100
PERIOD_TIME: (23219 23220)
PERIOD_SIZE: 1024
PERIOD_BYTES: 4096
PERIODS: 8
BUFFER_TIME: (185759 185760)
BUFFER_SIZE: 8192
BUFFER_BYTES: 32768
TICK_TIME: 1000
failed to configure output device...trying OSS
...done playing
--
...and the sound comes through my laptop speakers. Using '-f
2048' works
fine (sound through headphones, no errors).
Cheers
- Jason
On Fri, 2007-04-13 at 22:28 -0400, Lee Revell wrote:
> On 4/13/07, Jason Heeris <heerij01 student.uwa.edu.au> wrote:
> > I've kept trying different configurations, but
nothing works. All the
> > examples I could find are either trivial or
amazingly complicated. If
> > anyone at all could send me some pointers, or even
where to look, I
> > would appreciate it.
>
> Please be more specific about the exact problem you're
trying to
> solve. In what way does it "not work" with a
larger period size?
>
> Lee
------------------------------------------------------------
-------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the
chance to share your
opinions on IT & business topics through brief
surveys-and earn cash
http://www.techsay.com/default.
php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Alsa-user mailing list
Alsa-user lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-user
|
|
| Re: Set fragment size for USB sound
card |

|
2007-04-14 18:52:44 |
On 4/13/07, Jason Heeris <heerij01 student.uwa.edu.au>
wrote:
> But to answer your question, if I try:
>
> --
> $ alsaplayer -i text -o alsa -d hw:2 -f
> 4096 /usr/share/sounds/generic.wav
> Unable to install hw params:
> ACCESS: RW_INTERLEAVED
> FORMAT: S16_LE
> SUBFORMAT: STD
> SAMPLE_BITS: 16
> FRAME_BITS: 32
> CHANNELS: 2
> RATE: 44100
> PERIOD_TIME: (23219 23220)
> PERIOD_SIZE: 1024
> PERIOD_BYTES: 4096
> PERIODS: 8
> BUFFER_TIME: (185759 185760)
> BUFFER_SIZE: 8192
> BUFFER_BYTES: 32768
> TICK_TIME: 1000
> failed to configure output device...trying OSS
That's an alsaplayer bug, it seems to assume that ALSA can
handle any
period size it asks for then falls back to OSS if it fails.
The app
should try a different period size or ask ALSA for a valid
one.
Lee
------------------------------------------------------------
-------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and
take
control of your XML. No limits. Just data. Click to get it
now.
http://sourcefor
ge.net/powerbar/db2/
_______________________________________________
Alsa-user mailing list
Alsa-user lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-user
|
|
| Re: Set fragment size for USB sound
card |
  Australia |
2007-04-14 21:27:38 |
On Sat, 2007-04-14 at 19:52 -0400, Lee Revell wrote:
> That's an alsaplayer bug, it seems to assume that ALSA
can handle any
> period size it asks for then falls back to OSS if it
fails. The app
> should try a different period size or ask ALSA for a
valid one.
But none of them do. XMMS in particular refuses to play and
claims:
--
[Couldn't open audio]
Please check that:
Your soundcard is configured properly
You have the correct output plugin selected
No other program is blocking the soundcard
--
...So if I can't get ALSA to automatically use the smaller
fragment size
for that card, I'd at least like to define some sort of
plugin that will
change the fragment size so I can manually select it.
Thanks,
Jason
------------------------------------------------------------
-------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and
take
control of your XML. No limits. Just data. Click to get it
now.
http://sourcefor
ge.net/powerbar/db2/
_______________________________________________
Alsa-user mailing list
Alsa-user lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-user
|
|
| Re: Set fragment size for USB sound
card |

|
2007-04-16 10:23:18 |
On 4/14/07, Jason Heeris <heerij01 student.uwa.edu.au>
wrote:
> On Sat, 2007-04-14 at 19:52 -0400, Lee Revell wrote:
> > That's an alsaplayer bug, it seems to assume that
ALSA can handle any
> > period size it asks for then falls back to OSS if
it fails. The app
> > should try a different period size or ask ALSA for
a valid one.
>
> But none of them do. XMMS in particular refuses to play
and claims:
Sorry, no idea. Try setting up dmix as described on the
ALSA wiki and
set the period size to something that the soundcard can
handle. Or
raise the issue on the alsa-devel list.
Lee
------------------------------------------------------------
-------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and
take
control of your XML. No limits. Just data. Click to get it
now.
http://sourcefor
ge.net/powerbar/db2/
_______________________________________________
Alsa-user mailing list
Alsa-user lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-user
|
|
[1-9]
|
|