ALSA的采样频率不一致问题

51 views
Skip to first unread message

twn

unread,
Mar 30, 2011, 10:16:59 PM3/30/11
to linux...@googlegroups.com
hi,宋老师
 
  我遇到一下问题,请你看一下,给个建议
 
 电脑实时把录到的声音传到我的板子上,我的板端程序实时去放音,结果声调变得很厉害,我上网找资料说是电脑的声卡采样频率和板子的采样频率不一致造成的,大家知道怎么解决吗?


Barry Song

unread,
Mar 30, 2011, 10:44:02 PM3/30/11
to linux...@googlegroups.com, twn
tell us your audio patch , the frequency from computer and the
frequency your sound card supports.
You capture analog audio and then play this analog? or you transfer
analog audo from pc to digtal audio, then play digital audio in your
sound card?

> --
> _______________________________________________
> Linux设备驱动开发邮件列表 linux...@googlegroups.com
> http://groups.google.gr/group/linuxdriver?hl=zh-CN
> 退订请使用原订阅邮箱发邮件至:linuxdriver...@googlegroups.com
>

twn

unread,
Mar 30, 2011, 11:42:32 PM3/30/11
to linux...@googlegroups.com
电脑上的客户端程序设置成采样频率为8K,精度为16bits,每采集1024个byte就发送给我的板子的程序,我的板上设置也是8k,16bits,我用一个线程去接收这1024个byte,然后另一个线程去一边保存成文件,一边用snd_pcm_writei去播放,结果保存的文件用的COOLedit播放没有问题,但是用snd_pcm_writei在板端播放,就会出现underrun! 
 
 
 > -----原始邮件-----
> 发件人: "Barry Song" <21c...@gmail.com>
> 发送时间: 2011年3月31日 星期四
> 收件人: linux...@googlegroups.com
> 抄送: twn <twn...@163.com>
> 主题: Re: [linux-driver] ALSA的采样频率不一致问题
> 
> tell us your audio patch , the frequency from computer and the
> frequency your sound card supports.
> You capture analog audio and then play this analog? or you transfer
> analog audo from pc to digtal audio, then play digital audio in your
> sound card?
> 
> 在 2011年3月30日 下午7:16,twn <twn...@163.com> 写道:
> > hi,宋老师
> >
> >   我遇到一下问题,请你看一下,给个建议
> >
> >  电脑实时把录到的声音传到我的板子上,我的板端程序实时去放音,结果声调变得很厉害,我上网找资料说是电脑的声卡采样频率和板子的采样频率不一致造成的,大家知道怎么解决吗?
> >
> > --
> > _______________________________________________
> > Linux设备驱动开发邮件列表 linux...@googlegroups.com

崔英云

unread,
Mar 31, 2011, 11:48:58 PM3/31/11
to linux...@googlegroups.com
",我用一个线程去接收这1024个byte,然后另一个线程去一边保存成文件,一边用snd_pcm_writei去播放"
接收到的1024byte文件是不是pcm格式的?如果是的话就不用转层文件,直接用snd_pcm_writei就可以了。

而且参数都设对了嘛?  音频声道,文件的写方式 等等。  underrun可以用以上的方法提高cpu占用率,或者提高buffersize,和periodsize
Reply all
Reply to author
Forward
0 new messages