delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/09/09/22:30:26

From: "Graeme Fenwick" <gfenwick AT BYESPAMfreeuk DOT com>
Newsgroups: comp.os.msdos.djgpp
References: <8D53104ECD0CD211AF4000A0C9D60AE3016372CB AT probe-2 DOT acclaim-euro DOT net>
Subject: Re: Generating/playing audio waveforms on the fly
Lines: 43
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2014.211
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211
Message-ID: <VSXB3.407$H5.13390@nnrp4.clara.net>
Date: Fri, 10 Sep 1999 00:00:53 GMT
NNTP-Posting-Host: 212.126.147.157
X-Complaints-To: abuse AT freeuk DOT net
X-Trace: nnrp4.clara.net 936921653 212.126.147.157 (Fri, 10 Sep 1999 01:00:53 BST)
NNTP-Posting-Date: Fri, 10 Sep 1999 01:00:53 BST
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Shawn Hargreaves <ShawnH AT Probe DOT co DOT uk> wrote in message
news:8D53104ECD0CD211AF4000A0C9D60AE3016372CB AT probe-2 DOT acclaim-euro DOT net...
: 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.

    Thanks! As I was reading the documentation, I knew there would be some
place I hadn't checked. I'll take a look at that example the next time I'm
working on the program.
    I'm still intending saving the thing out as a .wav... writing a routine
to play back every variation of Wave file in existence looks like it would
be a complete nightmare (going by what I've seen). Fortunately, I only need
to generate a (relatively) simple uncompressed PCM file. :-)
    Hang on, this next bit looks familiar...

:
: 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.

    That also sounds quite like Wave format's PCM encoding. Shouldn't
require much tweaking to get this data to play back directly...

--
======================================================================
    "What do you mean, spontaneous human combustion?! Dammit! I was
 promised they'd get that Halt and Catch Fire instruction removed
 before we went into production."
    "Good job it wasn't our flagship model, Sir."
======================================================================

Graeme Fenwick
       - gfenwick AT BYESPAMfreeuk DOT com

    (Don't forget to remove "BYESPAM" filter if replying by mail)



- Raw text -


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