Solved

PC Speakers and Wav files

Posted on 1999-01-26
13
349 Views
Last Modified: 2008-02-20
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
Comment
Question by:cpa802
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
  • 2
  • +3
13 Comments
 
LVL 5

Expert Comment

by:laeuchli
ID: 1258423
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
 

Author Comment

by:cpa802
ID: 1258424
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
 
LVL 10

Expert Comment

by:rbr
ID: 1258425
I don't think that it is possible to play a wav-file on the internal speaker.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Expert Comment

by:newexpert
ID: 1258426
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
 

Author Comment

by:cpa802
ID: 1258427
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
 
LVL 1

Expert Comment

by:_Canidae_
ID: 1258428
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
 

Author Comment

by:cpa802
ID: 1258429
_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
 
LVL 5

Expert Comment

by:laeuchli
ID: 1258430
If that does not work, try using the __asm keyword to put asm code in your program.


0
 
LVL 5

Expert Comment

by:scrapdog
ID: 1258431
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
 
LVL 5

Expert Comment

by:scrapdog
ID: 1258432
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
 

Author Comment

by:cpa802
ID: 1258433
Tks for the info scrapdog, Im not woried about the sound quality I just want it recognisable.
0
 
LVL 1

Accepted Solution

by:
_Canidae_ earned 100 total points
ID: 1258434
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
 

Author Comment

by:cpa802
ID: 1258435
Youre right It soundl like krap but maybe I can play with the source code. Tks
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question