|
This thread is locked; no one can reply to it. |
1
2
|
Poor sound quality under DOS |
Ulrich Peters
Member #3,933
October 2003
|
Hello, I am developing a program using Allegro 4.1.11. The code is written to allow me to compile it for DOS (using DJGPP) and Win32 (using MSVC6). Both versions use the same DAT files where the sound samples are stored. When running the program on DOS (I use OpenDOS 7.01), I get a bad sound quality with a lot of background noise. The Win32 running on the same hardware and using XP has the clear and loud sound, originally expected for both versions. The hardware I am using is a VIA EPIA board, which has a VT1612A sound processor. This device can emulate a Sound Blaster on IRQ5/7, 0x220, DMA 1. To have this emulation work under DOS, it is required to load a small TSR. One could think that the TSR is not well written, and that the emulation isn't working well. However, I installed my DooM II (yes, I am that old) on the same DOS partition, and the sound is perfect: DooM has loud, clear and scary sound effects. So the problem is not the TSR, as I told DooM during install the same I said to Allegro: Sound Blaster, IRQ5, etc. I already tried all Sound Blaster types available in the Allegro setup program, and all produce terrible sound. Why does DooM work fine, and the Allegro-based program sounds so low and distorted (under DOS)? Any ideas to solve this? Thanks, |
Marcello
Member #1,860
January 2002
|
I got a really good idea. don't use dos. Marcello |
Ulrich Peters
Member #3,933
October 2003
|
Yes, if there weren't no power outages, and people could be teached about the need to shut down the Windows file system (or Linux, or whatever) before turning off the equipment, I could agree. Unfortunately some people don't have the time or the will to wait for long boot times, file system recoveries, and shutdown delays. |
Michael Jensen
Member #2,870
October 2002
|
So if it's not the tsr, then it's allegro's dos sound support that is written "poorly", actually in theory it could still be the tsr -- I don't know much about sound implimentation but I do know there's usually more than one answer to a problem -- your problem -- "we need sound in dos" solved by doom via method 1, solved by allegro via method 2, your tsr may have great support for method 1 and horrible support for method 2,--you could just look at the doom 2 source code (which I belive is freely avilable) and write your own sound code... Edit:
|
Bruce Perry
Member #270
April 2000
|
Quote: This device can emulate a Sound Blaster on IRQ5/7, 0x220, DMA 1. There's your problem (well, part of it). The first four DMA channels (0 to 3) are for transferring 8-bit words between memory and hardware. The other four (4 to 7) are for 16-bit data. The Sound Blasters (and probably all other cards with PCM audio support) use DMA to get the sample data from memory (or write to memory when recording). If you can only specify a low DMA channel, that means your emulation only supports 8-bit sound. (To understand why this results in noise, you have to understand the way sound is stored and have a certain feel for what various waveforms sound like; if this is new to you, play with a sample editor such as Cool Edit.) You can, however, do something to help the situation. Read the docs for set_volume_per_voice(); that should help to some extent. -- |
Chris Katko
Member #1,881
January 2002
|
Is it possible to set the DMA higher on your TSR/soundcard? -----sig: |
Bruce Perry
Member #270
April 2000
|
8-bit sound and 16-bit sound are quite separate on a Sound Blaster. If the emulation supports 16-bit sound, it should* be quite obvious to the software that wants to use it (Allegro included). If not, then there is no way you will get 16-bit sound. Sorry. *Sound Blaster emulation is (apparently) tricky to do well. You may find that some software fails to detect the emulation. Allegro 4.x is usually OK though in my experience (Allegro 3.12 wasn't). -- |
Chris Katko
Member #1,881
January 2002
|
Yeah, I know that all too well. Sometimes setting it manually will work a lot better. I used a Pro Audio Spectrum 16 for years. That thing was a beast, but some programs didn't fully support it's sb16 emulation. p.s. Never knew that DMA lines where different lengths. Thanks for mentioning that. -----sig: |
Ulrich Peters
Member #3,933
October 2003
|
Hi, Ulrich |
Kitty Cat
Member #2,815
October 2002
|
Make sure you're setting a respectable frequency. IIRC, the default Sound Blaster driver uses 11khz, SB 2.0 and SB Pro use 22khz, and SB16 driver uses 44khz. Also, the default SB driver won't let you use a higher frequency than what the Allegro driver supports, whether or not your card can properly emulate it, and as well doesn't use auto-initialized DMA which can probably cause some static. Try forcing the SB 2.0/Pro/16 driver, and see if you get better output. And use the High DMA channel (usually 5 or 7) in allegro.cfg if you have one available. -- |
Bruce Perry
Member #270
April 2000
|
Also, have you tried set_volume_per_voice() as I suggested? It'll allow you to make the whole thing louder, and then it should be more on a par with Doom in terms of sound quality. (Note: you have to use the high DMA channel for 16-bit sound, and you can't use the high DMA channel for 8-bit sound. That's just the way it works.) -- |
Kitty Cat
Member #2,815
October 2002
|
Quote: (Note: you have to use the high DMA channel for 16-bit sound, and you can't use the high DMA channel for 8-bit sound. That's just the way it works.) If he has a high DMA channel, he must supply that instead. At least with my SB16, when I had it, if I used the low DMA channel I wouldn't get any sound at all. Probably because it forced the SB16 into 16 bit mode, so the low DMA was inadequite, but I'm not sure of that. Though I do kind of wish Allegro supported both high and low DMA and just used whichever it needed to for the bit depth and card/driver. Especially when I started out with Allegro, it just said to supply the DMA, but since my SB16 had two DMA channels I didn't know which to give it. And of course, playing it safe I used the low DMA.. -- |
Sirocco
Member #88
April 2000
|
For the SB cards at least Awe32 or later (and I'm assuming SB16 since the AWE series is based on that design) DMA 5 will work, but your output volume will be significantly decreased. You can compensate through volume controls, or boosting the samples. --> |
ImLeftFooted
Member #3,935
October 2003
|
hmm, i might be way off, but if you havent u should call reserve_voices() and reserve 1 voice (or how every many u need). the more voices u have the worse the quality. EDIT: this ofcourse is using allegros method of doing things. as Michael Jensen said. But if you havent tried it yet, u should. |
Sirocco
Member #88
April 2000
|
The number of voices has more of an impact on volume than anything else. --> |
ImLeftFooted
Member #3,935
October 2003
|
It seemed to improve the quality of sound in games ive made dramaticaly. But that was MIDI music, so i guess that might have been differnt. EDIT: "You should be aware that the sound quality is usually inversely related to how many voices you use, so don't reserve any more than you really need." |
Marcello
Member #1,860
January 2002
|
I still think my solution is the best. If you're making a freaking GAME, people can wait for a DECENT operating system to START so that they can PLAY it. Marcello |
Oscar Giner
Member #2,207
April 2002
|
I own a SBAWE32 and sounds great under DOS, even in 8bit mode, so it's like your sound card doesn't emulate SB 100% correctly. I don't know how TSR work, but maybe, just maybe, they install themselves in the timer interrupt. Allegro touches this, probably breaking the TSR... -- |
Chris Katko
Member #1,881
January 2002
|
That could be it. Allegro is killing it. Before everyone flames me, remember, Allegro constantly reprograms the DOS timer. If the TSR needed to do the same, it'd all go to heck, wouldn't it? -----sig: |
Zaphos
Member #1,468
August 2001
|
Quote:
Yes, if there weren't no power outages, and people could be teached about the need to shut down the Windows file system (or Linux, or whatever) before turning off the equipment, I could agree. Unfortunately some people don't have the time or the will to wait for long boot times, file system recoveries, and shutdown delays. Actually, a journaling file system like that provided by NTFS and ext3 would solve much of your problem there while still giving you access to good, supported drivers and such. Windows NT or XP, could provide you NTFS; I believe any linux distribution could be set up with ext3. These systems change scanning the hard-disk to a task that only takes a few seconds.
|
ImLeftFooted
Member #3,935
October 2003
|
Marcello has a good point. The original cell phones were like 5 pounds and huge, we dont use them anymore. The first airplanes were immensely cheaper, we dont use them anymore. The first TVs had tiny screens and were really crappy, we dont use them anymore. Music from the 50s is crap and no listens to it. So... why should our programs have to backwards compatible to one of the very first operating systems if nothing else does? |
Thomas Fjellstrom
Member #476
June 2000
|
NTFS isn't journaled (AFAIK). Wish it was -- |
Bruce Perry
Member #270
April 2000
|
Everyone who recommended reserve_voices(), please read the docs for: Also note that reserve_voices() alone will not give you louder sound than you get by default; it can only give you quieter. And it will only affect the volume if you don't call set_volume_per_voice(). If volume is what you care about, use set_volume_per_voice(), not reserve_voices(). -- |
Zaphos
Member #1,468
August 2001
|
TF: edit: Wikipedia disagrees with you
|
Tobias Dammers
Member #2,604
August 2002
|
Here's my 2p: --- |
|
1
2
|