phat code Is the glass half empty, half full, or twice as large as it needs to be?
Main

Projects

Downloads

Articles

Links

Forum

 

View Message

Back to Messages
Peter Swinkels Wed Nov 3 2021 at 5:34 am
Recording and playing sound in Quick Basic
 
 
First the recording part:

Browsing through the sample code proviced on this website I found these snippets in "sndrec.asm":

mov     dx,BASEADDR+00Ch

loopWait:
    in      al,dx
    or      al,al
    js      loopWait
ENDM

If I understand the code correctly, it is meant to ensure a consistent recording speed regardless of the CPU speed. Correct?

I also found this code at another website:

http://www.o-bizz.de/qbtuts/mallard/sbfaq.htm

I believe the examples provided there neglected to implement the speed control code posted above. Correct?

Now the play back part, this Quick Basic plays a single sample:

    OUT CommAddr, &H10 'Give command to output a byte
    OUT CommAddr, Byte(i) 'Output value

but there is no way to control the speed. How do I ensure samples are played back at a CPU independent speed?
 
 
 
 

Reply to this Message

Name
Subject
Message

No HTML is allowed, except for <code> <b> <i> <u> in the message only.
All URLs and email addresses will automatically be converted to hyperlinks.