* issue at 44.1 Khz capturing
@ 2009-08-10 10:06 Harsha, Priya
2009-08-10 10:14 ` James Courtier-Dutton
2009-08-10 11:51 ` Clemens Ladisch
0 siblings, 2 replies; 5+ messages in thread
From: Harsha, Priya @ 2009-08-10 10:06 UTC (permalink / raw)
To: alsa-devel@alsa-project.org
Hi,
I am using arecord for capturing data. When I try to record at 8 or 48 KHz, it's perfectly fine. But when I try to record at 44.1 Khz, there are spikes in the recorded data for every buffer. When I tried to tap the data captured at the firmware/hardware end, it's smooth but the same data when is checked from the user space after being recorded, it has spikes. On further analysis, looks like for every buffer recorded there is either 1 sample recorded extra or 1 sample dropped. But when I printed out the values passed from the pointer function, they are exactly at the intervals of 5513 bytes.
Can anyone give me any clue as to what is going wrong? I am using indirect_* functions in the driver code. Is there any buffer size round off that is giving this error? Can I handle something in the driver to avoid this?
Thanks,
Harsha.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: issue at 44.1 Khz capturing
2009-08-10 10:06 issue at 44.1 Khz capturing Harsha, Priya
@ 2009-08-10 10:14 ` James Courtier-Dutton
2009-08-10 11:51 ` Clemens Ladisch
1 sibling, 0 replies; 5+ messages in thread
From: James Courtier-Dutton @ 2009-08-10 10:14 UTC (permalink / raw)
To: Harsha, Priya; +Cc: alsa-devel@alsa-project.org
2009/8/10 Harsha, Priya <priya.harsha@intel.com>:
> Hi,
>
> I am using arecord for capturing data. When I try to record at 8 or 48 KHz, it's perfectly fine. But when I try to record at 44.1 Khz, there are spikes in the recorded data for every buffer. When I tried to tap the data captured at the firmware/hardware end, it's smooth but the same data when is checked from the user space after being recorded, it has spikes. On further analysis, looks like for every buffer recorded there is either 1 sample recorded extra or 1 sample dropped. But when I printed out the values passed from the pointer function, they are exactly at the intervals of 5513 bytes.
>
> Can anyone give me any clue as to what is going wrong? I am using indirect_* functions in the driver code. Is there any buffer size round off that is giving this error? Can I handle something in the driver to avoid this?
>
A lot of sound card hardware cannot work at anything other than 48kHz.
alsa is therefore resampling to the applications rate. In this case
trying to get 44.1kHz.
It is very difficult with the current alsa architecture to get good
quality resampling.
I would advise you to record at 48kHz and use something like SOX
afterwards, to get 44.1kHz. Note that also sound cards are not good at
playing 44.1kHz because the same resampling happens. So keeping
everything at 48kHz now days is probably best.
Kind Regards
James
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: issue at 44.1 Khz capturing
2009-08-10 10:06 issue at 44.1 Khz capturing Harsha, Priya
2009-08-10 10:14 ` James Courtier-Dutton
@ 2009-08-10 11:51 ` Clemens Ladisch
2009-08-10 13:12 ` Harsha, Priya
1 sibling, 1 reply; 5+ messages in thread
From: Clemens Ladisch @ 2009-08-10 11:51 UTC (permalink / raw)
To: Harsha, Priya; +Cc: alsa-devel@alsa-project.org
Harsha, Priya wrote:
> ... But when I printed out the values passed from the pointer function,
> they are exactly at the intervals of 5513 bytes.
What is the exact buffer size? Half a second would be 22050 bytes
(frames?), while four of your periods are 22052 bytes.
Does your hardware support buffers whose length is not an integer
multiple of the period size?
Best regards,
Clemens
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: issue at 44.1 Khz capturing
2009-08-10 11:51 ` Clemens Ladisch
@ 2009-08-10 13:12 ` Harsha, Priya
2009-08-10 13:34 ` Clemens Ladisch
0 siblings, 1 reply; 5+ messages in thread
From: Harsha, Priya @ 2009-08-10 13:12 UTC (permalink / raw)
To: Clemens Ladisch; +Cc: alsa-devel@alsa-project.org
I see that the buffer allocated is 22050 bytes (and not 22052 bytes). Yes the hardware supports buffers which are not multiple of period size.
Can I forcefully set my buffer size to 22052 bytes and allocate using snd_pcm_lib_malloc_pages and try? Will that help?
Thanks,
Harsha.
>-----Original Message-----
>From: Clemens Ladisch [mailto:clemens@ladisch.de]
>Sent: Monday, August 10, 2009 5:21 PM
>To: Harsha, Priya
>Cc: alsa-devel@alsa-project.org
>Subject: Re: [alsa-devel] issue at 44.1 Khz capturing
>
>Harsha, Priya wrote:
>> ... But when I printed out the values passed from the pointer function,
>> they are exactly at the intervals of 5513 bytes.
>
>What is the exact buffer size? Half a second would be 22050 bytes
>(frames?), while four of your periods are 22052 bytes.
>Does your hardware support buffers whose length is not an integer
>multiple of the period size?
>
>
>Best regards,
>Clemens
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: issue at 44.1 Khz capturing
2009-08-10 13:12 ` Harsha, Priya
@ 2009-08-10 13:34 ` Clemens Ladisch
0 siblings, 0 replies; 5+ messages in thread
From: Clemens Ladisch @ 2009-08-10 13:34 UTC (permalink / raw)
To: Harsha, Priya; +Cc: alsa-devel@alsa-project.org
(please don't top-post)
Harsha, Priya wrote:
> I see that the buffer allocated is 22050 bytes (and not 22052 bytes).
> Yes the hardware supports buffers which are not multiple of period size.
But there may be a (driver) bug that affects the last byte.
Try calling
snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
in the open callback.
> Can I forcefully set my buffer size to 22052 bytes
Try the --buffer-size and --period-size parameters of arecord.
HTH
Clemens
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-08-10 13:33 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-10 10:06 issue at 44.1 Khz capturing Harsha, Priya
2009-08-10 10:14 ` James Courtier-Dutton
2009-08-10 11:51 ` Clemens Ladisch
2009-08-10 13:12 ` Harsha, Priya
2009-08-10 13:34 ` 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.