LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > *BSD
User Name
Password
*BSD This forum is for the discussion of all BSD variants.
FreeBSD, OpenBSD, NetBSD, etc.

Notices


Reply
  Search this Thread
Old 10-06-2005, 01:23 PM   #1
player_2
Member
 
Registered: Aug 2003
Posts: 57

Rep: Reputation: 15
Catting Sound to /dev/dsp


I've googled for days now and all I can find are people who have the same problem as I do: no matter what audio format/endianness I choose from cdparanoia, catting it to /dev/dsp just gives me static. I've tried the following:

cdparanoia -p 1 - > /dev/dsp
cdparanoia -p 1 - > /dev/audio0.0
cdparanoia -w 1 - > /dev/dsp
cdparanoia -w 1 - > /dev/audio0.0
cdparanoia -p 1 snd.raw ; cat snd.raw > /dev/dsp ; cat snd.raw > /dev/audio0.0
cdparanoia -w 1 snd.wav ; cat snd.wav > /dev/dsp ; cat snd.wav > /dev/audio0.0
cdparanoia -pr 1 snd.raw ; cat snd.raw > /dev/dsp
cdparanoia -pR 1 snd.raw ; cat snd.raw > /dev/dsp
cdparanoia -wc 1 snd.wav ; cat snd.wav > /dev/dsp
cdparanoia -wC 1 snd.wav ; cat snd.wav > /dev/dsp

Static every time. I really want to run the CD output digitally (not through AC97) because that allows me to process it in the middle of the stream. Any suggestions?

Last edited by player_2; 10-06-2005 at 08:03 PM.
 
Old 10-06-2005, 05:37 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Doing a "cat" of sound is news to me but then again I use Linux for commercial purposes.

Just wanted to note that the "cat" command itself basically displays the the contents of a file. (Type "cat /etc/passwd" to see your passwd file's contents.)

Anyway from what you wrote it seems you may be trying to redirect the output of your sound file to the /dev/dsp device. While I can't comment on whether that should work I can say that the syntax "cat snd.raw /dev/dsp" wouldn't do that. It would try to cat both the file snd.raw AND the device file /dev/dsp. (Like typing "cat /etc/passwd /etc/fstab" would show you the contents of those files.)

To cat snd.raw INTO /dev/dsp you'd need a redirect so would need to type:
cat snd.raw > /dev/dsp

NOTE: I have no idea what catting into /dev/dsp would do since I don't know what /dev/dsp is. Just noting correct usage of the cat command. Try the above at your own risk.

Also just notes on what you wrote (I don't know what cdparanoia command is so just making assumptions based on general usages of commands and arguments:

The "- >" to me in your first few examples suggests you're telling cdparanoia to use stdin or stdout (the "-") then telling it to redirect to the device file (dsp, audiot0.0 etc...) - Not impossibile but kind of odd for a command - if you're doing redirect out (the ">" then it implies the "-" must be stdin as the redirect is defining stdout. The problem is that you're not giving it any input and with that syntax I don't see how it would know to wait for any.

It seems likely that you need either the "-" or the ">" but not both.
 
Old 10-06-2005, 07:44 PM   #3
player_2
Member
 
Registered: Aug 2003
Posts: 57

Original Poster
Rep: Reputation: 15
I coulda sworn I had those angle brackets in there... anyway, I had the syntax right (cat snd.raw > /dev/dsp). The data's getting to the soundcard alright, but apparently not in the right format, hence the squealing.

Nice catch though.

Anyway, here's the logic:

cdparanoia [options] tracks outfile

If options contains -p, then it outputs raw data to outfile. If it contains -w, it outputs MS RIFF/WAV data. -c means force reading the data as little-endian, and -C means force reading as big-endian. tracks specifies the tracks to play (same way the -c parameter to cut works... 1- means play all tracks, etc). outfile specifies the name of the file to write (- means write to stdout).

Theoretically (and the way it works on Linux) /dev/dsp is a character device which represents the soundcard. Reading from /dev/dsp reads from the recording mixer (mixture of line-in and microphone), writing to /dev/dsp writes to the output mixer (mono, stereo, 5.1, whatever the case may be). There's a buffer-size limit on /dev/dsp so that writing/reading doesn't cause over/underflow.

Now, theoretically, that means that reading raw audio from the CD (even at speeds faster than realtime, as cdparanoia does) should be able to be piped to /dev/dsp, since /dev/dsp will only accept data at the correct rate.

Or does it? I've seen many Linux tutorials that make reference to catting a sound file to /dev/dsp. Why would *BSD be any different?

Last edited by player_2; 10-06-2005 at 08:03 PM.
 
Old 10-07-2005, 07:30 AM   #4
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Because BSD descended from Berkley Unix and Linux was started as a clone written from scratch? Also there are variations in Unix world - Berkley was the Unix that was given by AT&T to universities and modified by them (mostly by Berkley hence the name). Sys V was the AT&T commercial side of things. Much of Unix/Linux now does things the Sys V way but someone pointed out in another thread that some of the Linux distros don't.

Anyway I guess I should ask because its possible the device files would be different in BSD: Have you verified /dev/dsp and /dev/audio* are actually device files? (That is do you see a c or a b in the first character of permissions when you ls -l on them?) Since Unix/Linux does what you tell it then its possible your redirects into these files are in fact just adding to real files rather than device files.
 
Old 10-07-2005, 08:12 AM   #5
player_2
Member
 
Registered: Aug 2003
Posts: 57

Original Poster
Rep: Reputation: 15
They're device files, just like on most Linux distros, because it's OSS.
 
  


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
devfs and devfsd don't create /dev/dsp or /dev/sound/dsp ? behmjose Linux - Hardware 2 10-02-2006 12:27 PM
no sound from /dev/dsp Dargason Linux - Software 24 01-06-2006 02:49 PM
No sound (/dev/dsp) in new X session Doum Mandriva 2 08-03-2004 07:19 PM
No sound but /dev/dsp present meldar Linux - Hardware 7 03-06-2004 02:15 PM
sound : /dev/dsp j-charles Linux - Newbie 4 02-28-2002 03:31 PM

LinuxQuestions.org > Forums > Other *NIX Forums > *BSD

All times are GMT -5. The time now is 02:09 AM.

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