Other code

Jump to section:

Sound Blaster 16 Sound

Records and plays 16-bit sound on a Sound Blaster 16. Uses auto-initialized DMA to reduce clicking. Sound data is stored in files containing raw 16-bit signed samples suitable for processing or analysis. Full Turbo Pascal and Borland C source code is included.

Release note: There is a bug that prevents SB16SN from working with sound cards on IRQ10. To fix it in the Pascal version, edit the routine IntHandler in sbio.pas and add the line "Port[$A0] := $20;" after the line "Port[$20] := $20;" For the Borland C program, go to the routine inthandler() and insert "outp(0xA0, 0x20);" on the line before the statement "outp(0x20, 0x20);" Some copies of the Borland C version do not have this problem. If yours does, edit the routine init_sb in sbio.c. Look for the second occurance of "pic_maskport = 0x21;" and replace it with "pic_maskport = 0xA1;"

Download SB16SND.ZIP (49,928 bytes)

Sound Blaster real-time signal processing

Performs simultaneous input and output on a Sound Blaster compatible sound card. Includes a generic processing example and an example program that mixes a sine wave with input.

Download SBPROCSS.ZIP (5,880 bytes)

Simultaneous recording and playback on the SB16

Does simultaneous recording and playback on the SB16. Uses 16-bit DMA for recording and 8-bit DMA for playback. Supports sampling rates up to 44khz and can be adapted for stereo. Sample program demonstrating "echo" included. Borland C source included. Version 1.01 fixes a problem with simultaneous interrupts. The original version would incorrectly stop if interrupts from eight and sixteen bit audio occur at the same time.

Note: There is a bug in v1.01 that will cause problems when DMA pages are misaligned. To fix it, change the "+1" in line 283 and line 300 to "+bufferlength". Thanks to Alberto di Bene for pointing out this error.

Download SIMUL101.ZIP (17,172 bytes)

FMSOUND - FM Synthesized Audio

FMSOUND is a simple library, written in response to a question in alt.sb.programmer, that allows you to make tones on the OPL2 FM synthesizer. The OPL2 has nine audio channels, each capable of producing two operator additive or FM synthesis, with full attack/decay/sustain/release envelope, using one of four base waveforms as a base. What this means to you is that you can make up to nine independent sounds at a time, ranging in frequencies from below the human range of hearing to far above it (although the sound card and speakers may reduce this). Supports Borland C, Turbo Pascal, and Watcom C.

Download FMSOUND.ZIP (19,215 bytes)

SBDETECT - Detect Sound Blaster or compatible sound cards

This is some code I'm currently (97/6/29) working on to detect sound cards, including base IO address, IRQ, and 8 and 16-bit DMA channels. As of now, it only detects by playing with the hardware, but, when it is completed, it will first use the BLASTER settings as a suggestion (to be confirmed by testing hardware), then fall back to hardware detection. I may also add support for reading the SB16 mixer registers to obtain IRQ and DMA channels.

I've moved on to other projects, so I'm not planning to do any more work on it. The code available here is probably the final version, and there probably won't be any documentation.


UMSYS - Unfinished digital music engine

This is a project I worked on for a few months in 1995, then lost interest in it and haven't touched it for several years. Rather than let it sit unused on my computer, I'm releasing it to the public. Hopefully someone will learn something from it. As far as I know, it is the only library that does real-time wavetable synthesis of MIDI files on non-wavetable cards.

Download UMSYS.ZIP (557,073 bytes)

Back to Home Page
Ethan Brodsky <ebrodsky@pobox.com>