Skip to contentSkip to conversation

trace PCM data from usb bus to alsa lib

DISCUSSION ZeroCluo 2 participants 6 messages Jun 17, 2009 – Jun 18, 2009 1 message not in the archive

lore
Share & tools
lore

ZeroCluo

author
#0 lore raw

Hi

I am trying to trace the Audio data from usb bus.
in kernel:
dump data in retire_capture_urb() ,found data format is like:
AABB 0000 CCDD 0000 ;

but in alsa library ,
dump data in snd_pcm_mmap_begin(),the "0000" is cut,only "AABB CCDD",

Do you know when and where those "0000" is cut?

btw,use mmap method map dma_area to user space; and use snd_pcm_readi to get audio data;

Thank you very very much.

Best Regards,
Zero

#1 lore raw

At Wed, 17 Jun 2009 07:25:25 +0000 (UTC),

Quoted 8 lines · ZeroCluo

Hi

I am trying to trace the Audio data from usb bus.
in kernel:
dump data in retire_capture_urb() ,found data format is like:
AABB 0000 CCDD 0000 ;

Quoted 4 lines

but in alsa library ,
dump data in snd_pcm_mmap_begin(),the "0000" is cut,only "AABB CCDD",

Do you know when and where those "0000" is cut?

Are you using the native format that the hardware runs?

Takashi

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw

At Wed, 17 Jun 2009 16:10:26 +0800,

Quoted 4 lines · Zero Luo

Dear Takashi,

   Data from usb dongle is 16K*16 bit PCM data.

And what is the format and channels you are using in alsa-lib? alsa-lib itself can convert formats and channels automatically if needed.

Takashi

Quoted 22 lines

2009/6/17, Takashi Iwai <[email protected]>:

At Wed, 17 Jun 2009 07:25:25 +0000 (UTC),
ZeroCluo wrote:
>
> Hi
>
>   I am trying to trace the Audio data from usb bus.
> in kernel:
> dump data in retire_capture_urb() ,found data format is like:
> AABB 0000 CCDD 0000 ;
>
> but in alsa library ,
> dump data in snd_pcm_mmap_begin(),the "0000" is cut,only "AABB CCDD", >
> Do you know when and where those "0000" is cut?

Are you using the native format that the hardware runs?

Takashi

author
#4 lore raw
Quoted 4 lines · Takashi Iwai <tiwai <at> suse.de> writes:

At Wed, 17 Jun 2009 16:10:26 +0800,

Quoted 1 line · Zero Luo
Quoted 8 lines
Quoted 3 lines

Dear Takashi,

   Data from usb dongle is 16K*16 bit PCM data.

And what is the format and channels you are using in alsa-lib? alsa-lib itself can convert formats and channels automatically if needed.

Takashi

In alsa-lib ,I set data format as 8K * mulaw .

        hwparams.format = SND_PCM_FORMAT_MU_LAW;
        hwparams.rate = 8000;
        hwparams.channels = 1;

Yes,indeed alsa-lib help to convert formats.But before alsa-lib convert pcm
data to mulaw,I dumped the src data in snd_pcm_mulaw_encode() which already has no "0000" .

Zero

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#5 lore raw

At Wed, 17 Jun 2009 08:33:15 +0000 (UTC),

Quoted 17 lines · ZeroCluo
Quoted 4 lines · Takashi Iwai <tiwai <at> suse.de> writes:

At Wed, 17 Jun 2009 16:10:26 +0800,

Quoted 1 line · Zero Luo
Quoted 8 lines
Quoted 3 lines

Dear Takashi,

   Data from usb dongle is 16K*16 bit PCM data.

And what is the format and channels you are using in alsa-lib? alsa-lib itself can convert formats and channels automatically if needed.

Takashi

Quoted 7 lines

In alsa-lib ,I set data format as 8K * mulaw .

        hwparams.format = SND_PCM_FORMAT_MU_LAW;
        hwparams.rate = 8000;
        hwparams.channels = 1;

Yes,indeed alsa-lib help to convert formats.But before alsa-lib convert pcm
data to mulaw,I dumped the src data in snd_pcm_mulaw_encode() which already has no "0000" .

Well, another question is whether the output result is correct. Did you get broken output or so?

Takashi

author
#6 lore raw
Quoted 6 lines

Well, another question is whether the output result is correct. Did you get broken output or so?

Takashi

First,thanks for your reply.

Output should be correct.I can hear smooth voice. It real confuse me...

Zero