From: Shawn Hargreaves Newsgroups: comp.os.msdos.djgpp Subject: Re: Help needed: Allegro outputs WAVs with noice Date: Tue, 28 Oct 1997 19:50:19 +0000 Organization: None Distribution: world Message-ID: References: <62qa8s$dr3$1 AT gts DOT nsk DOT su> NNTP-Posting-Host: talula.demon.co.uk MIME-Version: 1.0 Lines: 37 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Oleg Shamshura writes: >I have some WAVs of high quality, created by a professional sound >studio. Windows'95 plays them very clean, but Allegro adds noice. >I have SB AWE 32. Allegro is using a CPU function to mix several samples into the output audio stream, to let you play many different sound effects at once. This loses quite a bit of quality compared to something like the Windows audio drivers that just dump a single waveform directly to the hardware... In Allegro 2.2, there were 8 voices playing at once. In more recent WIP versions this can be adjusted anywhere between 1 and 32: lowering the number will slightly improve the quality. But the fact of doing this mixing means that the output will never be totally clean. Some bits are lost because I have to reduce the sample range to make room for multiple voices, and others because the lookup table I use for volume adjustments would get prohibitively large if I used a full 16 bit waveform! Also, since Allegro may be playing many sounds at one time it has to adjust them to whatever frequency the soundcard is running at, while I suspect Windows will be able to just set the soundcard to the same freq as the sample: this frequency conversion can introduce some noise since I don't do it properly with all the interpolation and filtering that a sample editor would use :-) This all means that Allegro is unable to give you a full 16 bits of sample precision, even on a 16 bit card (it's better than 8 bit output, though...) If you really need to output a waveform without any modification at all, you can hack the _mix_some_samples() function (this is found in sound.c in Allegro 2.2, or in mixer.c in WIP versions), and make it just copy your waveform across into the DMA buffer without any of the mixing code being used... -- Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/ Beauty is a French phonetic corruption of a short cloth neck ornament.