hossa

i rember to read weeks ago a post where someone seek a sample how to play music with the pc speaker.

here i found one....a com file+source playing xyz.mus files

allways share your links
Posted on 2001-12-19 06:34:53 by Max
yeah in good old dos days this was an easy task...
the one (NOP-erator) wanted win32 source... :)
Posted on 2001-12-19 07:33:50 by mob
sorry...dont remember it :)
possible that can help ,think its not so hard to port from delphi to asm *bg*

??? ??????? ????????? ????? ???????? ????????
? NT ???? API: Sound(Herz,MkSec); ?? ? Win9x - ?????? ???. ????? ????? ??????? ???:
library Sound;
// ?y????? ????p?? ????p?py?? ??y? ?? PC Speaker ??? NT ? WIN95.
// procedure SpeakerBeep(Hz, MkSec : Dword); stdcall; export;

uses Windows;

procedure NoSound;
begin
asm
in al,61h
and al,0fch
out 61h,al
end;
end;

procedure _Sound(Hz : Word);
begin
if (Hz > 18) then
asm
movzx ecx,Hz
mov eax,1193180
sub edx,edx
div ecx
mov ecx,eax
//set timer #3
mov al,182
out 43h,al
mov al,cl
out 42h,al
mov al,ch
out 42h,al
//enable speaker
in al,61h
or al,3
out 61h,al
end;
end;

procedure SpeakerBeep(Hz, MkSec : Dword); stdcall; export;
Var
OSVERSIONINFO : TOSVERSIONINFO;
Begin
OSVERSIONINFO.dwOSVersionInfoSize:=sizeof(OSVERSIONINFO);
GetVersionEx(OSVERSIONINFO);
If OSVERSIONINFO.dwPlatformId =VER_PLATFORM_WIN32_NT then
Beep(Hz,MkSec)
else
Begin
_Sound(Hz);
Sleep(MkSec);
Nosound;
End;
End;

exports SpeakerBeep;
begin
end.
Posted on 2001-12-19 11:27:33 by Max
In and out instructions, ugh!

Bad programmer, bad bad programmer! No juicy bone for you tonight!

NT will turn its nose up at it anyway....

Mirno
Posted on 2001-12-19 11:41:48 by Mirno
Mirno: the code checks if the OS is NT, if yes it uses Beep, which is a more advanced function in NT than in 9x. But I don't like using ins and outs in 9x either.
Posted on 2001-12-19 12:04:21 by Thomas
@Thomas: and i don't like dlls for such a little app, that helps me not to use in and out. :rolleyes:

@Max: my code is ported from delphi to asm.....

nop
Posted on 2001-12-19 13:35:41 by NOP-erator
@Thomas: and i don't like dlls for such a little app, that helps me not to use in and out.


I also hate using dlls that are 10 times bigger than my program that uses it but I used it because I wanted to use the parallel port directly. I created a small circuit that could program a microcontroller. Because the circuit was just a simple interface without any other logic, I couldn't use the default methods of accessing parallel ports, so I needed direct port access. As I use win2k, ins and outs weren't an option.
Posted on 2001-12-19 13:42:55 by Thomas
I can't figure the *meaning* of the alghorithm, may someone please explain?

I have got this same code (barely) from several places, including ripping from apps that access the sound speaker in my own PC. :(

Is bits 0 and 1 together indicating the state ON/OFF of the speaker? Or of the CHIP? :\

That division, what is that big number? (that don't exactly match on some different codes I saw).

If someone can point me a documentation about the sound chip/speaker/WhateverIDunno and maybe the timer chip, it would be really really great (i searched a little bit, but the results aren't coming as to be expected )

Regards,

wicr0s0ft
Posted on 2003-09-01 00:43:02 by wicr0s0ft
???????? ? ??????.... ????????? ???????? ??????? ????????? waveOutOpen() ? ???? ??????? ???? ??????? ?? ???? ??????????. ???????? ??????? 9000Hz = ?????? ????? ????????? ? ???????. ??????? ??????? ?????? ??? ?????? ??????????? ? ?????????? 9000 ??? ? ??????? - ?? ?????? ????? sin(). ???? ?? ?????
Posted on 2003-09-01 13:04:40 by comrade

??? ??????? ????????? ????? ???????? ????????
? NT ???? API: Sound(Herz,MkSec); ?? ? Win9x - ?????? ???. ????? ????? ??????? ???:
library Sound;
// ?y????? ????p?? ????p?py?? ??y? ?? PC Speaker ??? NT ? WIN95.
// procedure SpeakerBeep(Hz, MkSec : Dword); stdcall; export;
Originally posted by Comrade
???????? ? ??????.... ????????? ???????? ??????? ????????? waveOutOpen() ? ???? ??????? ???? ??????? ?? ???? ??????????. ???????? ??????? 9000Hz = ?????? ????? ????????? ? ???????. ??????? ??????? ?????? ??? ?????? ??????????? ? ?????????? 9000 ??? ? ??????? - ?? ?????? ????? sin(). ???? ?? ??????.

What the hell does that mean ???
Originally posted by Hiroshimator"]
Guys, English please

thx :)
Posted on 2003-09-01 13:08:44 by donkey
Mmm... :-\

sin...
WaveOut...
speaker beep...

:( I really cannot say I understood, should I have?

Anyway, I found that the coded posted here, wich is identical to old Turbo-C code (ripped?!) has inconsistences, IMHO.

I modified the code a little, it works as I "think" it should, but there is still stuff I don't understand... so:

------------------------------------------

Later I am looking for some documentation on the "sound maker" chip on the PCs that is responsible for producing sounds on the spekaer. Obviously, I don't know what ship is that, neither what is its relation with the sound chip, so I am not getting meaninfull results when searching... may someone more experienced help a little here? :)

If I cannot find docs (more or less) about that, then I make a post with my "findings" just as they are now.

Thank you.
Posted on 2003-09-04 02:14:50 by wicr0s0ft