From owner-freebsd-questions@FreeBSD.ORG Thu Jan 14 09:35:06 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 CEFDB106566B for ; Thu, 14 Jan 2010 09:35:06 +0000 (UTC) (envelope-from freebsd-questions@m.gmane.org) Received: from lo.gmane.org (lo.gmane.org [80.91.229.12]) by mx1.freebsd.org (Postfix) with ESMTP id 8AA818FC0A for ; Thu, 14 Jan 2010 09:35:06 +0000 (UTC) Received: from list by lo.gmane.org with local (Exim 4.50) id 1NVM6Z-00013V-TY for freebsd-questions@freebsd.org; Thu, 14 Jan 2010 10:35:03 +0100 Received: from lara.cc.fer.hr ([161.53.72.113]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 14 Jan 2010 10:35:03 +0100 Received: from ivoras by lara.cc.fer.hr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 14 Jan 2010 10:35:03 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: freebsd-questions@freebsd.org From: Ivan Voras Date: Thu, 14 Jan 2010 10:33:01 +0100 Lines: 46 Message-ID: References: <20100114012059.GA3921@thought.org> <20100114013746.GB67999@orion.hsd1.pa.comcast.net> <20100114024242.GA9744@thought.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: lara.cc.fer.hr User-Agent: Thunderbird 2.0.0.23 (X11/20091210) In-Reply-To: <20100114024242.GA9744@thought.org> Sender: news 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 09:35:06 -0000 Gary Kline wrote: > 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. >> >> Regards, >> > > > 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. > > Anybody seen anything like this? Doesn't hurt to ask, given the > brainpower on this list. But this may be something I have got to > figure out. > > (There doesn't seem to be any way of getting rid of that annoying > HISS. ... .) I have no idea how /dev/dsp really works but what you say sounds like there is some canonical buffer size it expects - like 64 kB or something like that, and it (wrongly) interprets garbage memory past your write as sound data. Try creating a larger buffer and fill the memory past the end of your sound with zeroes.