OSDev.org

The Place to Start for Operating System Developers
It is currently Mon May 20, 2024 8:24 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Playing WAV files with Sound Blaster
PostPosted: Mon Jul 18, 2016 6:12 pm 
Offline
Member
Member
User avatar

Joined: Tue Mar 06, 2007 11:17 am
Posts: 1225
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:
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.

_________________
Live PC 1: Image Live PC 2: Image

YouTube:
http://youtube.com/@AltComp126/streams
http://youtube.com/@proyectos/streams

http://master.dl.sourceforge.net/projec ... 7z?viasf=1


Last edited by Combuster on Tue Jul 19, 2016 2:19 pm, edited 1 time in total.
Reduced quadrupled contents to singular.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Majestic-12 [Bot] and 30 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group