• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 355
  • Last Modified:

PC Speakers and Wav files

Is there a program out there that will read windows .wav files and play them on the PC Speaker (The one connected to the motherboard)
If not how would I go about doing it?
0
cpa802
Asked:
cpa802
  • 5
  • 2
  • 2
  • +3
1 Solution
 
laeuchliCommented:
I don't think there is a program. What you would have to do is find out about the wav file format. Then using some langauge that can talk to the speaker, like powerbasic(www.powerbasic.com) or assembler.
0
 
cpa802Author Commented:
I already know the .wav/RIFF format. I however dont know how to interpert the data for a pc speaker, that is what I want to know if I can't find a program that already does it. If i MUST write it I'd like to do it in C but I dont know how to embed assembler code in to my C code. (I do know a little assembler)
0
 
rbrCommented:
I don't think that it is possible to play a wav-file on the internal speaker.
0
What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

 
newexpertCommented:
Microsoft used to supply speaker.drv for Windows 3.xx, which can play WAV of up to 8 bit 11.025kHz mono over PC speakers.
0
 
cpa802Author Commented:
In pascal you could supply a range of sounds for different lengths of time. Is there a way to do that in C. If anyone knows where I can find any info on general sound programming that would be helpfull too. This myst seem realy strange but im sure it can be done. As newexpert said there used to be a MS driver for it.
0
 
_Canidae_Commented:
A long, long time ago, I found a Pascal program in SWAG that does just what you've asked for.  I just checked now, and I've still got it.  Not entirely sure how good it does the job though.  I could mail it to you if you wanted.
0
 
cpa802Author Commented:
_Canidae_:
I would LOVE a copy :) send your email addy to hades_mop@hotmail.com
and Ill send you an E-mail addy you can send an attachment to (Sorry about the run about but I just dont want to give my school addy out over the net)

If it plays wav files half decient Ill give you the pts for the question.
0
 
laeuchliCommented:
If that does not work, try using the __asm keyword to put asm code in your program.


0
 
scrapdogCommented:
It *is* possible.  However it will sound like crap since the resolution is 1 bit.

When interpreting the samples, normally you just send the whole byte (or word) to the sound device to convert to an analog signal.

However, with the PC speaker, you have to convert the 8 or 16 bit sample to 1 bit!!

Example:  if your file is 8-bit unsigned, you would *click* if the amplitude is between 128 and 255 (by tickling the appropriate port for the PC speaker).  If the sample's amplitude is less than 128, then you would do nothing (i.e. no sound).

If it were 16-bit signed, you would *click* on 49152-65535 or 0-16383, and NOT click on 16384-49151, etc.

In other words, the most significant bit of your sample determines whether or not to emit a click.
0
 
scrapdogCommented:
btw, the amount of assembly code you will need is minimal, if any.  You probably only need code to manipulate the speaker, which should take no more than a few lines.
0
 
cpa802Author Commented:
Tks for the info scrapdog, Im not woried about the sound quality I just want it recognisable.
0
 
_Canidae_Commented:
Aah well, I've sent the program to you now.  Too bad scrapdog was right about the sound quality though.  It sounds worse than crap!
0
 
cpa802Author Commented:
Youre right It soundl like krap but maybe I can play with the source code. Tks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 5
  • 2
  • 2
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now