From owner-freebsd-questions@FreeBSD.ORG Thu Jan 14 21:19:50 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 495E0106566C for ; Thu, 14 Jan 2010 21:19:50 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: from email1.allantgroup.com (email1.emsphone.com [199.67.51.115]) by mx1.freebsd.org (Postfix) with ESMTP id 097A68FC0C for ; Thu, 14 Jan 2010 21:19:49 +0000 (UTC) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by email1.allantgroup.com (8.14.0/8.14.0) with ESMTP id o0ELJmtG079007 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 14 Jan 2010 15:19:49 -0600 (CST) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (smmsp@localhost [127.0.0.1]) by dan.emsphone.com (8.14.4/8.14.3) with ESMTP id o0ELJm0V059087 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 14 Jan 2010 15:19:48 -0600 (CST) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.14.4/8.14.3/Submit) id o0ELJlqT059084; Thu, 14 Jan 2010 15:19:47 -0600 (CST) (envelope-from dan) Date: Thu, 14 Jan 2010 15:19:47 -0600 From: Dan Nelson To: Gary Kline Message-ID: <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100114201616.GA73961@thought.org> X-OS: FreeBSD 7.2-STABLE User-Agent: Mutt/1.5.20 (2009-06-14) X-Virus-Scanned: clamav-milter 0.95.3 at email1.allantgroup.com X-Virus-Status: Clean X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0.2 (email1.allantgroup.com [199.67.51.78]); Thu, 14 Jan 2010 15:19:49 -0600 (CST) X-Scanned-By: MIMEDefang 2.45 Cc: Glen Barber , freebsd-questions@freebsd.org Subject: Re: any port use /dev/dsp directly? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jan 2010 21:19:50 -0000 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 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. -- Dan Nelson dnelson@allantgroup.com