www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/01/08/19:04:07

Message-Id: <199901090002.TAA24121@delorie.com>
Comments: Authenticated sender is <mert0407 AT sable DOT ox DOT ac DOT uk>
From: "George Foot" <george DOT foot AT merton DOT ox DOT ac DOT uk>
To: djgpp AT delorie DOT com
Date: Sat, 9 Jan 1999 00:01:29 +0000
MIME-Version: 1.0
Subject: Re: allegro sound (audio stream routines) problems
CC: Michael Burian <michael DOT burian AT sbg DOT at>
X-mailer: Pegasus Mail for Win32 (v2.42a)
Reply-To: djgpp AT delorie DOT com

On  8 Jan 99 at 20:24, Michael Burian wrote:

> 1st:
> when using the stream audio routines provided by Allegro I noticed that
> the volume is always the same no matter if you fill the buffer with
> 
> p[i]=200*sin(phase);
> or
> p[i]=20000*sin(phase); // should be 20 dB louder but isn't
> 
> second problem:
> sound quality is lousy, noticeable distortions, what can I do to improve
> sound
> quality?

Reread the documentation. :)  Your stream is either 8 or 16 
bits, so 20000 wraps if it's 16 bit and 200 wraps whichever it 
is.  The sample format is unsigned -- so the zero position is 
at 128 or 32768, not 0 as your lines above assume.

If the stream is 8 bit, try:

    p[i] = 128 + 127*sin(phase);

If 16 bit, try:

    p[i] = 32768 + 32767*sin(phase);

These are the maximum volumes.  You can of course use 
set_volume to adjust the global sound volumes.

-- 
george DOT foot AT merton DOT oxford DOT ac DOT uk

- Raw text -


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