LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-06-2012, 12:53 AM   #1
kishoreinme
LQ Newbie
 
Registered: Jun 2008
Posts: 7

Rep: Reputation: 0
Routing Audio PCM data from ttyUSB0 to ALSA


Hello

I have a ttyUSB0 serial device which gives signed 16 bit PCM data at 8000 hz. I am able to capture this data by


cat /dev/ttyUSB0 > capture.raw

in the terminal and play it using audacity.


How do I redirect the sound directly to an audio device using ALSA or any other mode?
 
Old 01-06-2012, 01:17 AM   #2
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
You could always perform the following to route to /dev/dsp:
Code:
modprobe snd-pcm-oss
After that, you could do something like the following:
Code:
cat /dev/ttyUSB0 > /dev/dsp
-OR-
cat capture.raw | /dev/dsp
Please note that they are rough examples; You can redirect anything to /dev/dsp, and it will result in outputting to your pcm device - in this case, alsa or jack.

Cheers,

Josh
 
Old 01-06-2012, 04:14 AM   #3
kishoreinme
LQ Newbie
 
Registered: Jun 2008
Posts: 7

Original Poster
Rep: Reputation: 0
Hello corp769

Thanks for the reply. By googling I interpret that you have suggested to emulate OSS. I have installed alsa-oss package.
I am on ubuntu 10.10
I tried the
Code:
modprobe snd-pcm-oss
it fails
Code:
FATAL: Module snd_pcm_oss not found.
 
Old 01-06-2012, 04:43 AM   #4
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Read here - http://www.linuxquestions.org/questi...0-10-a-862717/

Cheers,

Josh
 
1 members found this post helpful.
Old 01-06-2012, 05:46 AM   #5
kishoreinme
LQ Newbie
 
Registered: Jun 2008
Posts: 7

Original Poster
Rep: Reputation: 0
Thanks. I am now rebuilding my kernel with OSS modules. let me report after its done.
BTW the linux audio architecture seems to be complicated. Now I need both OSS and ALSA on my system to attain my intended purpose to play PCM from ttyUSB, which is a test run. My actual target is the Android platform which has ALSA and I am not sure how it supports OSS. Any thoughts on this ?
 
Old 01-06-2012, 06:09 AM   #6
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Ahh, you should have said that before. I was just giving you a quick and dirty, yet simple way of doing so. Let me get back right back to you, I need to do a few things quick since I just got home from work, and it's my three day weekend
 
Old 01-06-2012, 06:16 AM   #7
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
And once again, I was thinking about something else before. With alsa, you can use the aplay command for something like this. Take the following example:
Code:
cat /dev/urandom | aplay
This will give you a bunch of white noise. Play with this, and get it to how you want it with your device.

Cheers,

Josh
 
1 members found this post helpful.
Old 01-06-2012, 08:18 AM   #8
kishoreinme
LQ Newbie
 
Registered: Jun 2008
Posts: 7

Original Poster
Rep: Reputation: 0
Aplay worked as you have explained. And regarding android,ALSA has a defined interface to the Audioflinger service. If my ttyUSB talks to ALSA, then I thinks android would take it further. Am I right? and if so the ALSA-PCM connection is to be looked into further i hope.
 
Old 01-12-2012, 05:59 AM   #9
kishoreinme
LQ Newbie
 
Registered: Jun 2008
Posts: 7

Original Poster
Rep: Reputation: 0
Can I get some more help here?

using .asoundrc Is it possible to register my /dev/ttyUSB serial as a PCM device with ALSA ?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
PCM API to write audio data to sound card at kernel level yethish Linux - Newbie 1 05-27-2011 03:32 PM
Importing data from /dev/ttyUSB0 RVDowning Mandriva 1 06-29-2006 08:06 PM
alsa - missing pcm JurajPsycho Linux - Software 2 03-30-2005 05:16 AM
PCM anyone? (alsa) dhbiker Slackware 9 04-21-2004 06:52 AM
No PCM through ALSA wuck Linux - Software 1 11-07-2003 07:23 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:59 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration