All of lore.kernel.org
 help / color / mirror / Atom feed
* how to convert stereo capture to mono stream (hardware incompatibility)
@ 2008-09-01 12:36 brunal
  2008-09-04 10:58 ` Clemens Ladisch
  0 siblings, 1 reply; 2+ messages in thread
From: brunal @ 2008-09-01 12:36 UTC (permalink / raw)
  To: alsa-devel

Hi all,

I've already asked my question in the alsa-user list, but as nobody  
was able to answer, I'm trying here if I have more chance.

I'm using a USB M-Audio fasttrack pro sound card under linux  
2.6.24.rt, and I want to plug it into a voice recognition software  
named Julius.

There is an implementation of alsa in Julius, but I can't make it  
working with my USB sound card, because when alsa tries to set  
channel capture to 1, I get an error from alsa. Here is the code :

  /* set number of channels */
   if ((err = snd_pcm_hw_params_set_channels(handle, hwparams, 1)) <  
0) {
     jlog("Error: adin_alsa: cannot set PCM channel to %d (%s)\n", 1,  
snd_strerror(err));
     return(FALSE);
   }
Which always return FALSE.

The thing is that when I change this line to set stereo channels,  
Julius recognition engine complains when it runs, and strip lots of  
audio packets, which seems to broke recognition.

So my question is : how can I by-pass this problem?

I've tried to do it with the .asoundrc file, but it seems that plugin  
or dmix stuff only works with playback, not recording.
Does someone have an idea how to make a recording plugin that accept  
stereo stream from hardware and output only the left channel?

I didn't understand how stereo stream are written in the audio buffer  
gave by alsa. Can someone explain me how to separate the two stream  
once it is written in the buffer?

I really thanks all who would take little attention to my questions,  
it's been 5 days I'm digging on the web but I only get code working  
for setreo applications, which doesn't help me so much.
And I know I might have an answer if I look into the audacity code,  
but it seems to me it's like using a bazooka for fishing redfish....

Best Regards,
Bruno.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: how to convert stereo capture to mono stream (hardware incompatibility)
  2008-09-01 12:36 how to convert stereo capture to mono stream (hardware incompatibility) brunal
@ 2008-09-04 10:58 ` Clemens Ladisch
  0 siblings, 0 replies; 2+ messages in thread
From: Clemens Ladisch @ 2008-09-04 10:58 UTC (permalink / raw)
  To: brunal; +Cc: alsa-devel

brunal wrote:
> There is an implementation of alsa in Julius, but I can't make it
> working with my USB sound card, because when alsa tries to set
> channel capture to 1, I get an error from alsa. Here is the code :
>
>   /* set number of channels */
>    if ((err = snd_pcm_hw_params_set_channels(handle, hwparams, 1)) < 0) {
>      jlog("Error: adin_alsa: cannot set PCM channel to %d (%s)\n", 1, snd_strerror(err));
>      return(FALSE);
>    }
> Which always return FALSE.

I'd guess this program uses a wrong device name.  Make sure that the
default device name is "default", which can automatically convert sample
formats not supported by the hardware, and not "hw".


HTH
Clemens

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-09-04 10:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-01 12:36 how to convert stereo capture to mono stream (hardware incompatibility) brunal
2008-09-04 10:58 ` Clemens Ladisch

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.