Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Jul 2001 09:26:29 -0700
From:      Tim Pozar <pozar@lns.com>
To:        Brian Reichert <reichert@numachi.com>
Cc:        Christoph Kukulies <kuku@gilberto.physik.rwth-aachen.de>, multimedia@FreeBSD.ORG
Subject:   Re: writing a sine to a .wav
Message-ID:  <20010718092628.A42443@lns.com>
In-Reply-To: <20010718114559.Q49286@numachi.com>; from reichert@numachi.com on Wed, Jul 18, 2001 at 11:45:59AM -0400
References:  <200107181542.f6IFgtl63993@gilberto.physik.rwth-aachen.de> <20010718114559.Q49286@numachi.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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		<reichert@numachi.com>
> 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




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