Sound code
[.WAV playing #1] [.WAV playing #2] [.WAV playing #3] [.WAV recording]
List of DSP commands for the Sound Blaster
Many people have requested a list of the commands for the DSP chip on the Sound Blaster, so here it is.
To download the text file (4k), click here.
Autodetecting the Sound Blaster settings
Source code to detect the base port, DMA channel and IRQ setting of the Sound Blaster family.
Note: This has been expanded to detect the 16bit DMA channel on SB16 and above.
To download the Pascal source code (3k), click here.
To download the C(++) source code (3k), click here.
Mixing sound samples through Sound Blaster DMA
Source code to mix wave files using the Sound Blaster's auto-init DMA facility. Four wave files are included.
Note: This won't work on the original Sound Blaster version 1.0 as it doesn't support auto-init DMA at all.
To download the Pascal source code (43k), click here.
To download the C(++) source code (43k), click here.
To download the DJGPP source code (43k), click here.
Playing Audio CDs through a CD-ROM player
Source code to play an audio CD using MSCDEX.
To download the Pascal source code (3k), click here.
To download the C source code (3k), click here.
Playing MIDI music in the background
Source code to play MIDI music using either an FM sound card such as the AdLib and SoundBlaster cards or a General MIDI (GM) device, such as the Roland cards or the Gravis UltraSound using MegaEM.
Note: The routines have been updated to include a volume control.
To download the Pascal source code (40k), click here.
To download the DJGPP/C(++) source code (40k), click here.
Instrument editor
Some people have complained that the MIDI's don't sound the same as they do in Windows. That is because I don't know the instrument definitions Windows uses.
If you think you can improve upong the instruments, you can use this tool. Be warned though: you need some good knowledge of how the sound card produces its sound.
To use the editor, just unzip the file into the same directory where you will use the routines. Don't forget to hit F2 to save your changes!
To download the editor (10k), click here.
Playing music through an FM sound card
Source code to play music using an FM sound cards such as the AdLib and SoundBlaster cards.
Note: If you use MicroSoft C, please read the section "Delay routine" above.
To download the Pascal source code (2k), click here.
To download the C source code (2k), click here.
Playing a sampled sound through Sound Blaster DMA
Source code that plays a wave file through the Sound Blaster. If you don't need to mix multiple samples, try this.
To download the Pascal source code (9k), click here.
To download the C source code (9k), click here.
Playing .WAV files through DMA
Pascal source code to load and play a .WAV sound file. This will play any standard 8/16 bit uncompressed .WAV files.
Note: This has been expanded to support other IRQ and DMA settings. A small error in the header definition prevented some waves from playing. Thanks to Ed Roberts for telling me.
To download (5k), click here.
Playing .WAV files through DMA
Source code to load and play a .WAV sound file. This will play standard 8 bit mono uncompressed .WAV files of any length and sample rate.
To download the Pascal source code (35k), click here.
To download the C source code (35k), click here.
Recording .WAV files through DMA
Source code to record a .WAV sound file. This will record standard 11025Hz, mono, 8bit, uncompressed .WAV files.
Note: A small bug that caused problems when recording more than one wave file ofter another has been fixed. Thanks to Ed Roberts for telling me.
To download the Pascal source code (4k), click here.
To download the C source code (4k), click here.