• Please review our updated Terms and Rules here

Compaq Portable demo sounds different on different machines

JonnyGators

Experienced Member
Joined
Mar 9, 2020
Messages
200
Location
Attleboro, MA
Ok, an oddball observation that perhaps no one else ever really noticed or cared about. But something I always noticed.

So, the compaq portable came with some demos that would draw designs and play music. This is something that is my earliest memory of computers, so something that has stuck with me all these years. One of the demos has a section with this sliding sound effect. We had the compaq disk with this demo, and we had gotten a computerland BC88 family computer in 1986, so every now and then we might play the demo on that computer. And I always noticed....that sliding sound didn't sound quite the same. I dunno, that just always bothered me, everytime we'd play it on that machine, it would get to that point and I'd always think, that doesn't sound right.

More recently, I've obtained the disk image and playing it in dosbox makes a sound that's just completely different.

On the old machines it has a buzziness or growliness to it, where dosbox makes a pure sliding tone sound.

So, now that I have a working compaq portable, I can go back to playing with the sound, and the code in basic, and try to figure it out. And....it's still kind of a mystery.

Ok, so here's a youtube example of a portable playing the sound:

https://youtu.be/WxZMl9ZQYXU?t=210

I've found the code that has the sound, and the basic code for it is as follows (obviously in the actual code the line numbers are much higher)
10 for j=2 to 10 step 2
20 for i=j*30 to 1000 step j
30 sound i,.01
40 next:next

If you're going to run this code, I recommend adding 50 sound 0,0 to make it stop the sound at the end of the program, otherwise it'll keep sustaining the last tone until you stop it.


What I've found is that, running this code by itself on a compaq portable still sounds different than it sounds in the context of the demo. But I can't understand why that would make a difference. Same code, giving specific frequencies and duration, should sound the same by itself, or in the context of the program while it's showing a stationary image on the screen.



Anyways, I dunno, just my odd observation over this old piece of code that seems to be inconsistent from machine to machine over the years.
 
Sounds like what they're doing is resetting the square wave after a non-even number of cycles, effectively creating an oscillator sync effect (as heard on a variety of analog synthesizers and also the SID.) DOSBox's issues with it probably stem from A. the fact that it's not really anything like cycle-accurate to begin with and B. the challenge of emulating software implementations of audio-rate complex effects when you also need to maintain a certain minimum buffer in order to avoid jitter. I'm curious whether tweaking the DOSBox audio settings would have any effect on this.
 
The Compaq Portable was very close in performance to the IBM PC. It can even run 8088 MPH! correctly. Can you verify the version of BASIC is the same between the demo and the one you tried? Can't imagine why that would make a difference, but you never know.
 
I've tried different versions of basic, but I've not found that to make a difference.

I think the .01 duration is actually an infinite duration (anytime I use the sound command with a .01 duration it holds the tone until I type another command to stop it, even though smaller numbers are a shorter duration) (well....not infinite....but holds until another command. indefinite. No set duration, so it'll hold it forever, but it won't wait if another command comes in), and so with the speed of going through the sound commands dependent on the speed of the processor, that could contribute to the sound output of the code not being consistent from machine to machine. Plus, PC speakers can vary in size and quality from machine to machine. I guess what confuses me the most is why that particular code sounds different when run in the context of the program, and when run alone in a new program on the same machine, same version of basic. I don't think it should be processing anything else, the image of the star is just stationary at that point, so it's not doing any graphics processing at that moment. But somehow it makes a difference. Either that, or I've not found the right section of code....it's hard to analyze the whole program, I just searched through blocks of code until I got to the spot that looked right, took a picture of the screen, and typed out that nested loop and got something that sounds very close to the program, but....it doesn't go as low it seems.
 
Last edited:
Sounds like what they're doing is resetting the square wave after a non-even number of cycles, effectively creating an oscillator sync effect (as heard on a variety of analog synthesizers and also the SID.) DOSBox's issues with it probably stem from A. the fact that it's not really anything like cycle-accurate to begin with and B. the challenge of emulating software implementations of audio-rate complex effects when you also need to maintain a certain minimum buffer in order to avoid jitter. I'm curious whether tweaking the DOSBox audio settings would have any effect on this.

It's this, but done with some timing trickery based on the way the PC speaker was implemented. The speaker was only intended to do bleeps, maybe some simple music, so in order to get more complex sounds you had to screw the timing up somehow. OSC SYNC was usually done with more than one oscillator, but the PC speaker only has the one voice, so you'd bang the frequency timer on the single voice in order to get the weird commander keen sound effects. The speaker probably wasn't quite the same in implementation between computers, and the ultimate version of that is the Dosbox version where they don't even bother emulating that because the original PC speaker shouldn't have actually been capable of doing that. It was just a quirk of the implementation that game and demo programmers found and took advantage of, like so many other things in those days.
 
It's this, but done with some timing trickery based on the way the PC speaker was implemented. The speaker was only intended to do bleeps, maybe some simple music, so in order to get more complex sounds you had to screw the timing up somehow. OSC SYNC was usually done with more than one oscillator, but the PC speaker only has the one voice, so you'd bang the frequency timer on the single voice in order to get the weird commander keen sound effects. The speaker probably wasn't quite the same in implementation between computers, and the ultimate version of that is the Dosbox version where they don't even bother emulating that because the original PC speaker shouldn't have actually been capable of doing that. It was just a quirk of the implementation that game and demo programmers found and took advantage of, like so many other things in those days.

Cool, thanks for the technical explanation.
 
Back
Top