delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/09/07/15:03:15

Message-ID: <8D53104ECD0CD211AF4000A0C9D60AE3016372CB@probe-2.acclaim-euro.net>
From: Shawn Hargreaves <ShawnH AT Probe DOT co DOT uk>
To: djgpp AT delorie DOT com
Subject: Re: Generating/playing audio waveforms on the fly
Date: Tue, 7 Sep 1999 15:18:53 +0100
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.0.1460.8)
Reply-To: djgpp AT delorie DOT com

Graeme Fenwick writes:
> As part of a basic (note lack of capitalization ;-) sound generating
program
> I'm thinking of designing, I'd like to be able to playback the sounds as
> soon as they're made. However, I'm not sure how to do this, as I can't get
> enough out of the existing documentation. Audiostreams look like my best
bet
> in this direction, but what format is the audiostream meant to be in?

Audiostreams are very much the best way to do this: it is exactly the
situation they were designed for! And as it happens, the audiostream
example program (ex28.c, or exstream.c if you have a recent WIP 
version) does almost exactly what you are needing: it generates a
simple sawtooth wave with a gradually increasing pitch, feeding the
data to the soundcard as it is produced.

As for the format of the data, it is just a list of sample values, 
either 8 bit (chars) or 16 bit (shorts) depending on what type of 
stream you created. If it is a stereo stream, the samples come in 
pairs, one for the left speaker and then another for the right.


	Shawn Hargreaves.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019