All of lore.kernel.org
 help / color / mirror / Atom feed
* While recording from mono codec twice as much data is received
@ 2009-07-09 21:27 Louis Lee
  2009-07-10  9:29 ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Louis Lee @ 2009-07-09 21:27 UTC (permalink / raw)
  To: ALSA Devel


Hi everyone,
  I am able to do playback from 8 kHz samples to 48 kHz samples properly.
  However, when recording using the exact same setup for the data interface I am not getting favorable results.  For instance, if I record for 5 seconds I get output in a file for 10 seconds of audio (arecord or sox).  This results in my recording being stretched.  I change the DAI to stereo capture and record two channels and the recorded output comes back correctly (5 seconds recorded is 5 seconds).
  I'm using a wolfsom WM8974.  I'm developing using ASoC framework (can I call it that?) reusing the WM8974 codec from the Linux GIT repository.  The development is using a i.MX27.  Data interface is a SSI bus in DSP mode.  I believe my PCM code is correct since it works for playback.
  I'm stuck now.  From my understanding the clocks are setup the same way for both playback and capture.  Has anyone ran into this problem before?  The WM8974 is a mono codec so I should not have to set the DAI to stereo in order to capture data properly.
  Any help is appreciated.
Best regards,Louis
_________________________________________________________________
Attention all humans. We are your photos. Free us.
http://go.microsoft.com/?linkid=9666046

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

* Re: While recording from mono codec twice as much data is received
  2009-07-09 21:27 While recording from mono codec twice as much data is received Louis Lee
@ 2009-07-10  9:29 ` Mark Brown
  2009-07-10 20:53   ` Louis Lee
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2009-07-10  9:29 UTC (permalink / raw)
  To: Louis Lee; +Cc: ALSA Devel

On Thu, Jul 09, 2009 at 03:27:17PM -0600, Louis Lee wrote:

>   However, when recording using the exact same setup for the data
>   interface I am not getting favorable results.  For instance, if I
>   record for 5 seconds I get output in a file for 10 seconds of audio
>   (arecord or sox).  This results in my recording being stretched.  I
>   change the DAI to stereo capture and record two channels and the
>   recorded output comes back correctly (5 seconds recorded is 5
>   seconds).

This suggests that either the CODEC is configured to run at twice the
expected sample rate or that there are enough bit clocks being generated
for stereo data and the CPU DAI is trying to record data for each bit
clock cycle.  Is the CPU or the CODEC the clock master in your system?

>   I'm stuck now.  From my understanding the clocks are setup the same
>   way for both playback and capture.  Has anyone ran into this problem
>   before?  The WM8974 is a mono codec so I should not have to set the
>   DAI to stereo in order to capture data properly.

It should be possible to do what you want, yes.

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

* Re: While recording from mono codec twice as much data is received
  2009-07-10  9:29 ` Mark Brown
@ 2009-07-10 20:53   ` Louis Lee
  2009-07-16 18:26     ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Louis Lee @ 2009-07-10 20:53 UTC (permalink / raw)
  To: broonie; +Cc: ALSA Devel



> Date: Fri, 10 Jul 2009 10:29:24 +0100
> <snip...>
> 
> On Thu, Jul 09, 2009 at 03:27:17PM -0600, Louis Lee wrote:
> 
> >   However, when recording using the exact same setup for the data
> >   interface I am not getting favorable results.  For instance, if I
> >   record for 5 seconds I get output in a file for 10 seconds of audio
> >   (arecord or sox).  This results in my recording being stretched.  I
> >   change the DAI to stereo capture and record two channels and the
> >   recorded output comes back correctly (5 seconds recorded is 5
> >   seconds).
> 
> This suggests that either the CODEC is configured to run at twice the
> expected sample rate or that there are enough bit clocks being generated
> for stereo data and the CPU DAI is trying to record data for each bit
> clock cycle.  Is the CPU or the CODEC the clock master in your system?
> 
Mark, thanks again for your insights.  I believe the sample rate is correct.I can see it on the scope and FRAME frequency is equivalent to thesample rate.  I ran into a bit of a problem though.  If you are right aboutthat each bit in the clock cycle is being recorded I think I have just enoughbits in my clock for stereo data.  If I reduce it though I run into theproblem where I don't have enough bits to clock through all my data. :(
This probably seems like a complete noob question.  How exactly do I modify the CPU DAI to not account for each bit in the clock cycle?
The CODEC is the clock master in my system.
Thanks Mark!  You have been tremendous help.
> >   I'm stuck now.  From my understanding the clocks are setup the same
> >   way for both playback and capture.  Has anyone ran into this problem
> >   before?  The WM8974 is a mono codec so I should not have to set the
> >   DAI to stereo in order to capture data properly.
> 
> It should be possible to do what you want, yes.
_________________________________________________________________
Attention all humans. We are your photos. Free us.
http://go.microsoft.com/?linkid=9666047

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

* Re: While recording from mono codec twice as much data is received
  2009-07-10 20:53   ` Louis Lee
@ 2009-07-16 18:26     ` Mark Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2009-07-16 18:26 UTC (permalink / raw)
  To: Louis Lee; +Cc: ALSA Devel

On Fri, Jul 10, 2009 at 02:53:52PM -0600, Louis Lee wrote:

> Mark, thanks again for your insights.  I believe the sample rate is
> correct.I can see it on the scope and FRAME frequency is equivalent to
> thesample rate.  I ran into a bit of a problem though.  If you are right

Yup, sounds correct.

> aboutthat each bit in the clock cycle is being recorded I think I have
> just enoughbits in my clock for stereo data.  If I reduce it though I
> run into theproblem where I don't have enough bits to clock through all
> my data. :(

I'm not sure what you mean here - do you have more bits than you have
data or is there data that you don't want to record?

> This probably seems like a complete noob question.  How exactly do I
> modify the CPU DAI to not account for each bit in the clock cycle?

The best API for this if the CPU driver supports it is set_tdm_slot()
but it does depend on what the hardware can do and what the driver
supports.  I'm afraid I'm not too familiar with i.MX2x specifics here
(or the particular BSP that you've got).

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

end of thread, other threads:[~2009-07-16 18:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-09 21:27 While recording from mono codec twice as much data is received Louis Lee
2009-07-10  9:29 ` Mark Brown
2009-07-10 20:53   ` Louis Lee
2009-07-16 18:26     ` Mark Brown

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.