From owner-freebsd-multimedia Wed Jul 18 9:28: 1 2001 Delivered-To: freebsd-multimedia@freebsd.org Received: from kumr.lns.com (kumr.lns.com [140.174.7.1]) by hub.freebsd.org (Postfix) with ESMTP id B4BB137B406 for ; Wed, 18 Jul 2001 09:27:54 -0700 (PDT) (envelope-from pozar@kumr.lns.com) Received: (from pozar@localhost) by kumr.lns.com (8.11.3/8.9.3) id f6IGQT442834; Wed, 18 Jul 2001 09:26:29 -0700 (PDT) (envelope-from pozar) Date: Wed, 18 Jul 2001 09:26:29 -0700 From: Tim Pozar To: Brian Reichert Cc: Christoph Kukulies , multimedia@FreeBSD.ORG Subject: Re: writing a sine to a .wav Message-ID: <20010718092628.A42443@lns.com> References: <200107181542.f6IFgtl63993@gilberto.physik.rwth-aachen.de> <20010718114559.Q49286@numachi.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010718114559.Q49286@numachi.com>; from reichert@numachi.com on Wed, Jul 18, 2001 at 11:45:59AM -0400 Sender: owner-freebsd-multimedia@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org I have a quicky program that will generate the raw PCM sine audio (sans WAV headers) that you can run into SOX or write directly to /dev/dsp (OSS). It is called tonegen and is availible at: http://www.lns.com/papers/tonegen/ Functions include... tonegen: Generates a sine wave on the sound card or standard out. -a dB Sets attenuation from "all ones" in dB. Default is "0 db". -d device Sets device name. Default is "/dev/dspW". If "device" is "-" then it uses STDOUT -f Hz Sets tone in Hertz. Default is "400 Hz". -r rate Sets device sample rate in Hertz. Default is "44100 Hz". -t seconds Sets time to run. Default is infinite. The length of the tone will run over slightly until full cycle stops at a "zero crossing" to prevent clicks. It is distributed as source only and compiles on FreeBSD and Linux. On Wed, Jul 18, 2001 at 11:45:59AM -0400, Brian Reichert wrote: > On Wed, Jul 18, 2001 at 05:42:55PM +0200, Christoph Kukulies wrote: > > Does anyone know of a function (API) or whatever that allows for generating > > .wav data (or .mp3) data out of mathematical functions like sin(x),sin(2x), > > sin(3x) etc. > > Well, sox(1) seems to be the switchblade knife for sound file > conversion, and it can accept 'raw' and 'textual' data. > > .dat Text Data files > These files contain a textual representation of > the sample data. There is one line at the > beginning that contains the sample rate. Subse- > quent lines contain two numeric data items: the > time since the beginning of the sample and the > sample value. Values are normalized so that the > maximum and minimum are 1.00 and -1.00. This > file format can be used to create data files for > external programs such as FFT analyzers or graph > routines. SoX can also convert a file in this > format back into one of the other file formats. > > I have no idea if that's useful for you, though... > > > -- > > Chris Christoph P. U. Kukulies kuku@gil.physik.rwth-aachen.de > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > > with "unsubscribe freebsd-multimedia" in the body of the message > > -- > Brian 'you Bastard' Reichert > 37 Crystal Ave. #303 Daytime number: (603) 434-6842 > Derry NH 03038-1713 USA Intel architecture: the left-hand path > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-multimedia" in the body of the message -- Snail: Tim Pozar / LNS / 1978 45th Ave / San Francisco CA 94116 / USA POTS: +1 415 665 3790 Radio: KC6GNJ / KAE6247 "It's a damn poor mind that can only think of one way to spell a word." - Andrew Jackson "What is wanted is not the will to believe, but the will to find out, which is the exact opposite." - Bertrand Russell, "Skeptical_Essays" To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-multimedia" in the body of the message