Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Jan 2010 14:31:05 -0800
From:      Gary Kline <kline@thought.org>
To:        Dan Nelson <dnelson@allantgroup.com>
Cc:        Glen Barber <glen.j.barber@gmail.com>, freebsd-questions@freebsd.org
Subject:   Re: any port use /dev/dsp directly?
Message-ID:  <20100114223105.GA84284@thought.org>
In-Reply-To: <20100114211947.GB5651@dan.emsphone.com>
References:  <20100114012059.GA3921@thought.org> <20100114013746.GB67999@orion.hsd1.pa.comcast.net> <20100114024242.GA9744@thought.org> <20100114165717.GA5651@dan.emsphone.com> <20100114201616.GA73961@thought.org> <20100114211947.GB5651@dan.emsphone.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Jan 14, 2010 at 03:19:47PM -0600, Dan Nelson wrote:
> In the last episode (Jan 14), Gary Kline said:
> > On Thu, Jan 14, 2010 at 10:57:17AM -0600, Dan Nelson wrote:
> > > In the last episode (Jan 13), Gary Kline said:
> > > > On Wed, Jan 13, 2010 at 08:37:46PM -0500, Glen Barber wrote:
> > > > > Gary Kline wrote: 
> > > > > > I have a couple short programs where I mess with /dev/dsp.  I'll
> > > > > > open check to be sure the speed is right, open in mono or stereo,
> > > > > > &c.  is there anything is ports that uses this dev by opening, doing
> > > > > > ioctls and so forth?
> > > 
> > > A better way to play wav files would be to install the sox port and use
> > > its included "play" command, which will parse the wav file format and
> > > only send the audio data to /dev/dsp.  It'll also play compressed audio
> > > files (mp3, or other non-raw wav encodings).
> > 
> > the hiss at the end probably is due to whatever metadata at the end of my
> > WAV file.  Can sox translate this file into a raw byte-stream of data that
> > I can cat of write() into the device?
> 
> Didn't I just say that in the paragaph above? :)  The sox port comes with
> its own "play" command that can parse many containers and encodings,
> including wav files.


	I did see that.  I'm wondering of theses is some sox translation that 
	would do say 

	%sox -w WAV -r [rawoutfile]

	I found that using your code, or part of it, I can do very nearly what
	my own dspplayer.c was doing.  Only yours works and mine works with the
	hiss.  I'm only using the dev/dsp part of your program; it reads from
	stdin; I.... well, I'm not sure where I screwup.... rats.


	time to take printouts and go in a corner and see why my 109-lines
	fails.  --Of course, it worked before to create two flawless sine
	waves.  I modified it, but not correctly.  

	Meanwhile, I've rebuilt sox and will poke it with a stick!


> 
> > (I thought that /dev/dsp was associated with the *.WAV files ... but
> > evidently not.)
> 
> Well, it's an audio device, and wav files contain audio data, but that's
> about it.  The driver doesn't parse its input looking for file headers or
> anything.  If you're lucky and /dev/dsp's default settings happen to match
> the format of a raw-encoded wav file, then you can cat your file to
> /dev/dsp.  But otherwise you'll get static.  Try catting any of the sample
> wavs at http://en.wikipedia.org/wiki/WAV to /dev/dsp and see how many sound
> good.
> 

	Wow, great; thanks for the pointer...


> -- 
> 	Dan Nelson
> 	dnelson@allantgroup.com

-- 
 Gary Kline  kline@thought.org  http://www.thought.org  Public Service Unix
        http://jottings.thought.org   http://transfinite.thought.org
    The 7.79a release of Jottings: http://jottings.thought.org/index.php




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100114223105.GA84284>