From owner-freebsd-questions@FreeBSD.ORG Thu Jan 14 20:16:35 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 75C14106566C for ; Thu, 14 Jan 2010 20:16:35 +0000 (UTC) (envelope-from kline@thought.org) Received: from ethic.thought.org (plato.thought.org [209.180.213.209]) by mx1.freebsd.org (Postfix) with ESMTP id 2D1628FC13 for ; Thu, 14 Jan 2010 20:16:34 +0000 (UTC) Received: from thought.org (tao.thought.org [10.47.0.250]) (authenticated bits=0) by ethic.thought.org (8.14.3/8.14.3) with ESMTP id o0EKGGeu046381; Thu, 14 Jan 2010 12:16:17 -0800 (PST) (envelope-from kline@thought.org) Received: by thought.org (nbSMTP-1.00) for uid 1002 kline@thought.org; Thu, 14 Jan 2010 12:16:17 -0800 (PST) Date: Thu, 14 Jan 2010 12:16:16 -0800 From: Gary Kline To: Dan Nelson Message-ID: <20100114201616.GA73961@thought.org> References: <20100114012059.GA3921@thought.org> <20100114013746.GB67999@orion.hsd1.pa.comcast.net> <20100114024242.GA9744@thought.org> <20100114165717.GA5651@dan.emsphone.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100114165717.GA5651@dan.emsphone.com> User-Agent: Mutt/1.4.2.3i X-Organization: Thought Unlimited. Public service Unix since 1986. X-Of_Interest: With 23 years of service to the Unix community. X-Spam-Status: No, score=-1.2 required=3.6 tests=ALL_TRUSTED,BAYES_00, FH_DATE_PAST_20XX autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on ethic.thought.org 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 20:16:35 -0000 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? > > > > > > > > I think I may need to flush my data before closing the FILE *FP. Not > > > > sure; just guessing. > > > > > > > > > > I don't know if this directly answers your question, but from sound(4): > > > > > > hw.snd.default_unit > > > Default sound card for systems with multiple sound cards. When > > > using devfs(5), the default device for /dev/dsp. Equivalent to a > > > symlink from /dev/dsp to /dev/dsp${hw.snd.default_unit}. > > > > > > FWIW, www/linux-f10-flashplugin10 is using /dev/dsp0.0 on my system at the > > > moment. > > > > Thanks, but I already read the sound man page. I am trying to emulate > > > > /bin/cat WAVEFILE > /dev/dsp > > > > which works well by opening /dev/dsp, making sure everything is set, the > > writing the bytes of the WAVEFILE thru/into the device with a write() > > call. It works, the sound echoes, but at the end is an ugly HISSing or > > FIZZZZ sound. saved the program to /tmp, thanks! > > You're probably playing an mp3-style tag at the end of the file, or some > other metadata encoded in the wav file format. /dev/dsp takes raw bytes, > and doesn't parse a file headers at all. > > 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? (I thought that /dev/dsp was associated with the *.WAV files ... but evidently not.) > > If you want a simple example of how to play a raw sound file, try this. You > can tell its age by the fact that it can play through /dev/pcaudio, but it > still works :) > Ear-to-ear!! gary > > > -- > Dan Nelson > dnelson@allantgroup.com > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org" -- 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