Re: [Alsa-user] query alsa for supported sample rates and formats?
On Fri, Apr 17, 2009 at 10:14:16AM +0200, Clemens Ladisch wrote: Matt Garman wrote: Is there a way to query alsa to see what sample rates and formats the sound hardware natively supports? Try the attached program. I get the following output when I run this for my M-Audio Audiophile 24/96. No surprises: what led me to asking this question was my observation that I couldn't play CD audio (S16_LE) using hw, and have to use dmix or plughw. Device: hw (type: HW) Access types: MMAP_INTERLEAVED RW_INTERLEAVED Formats: S32_LE Channels: 10 Sample rates: 8000 11025 16000 22050 32000 44100 48000 64000 88200 96000 Interrupt interval: 20-409500 us Buffer size: 20-819125 us Now, before Clemens was nice enough to post that program, I posed the same question on the M-Audio.com forums: http://forums.m-audio.com/showthread.php?p=38192 The response seems to suggest that the card should support more formats. Or perhaps I'm misreading the responses (or the tech that answered the question doesn't really understand my question). Thoughts? Thanks again, Matt -- The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your production scanning environment may not be a perfect world - but thanks to Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com ___ Alsa-user mailing list Alsa-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/alsa-user
Re: [Alsa-user] query alsa for supported sample rates and formats?
On Mon, 11 May 2009, Matt Garman wrote: On Fri, Apr 17, 2009 at 10:14:16AM +0200, Clemens Ladisch wrote: Matt Garman wrote: Is there a way to query alsa to see what sample rates and formats the sound hardware natively supports? Try the attached program. I get the following output when I run this for my M-Audio Audiophile 24/96. No surprises: what led me to asking this question was my observation that I couldn't play CD audio (S16_LE) using hw, and have to use dmix or plughw. Device: hw (type: HW) Access types: MMAP_INTERLEAVED RW_INTERLEAVED Formats: S32_LE Channels: 10 Sample rates: 8000 11025 16000 22050 32000 44100 48000 64000 88200 96000 Interrupt interval: 20-409500 us Buffer size: 20-819125 us Now, before Clemens was nice enough to post that program, I posed the same question on the M-Audio.com forums: http://forums.m-audio.com/showthread.php?p=38192 The response seems to suggest that the card should support more formats. Or perhaps I'm misreading the responses (or the tech that answered the question doesn't really understand my question). Thoughts? The hw supports the 32-bit format natively only. All other formats must be converted to this format in applications or alsa-lib (using plughw / plug / linear plugins). Jaroslav - Jaroslav Kysela pe...@perex.cz Linux Kernel Sound Maintainer ALSA Project, Red Hat, Inc. -- The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your production scanning environment may not be a perfect world - but thanks to Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com ___ Alsa-user mailing list Alsa-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/alsa-user
Re: [Alsa-user] query alsa for supported sample rates and formats?
Matt Garman wrote: Is there a way to query alsa to see what sample rates and formats the sound hardware natively supports? Try the attached program. HTH Clemens /* * hw_params.c - print hardware capabilities * * compile with: gcc -o hw_params hw_params.c -lasound */ #include stdio.h #include alsa/asoundlib.h #define ARRAY_SIZE(a) (sizeof(a) / sizeof *(a)) static const snd_pcm_access_t accesses[] = { SND_PCM_ACCESS_MMAP_INTERLEAVED, SND_PCM_ACCESS_MMAP_NONINTERLEAVED, SND_PCM_ACCESS_MMAP_COMPLEX, SND_PCM_ACCESS_RW_INTERLEAVED, SND_PCM_ACCESS_RW_NONINTERLEAVED, }; static const snd_pcm_format_t formats[] = { SND_PCM_FORMAT_S8, SND_PCM_FORMAT_U8, SND_PCM_FORMAT_S16_LE, SND_PCM_FORMAT_S16_BE, SND_PCM_FORMAT_U16_LE, SND_PCM_FORMAT_U16_BE, SND_PCM_FORMAT_S24_LE, SND_PCM_FORMAT_S24_BE, SND_PCM_FORMAT_U24_LE, SND_PCM_FORMAT_U24_BE, SND_PCM_FORMAT_S32_LE, SND_PCM_FORMAT_S32_BE, SND_PCM_FORMAT_U32_LE, SND_PCM_FORMAT_U32_BE, SND_PCM_FORMAT_FLOAT_LE, SND_PCM_FORMAT_FLOAT_BE, SND_PCM_FORMAT_FLOAT64_LE, SND_PCM_FORMAT_FLOAT64_BE, SND_PCM_FORMAT_IEC958_SUBFRAME_LE, SND_PCM_FORMAT_IEC958_SUBFRAME_BE, SND_PCM_FORMAT_MU_LAW, SND_PCM_FORMAT_A_LAW, SND_PCM_FORMAT_IMA_ADPCM, SND_PCM_FORMAT_MPEG, SND_PCM_FORMAT_GSM, SND_PCM_FORMAT_SPECIAL, SND_PCM_FORMAT_S24_3LE, SND_PCM_FORMAT_S24_3BE, SND_PCM_FORMAT_U24_3LE, SND_PCM_FORMAT_U24_3BE, SND_PCM_FORMAT_S20_3LE, SND_PCM_FORMAT_S20_3BE, SND_PCM_FORMAT_U20_3LE, SND_PCM_FORMAT_U20_3BE, SND_PCM_FORMAT_S18_3LE, SND_PCM_FORMAT_S18_3BE, SND_PCM_FORMAT_U18_3LE, SND_PCM_FORMAT_U18_3BE, }; static const unsigned int rates[] = { 5512, 8000, 11025, 16000, 22050, 32000, 44100, 48000, 64000, 88200, 96000, 176400, 192000, }; int main(int argc, char *argv[]) { const char *device_name = hw; snd_pcm_t *pcm; snd_pcm_hw_params_t *hw_params; unsigned int i; unsigned int min, max; int any_rate; int err; if (argc 1) device_name = argv[1]; err = snd_pcm_open(pcm, device_name, SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK); if (err 0) { fprintf(stderr, cannot open device '%s': %s\n, device_name, snd_strerror(err)); return 1; } snd_pcm_hw_params_alloca(hw_params); err = snd_pcm_hw_params_any(pcm, hw_params); if (err 0) { fprintf(stderr, cannot get hardware parameters: %s\n, snd_strerror(err)); snd_pcm_close(pcm); return 1; } printf(Device: %s (type: %s)\n, device_name, snd_pcm_type_name(snd_pcm_type(pcm))); printf(Access types:); for (i = 0; i ARRAY_SIZE(accesses); ++i) { if (!snd_pcm_hw_params_test_access(pcm, hw_params, accesses[i])) printf( %s, snd_pcm_access_name(accesses[i])); } putchar('\n'); printf(Formats:); for (i = 0; i ARRAY_SIZE(formats); ++i) { if (!snd_pcm_hw_params_test_format(pcm, hw_params, formats[i])) printf( %s, snd_pcm_format_name(formats[i])); } putchar('\n'); err = snd_pcm_hw_params_get_channels_min(hw_params, min); if (err 0) { fprintf(stderr, cannot get minimum channels count: %s\n, snd_strerror(err)); snd_pcm_close(pcm); return 1; } err = snd_pcm_hw_params_get_channels_max(hw_params, max); if (err 0) { fprintf(stderr, cannot get maximum channels count: %s\n, snd_strerror(err)); snd_pcm_close(pcm); return 1; } printf(Channels:); for (i = min; i = max; ++i) { if (!snd_pcm_hw_params_test_channels(pcm, hw_params, i)) printf( %u, i); } putchar('\n'); err = snd_pcm_hw_params_get_rate_min(hw_params, min, NULL); if (err 0) { fprintf(stderr, cannot get minimum rate: %s\n, snd_strerror(err)); snd_pcm_close(pcm); return 1; } err = snd_pcm_hw_params_get_rate_max(hw_params, max, NULL); if (err 0) { fprintf(stderr, cannot get maximum rate: %s\n, snd_strerror(err)); snd_pcm_close(pcm); return 1; } printf(Sample rates:); if (min == max) printf( %u, min); else if (!snd_pcm_hw_params_test_rate(pcm, hw_params, min + 1, 0)) printf( %u-%u, min, max);
Re: [Alsa-user] query alsa for supported sample rates and formats?
On Fri, Apr 17, 2009 at 10:14:16AM +0200, Clemens Ladisch wrote: Matt Garman wrote: Is there a way to query alsa to see what sample rates and formats the sound hardware natively supports? Try the attached program. Works perfectly. That's exactly what I wanted. Thank you! Matt -- Stay on top of everything new and different, both inside and around Java (TM) technology - register by April 22, and save $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco. 300 plus technical and hands-on sessions. Register today. Use priority code J9JMT32. http://p.sf.net/sfu/p ___ Alsa-user mailing list Alsa-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/alsa-user
[Alsa-user] query alsa for supported sample rates and formats?
Is there a way to query alsa to see what sample rates and formats the sound hardware natively supports? Thanks, Matt -- Stay on top of everything new and different, both inside and around Java (TM) technology - register by April 22, and save $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco. 300 plus technical and hands-on sessions. Register today. Use priority code J9JMT32. http://p.sf.net/sfu/p ___ Alsa-user mailing list Alsa-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/alsa-user
Re: [Alsa-user] query alsa for supported sample rates and formats?
On Thu, 16 Apr 2009 10:49:28 -0500 Matt Garman matthew.gar...@gmail.com wrote: Is there a way to query alsa to see what sample rates and formats the sound hardware natively supports? Thanks, Matt Something like this: cat /proc/asound/card0/codec#0 Codec: Realtek ALC883 Address: 0 Vendor Id: 0x10ec0883 Subsystem Id: 0x1458e601 Revision Id: 0x0 No Modem Function Group found Default PCM: rates [0x560]: 44100 48000 96000 192000 bits [0xe]: 16 20 24 formats [0x1]: PCM Default Amp-In caps: N/A Default Amp-Out caps: N/A Node 0x02 [Audio Output] wcaps 0x11: Stereo PCM: rates [0x560]: 44100 48000 96000 192000 bits [0xe]: 16 20 24 formats [0x1]: PCM Node 0x03 [Audio Output] wcaps 0x11: Stereo PCM: rates [0x560]: 44100 48000 96000 192000 bits [0xe]: 16 20 24 formats [0x1]: PCM Node 0x04 [Audio Output] wcaps 0x11: Stereo PCM: rates [0x560]: 44100 48000 96000 192000 bits [0xe]: 16 20 24 formats [0x1]: PCM Node 0x05 [Audio Output] wcaps 0x11: Stereo PCM: rates [0x560]: 44100 48000 96000 192000 bits [0xe]: 16 20 24 formats [0x1]: PCM Node 0x06 [Audio Output] wcaps 0x211: Stereo Digital PCM: rates [0x560]: 44100 48000 96000 192000 bits [0x1e]: 16 20 24 32 formats [0x1]: PCM Node 0x07 [Vendor Defined Widget] wcaps 0xf0: Mono Node 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In Amp-In caps: ofs=0x08, nsteps=0x1f, stepsize=0x05, mute=1 Amp-In vals: [0x00 0x00] PCM: rates [0x160]: 44100 48000 96000 bits [0x6]: 16 20 formats [0x1]: PCM Connection: 1 0x23 Node 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In Amp-In caps: ofs=0x08, nsteps=0x1f, stepsize=0x05, mute=1 Amp-In vals: [0x00 0x00] PCM: rates [0x160]: 44100 48000 96000 bits [0x6]: 16 20 formats [0x1]: PCM Connection: 1 0x22 Node 0x0a [Audio Input] wcaps 0x100391: Stereo Digital PCM: rates [0x560]: 44100 48000 96000 192000 bits [0x1e]: 16 20 24 32 formats [0x1]: PCM Connection: 1 0x1f Node 0x0b [Audio Mixer] wcaps 0x20010b: Stereo Amp-In Amp-In caps: ofs=0x17, nsteps=0x1f, stepsize=0x05, mute=1 Amp-In vals: [0x80 0x80] [0x9d 0x9d] [0x00 0x00] [0x00 0x00] [0x17 0x17] [0x15 0x15] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] Connection: 10 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x14 0x15 0x16 0x17 Node 0x0c [Audio Mixer] wcaps 0x20010f: Stereo Amp-In Amp-Out Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-In vals: [0x00 0x00] [0x00 0x00] Amp-Out caps: ofs=0x1f, nsteps=0x1f, stepsize=0x05, mute=0 Amp-Out vals: [0x13 0x13] Connection: 2 0x02 0x0b Node 0x0d [Audio Mixer] wcaps 0x20010f: Stereo Amp-In Amp-Out Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-In vals: [0x80 0x80] [0x80 0x80] Amp-Out caps: ofs=0x1f, nsteps=0x1f, stepsize=0x05, mute=0 Amp-Out vals: [0x00 0x00] Connection: 2 0x03 0x0b Node 0x0e [Audio Mixer] wcaps 0x20010f: Stereo Amp-In Amp-Out Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-In vals: [0x00 0x00] [0x00 0x00] Amp-Out caps: ofs=0x1f, nsteps=0x1f, stepsize=0x05, mute=0 Amp-Out vals: [0x00 0x0a] Connection: 2 0x04 0x0b Node 0x0f [Audio Mixer] wcaps 0x20010f: Stereo Amp-In Amp-Out Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-In vals: [0x00 0x00] [0x00 0x00] Amp-Out caps: ofs=0x1f, nsteps=0x1f, stepsize=0x05, mute=0 Amp-Out vals: [0x00 0x00] Connection: 2 0x05 0x0b Node 0x10 [Vendor Defined Widget] wcaps 0xf0: Mono Node 0x11 [Vendor Defined Widget] wcaps 0xf0: Mono Node 0x12 [Vendor Defined Widget] wcaps 0xf0: Mono Node 0x13 [Vendor Defined Widget] wcaps 0xf0: Mono Node 0x14 [Pin Complex] wcaps 0x40018f: Stereo Amp-In Amp-Out Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0 Amp-In vals: [0x00 0x00] [0x00 0x00] [0x00 0x00] [0x00 0x00] [0x00 0x00] Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-Out vals: [0x00 0x00] Pincap 0x083e: IN OUT HP Detect Pin Default 0x01014410: [Jack] Line Out at Ext Rear Conn = 1/8, Color = Green Pin-ctls: 0x40: OUT Connection: 5 0x0c* 0x0d 0x0e 0x0f 0x26 Node 0x15 [Pin Complex] wcaps 0x40018f: Stereo Amp-In Amp-Out Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0 Amp-In vals: [0x00 0x00] [0x00 0x00] [0x00 0x00] [0x00 0x00] [0x00 0x00] Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-Out vals: [0x00 0x00] Pincap 0x083e: IN OUT HP Detect Pin Default 0x01011412: [Jack] Line Out at Ext Rear Conn = 1/8, Color = Black Pin-ctls: 0x40: OUT Connection: 5 0x0c 0x0d* 0x0e 0x0f 0x26 Node 0x16 [Pin Complex] wcaps 0x40018f: Stereo Amp-In Amp-Out Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0 Amp-In vals: [0x00 0x00] [0x00 0x00] [0x00 0x00] [0x00 0x00] [0x00 0x00] Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-Out vals: [0x00 0x00] Pincap 0x083e: IN OUT HP Detect Pin Default
Re: [Alsa-user] query alsa for supported sample rates and formats?
On Thu, Apr 16, 2009 at 07:13:33PM +0300, Sergei Steshenko wrote: On Thu, 16 Apr 2009 10:49:28 -0500 Matt Garman matthew.gar...@gmail.com wrote: Is there a way to query alsa to see what sample rates and formats the sound hardware natively supports? Something like this: cat /proc/asound/card0/codec#0 ... I snooped around in /proc/asound on two different machines, and couldn't find that exact file or even a comparable one. -Matt -- Stay on top of everything new and different, both inside and around Java (TM) technology - register by April 22, and save $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco. 300 plus technical and hands-on sessions. Register today. Use priority code J9JMT32. http://p.sf.net/sfu/p ___ Alsa-user mailing list Alsa-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/alsa-user
Re: [Alsa-user] query alsa for supported sample rates and formats?
On Thu, 16 Apr 2009 12:50:34 -0500 Matt Garman matthew.gar...@gmail.com wrote: On Thu, Apr 16, 2009 at 07:13:33PM +0300, Sergei Steshenko wrote: On Thu, 16 Apr 2009 10:49:28 -0500 Matt Garman matthew.gar...@gmail.com wrote: Is there a way to query alsa to see what sample rates and formats the sound hardware natively supports? Something like this: cat /proc/asound/card0/codec#0 ... I snooped around in /proc/asound on two different machines, and couldn't find that exact file or even a comparable one. -Matt Try to play something - maybe this or similar file is created when a device is active. And look into any file which appears to be text one. Regards, Sergei. -- Stay on top of everything new and different, both inside and around Java (TM) technology - register by April 22, and save $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco. 300 plus technical and hands-on sessions. Register today. Use priority code J9JMT32. http://p.sf.net/sfu/p ___ Alsa-user mailing list Alsa-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/alsa-user