Playing WAV files with Sound Blaster

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
~
Member
Member
Posts: 1225
Joined: Tue Mar 06, 2007 11:17 am
Freenode IRC: ArcheFire

Playing WAV files with Sound Blaster

Post by ~ »

Here I have a program (with source code) capable of sending uncompressed WAV data to a Sound Blaster card using DMA.

In the following ZIP file, I have included DOSBox with Turbo C++ 1 to compile its source code. I have included the file dmaw.bat along with 3 8-bit Mono 44KHz music WAV files to test the sound quality with this program.

Source Code and 8-bit Mono 8,000 Hz WAVs:
Image dmaw.zip



Full Example and Tools Inside DOSBox Portable:
Image DOS_SoundBlaster_WAV_Player.zip


We need to initialize the sound card with the proper Sound Blaster driver (be it Vibra 16/16S, Sound Blaster 16, AWE32, AWE64, the ESS Solo, or several Intel audio cards, apart from the emulation by DOSBox/Windows/Bochs/QEMU/VirtualBox...). These drivers can be found below (we might need to test which one to install, but in general they match the name on the sound card and its chips):
Image VOGONS: Creative/Sound Blaster Driver Library



This program is capable to play fully uncompressed 8-bit Mono WAV files. They can range from 8,000 Hz to 44,100 Hz. It's a good program that can enable us to make use of our modern audio files even with the oldest PC, as long as it's equipped with a Sound-Blaster-capable sound card.

It works under DOS, and needs a previously initialized sound card and the BLASTER DOS environment variable set.

I have also included Winamp to convert audio files to uncompressed WAV. I have only been able to convert to the right WAV format using either Winamp or Audacity, but it's more practical to convert them with Winamp.

The idea is to at the very least have the possibility to listen to music in our oldest machines or eventually under our OS by porting the code and audio driver.


I'll try to find a DOS/Windows command-line program to also play MP3 and AAC files. With the source code it should be possible to later add a GUI (at least in 80x25 text mode) to control the progress bar for the file position, as well as the sound level, to make it more usable.


_________________________________________________
_________________________________________________
_________________________________________________
_________________________________________________
Maybe implementing enough of DPMI/DOS/WinAPI to launch Winamp or a command-line player from DOS, would be a good idea to have DOS as the simplest standard base shell of an OS, and then launch a single application or another OS, to have DOS mode and another OS launched from it.

It would also be a good idea to implement an EXE loader for DOS by ourselves, so that we can do:

Code: Select all

EXELOAD.COM program.exe




Then we could learn to launch DOS MZ EXEs, stubbed Portable Executables (by also implementing some of the WinAPI), and use it to create a launcher for our OS from DOS (of course, when our OS is launched, it should reconfigure the system again and use its own functions, although it should keep a copy of the first Megabyte, of the CPU state and of the hardware devices) so it can return to DOS mode, to make our OS yet another regular application that is capable to be launched from DOS (MS-DOS or FreeDOS) and return to it easily.

It should give the user back the capability to enter the low-level and fully unprotected DOS environment, as it was with Windows 3.x.
Last edited by Combuster on Tue Jul 19, 2016 2:19 pm, edited 1 time in total.
Reason: Reduced quadrupled contents to singular.
Post Reply