PDA

View Full Version : Nyan Cat for the IBM PC



JoJo_ReloadeD
September 29th, 2013, 08:26 AM
Hello all,

I have just finished and released the 1.0 version of my Nyan Cat (http://en.wikipedia.org/wiki/Nyan_Cat) minidemo for the IBM PC.


http://www.youtube.com/watch?v=Wd__hQZVmao

You can download it along its source code on:

http://www.360k.es/?p=338

Thanks to Trixter for all his helpful tips :D

Conmega
September 29th, 2013, 10:55 AM
Haha awesome!
Would have never expected to see Nyan cat on an old PC. :D

evildragon
September 29th, 2013, 11:04 AM
It's not using my soundblaster, it comes out of the PC-speaker, with a high pitched wine.

Does it not use soundblaster?

JoJo_ReloadeD
September 29th, 2013, 11:12 AM
It's not using my soundblaster, it comes out of the PC-speaker, with a high pitched wine.

Does it not use soundblaster?

Nope, all sound comes from the pc speaker.

evildragon
September 29th, 2013, 11:26 AM
Nope, all sound comes from the pc speaker.

Ahh ok.. On my model 25 it includes a aweful high pitched whine. Must be something specific to the model 25.

evildragon
September 29th, 2013, 11:31 AM
Here's how it runs..

http://www.youtube.com/watch?v=2srGr-WIkl0

njroadfan
September 29th, 2013, 12:11 PM
My PS/2 Model 50z used to make the same whine when playing MOD files.

k2x4b524[
September 29th, 2013, 12:19 PM
make it work through a sound blaster on a pc, then have it sit next to 8088 corruption XD

Dmitriy Krotevich
September 29th, 2013, 12:28 PM
that's awesome! :DDDDD

I didn;t really expect my XT to be able to run it! It's so cool that my XT has a speaker volume control xD


http://www.youtube.com/watch?v=pk6XMnFZr64

mbbrutman
September 29th, 2013, 12:39 PM
For those of you with networking capability ...


http://web.archive.org/web/20130726065133/http://miku.acm.uiuc.edu/ (archive.org cached version)

http://miku.acm.uiuc.edu/

It is not responding at the moment but it is a web page that gives you instructions on how to telnet into their Nyan cat server. There are also pictures from a wide variety of computers showing them connected to the server. If you are adventurous you can download the code for Linux to create your own Nyan cat server.

Here are my two DOS machines participating:


http://www.brutman.com/pics/nyancat.jpg


-Mike

SomeGuy
September 29th, 2013, 01:47 PM
Ahh ok.. On my model 25 it includes a aweful high pitched whine. Must be something specific to the model 25.
You are going to hear that high pitch noise on almost any PC-speaker unless the hardware happens to run the sound through a filter.

The pc-speaker is only 1-bit sound, so it uses a trick modifying bits while playing a high-pitch frequency to produce somewhat realistic audio. There were a number of programs and games that did this on the PC and Apple II. I even recall one for the TRS-80 Model III where a game would audibly exclaim "Game Over Player One!"

That's what we need now. Ports of this to other platforms! :D

Mike Chambers
September 29th, 2013, 06:11 PM
This is AWESOME! Works fine on my 5150, although the sound is so quiet it's almost inaudible. You should add Sound Blaster support. Don't even need to screw around with DMA. Turn on speakers when the program starts, DSP command 0xD1. Then since you're already using the timer interrupt for outputting each sample, just use the direct 8-bit output SB DSP command 8000 times per second. (output to baseport + 0xC: command 0x10, followed by sample byte to same port) When your program exits, turn off speakers with command 0xD3. Couldn't be easier.

Trixter
September 29th, 2013, 10:29 PM
Ahh ok.. On my model 25 it includes a aweful high pitched whine. Must be something specific to the model 25.

To have something going on (pageflip animation) while the speaker is playing digitized sound is impressive, so you should be impressed that it is not using the sound blaster :)

As for the whine, that's because the playback method is PWM which reproduces the carrier frequency used for playback, and since the playback rate is lower than the rate of human hearing, you hear the carrier wave.

Hey JoJo -- for version 1.1, try doubling the playback rate and just play each sample twice. That will get rid of the high-pitched whine.

Trixter
September 29th, 2013, 10:33 PM
This is AWESOME! Works fine on my 5150, although the sound is so quiet it's almost inaudible.

A "loudness" improvement could be made by just toggling the speaker on and off using only the high bit of the sample. It's the same technique as in the ATOM.EXE demo (http://www.pouet.net/prod.php?which=4066). This is distorted, but it sure is LOUD...


(output to baseport + 0xC: command 0x10, followed by sample byte to same port)

Believe it or not this is double the port writes as outputting to the speaker. It may likely not run fast enough on an XT. Also, the Sound Blaster has a upper limit on samplerate when you do it this way (I think it's 12KHz but don't quote me on that). Any program using a Sound Blaster should use DMA, it's the only sane option (and you get to do stuff while the sound is playing ;-) .

JoJo_ReloadeD
September 29th, 2013, 10:34 PM
To have something going on (pageflip animation) while the speaker is playing digitized sound is impressive, so you should be impressed that it is not using the sound blaster :)

As for the whine, that's because the playback method is PWM which reproduces the carrier frequency used for playback, and since the playback rate is lower than the rate of human hearing, you hear the carrier wave.

Hey JoJo -- for version 1.1, try doubling the playback rate and just play each sample twice. That will get rid of the high-pitched whine.

Tried that, the oversampling, but it still sounded with the high pitch beep...

Trixter
September 29th, 2013, 10:50 PM
It should have worked (it does in other programs). Remember, you don't wait for the interrupt and then output the sample twice; you double the interrupt rate and output the same sample two interrupts in a row. If you have any spare CPU time (usually not on a XT), you can perform linear interpolation to try to smooth out the quantization noise. Some people mistake quantization noise for "whine"...

vwestlife
September 30th, 2013, 04:47 AM
A "loudness" improvement could be made by just toggling the speaker on and off using only the high bit of the sample. It's the same technique as in the ATOM.EXE demo (http://www.pouet.net/prod.php?which=4066). This is distorted, but it sure is LOUD...


http://www.youtube.com/watch?v=HstgfH9FWV4

Mike Chambers
September 30th, 2013, 08:57 AM
A "loudness" improvement could be made by just toggling the speaker on and off using only the high bit of the sample. It's the same technique as in the ATOM.EXE demo (http://www.pouet.net/prod.php?which=4066). This is distorted, but it sure is LOUD...



Believe it or not this is double the port writes as outputting to the speaker. It may likely not run fast enough on an XT. Also, the Sound Blaster has a upper limit on samplerate when you do it this way (I think it's 12KHz but don't quote me on that). Any program using a Sound Blaster should use DMA, it's the only sane option (and you get to do stuff while the sound is playing ;-) .

Yeah, if I were writing a program from scratch to use the SB I would go with DMA, but I thought in this particular case it might be a reasonable option. I was looking at his code, and his audio loop uses HLT before each sample output to wait for the timer interrupt so I would assume there's some idle time in there anyway. In that case, an extra OUT shouldn't hurt anything.

SomeGuy
October 5th, 2013, 08:47 AM
Feature request: support for MDA/Monographics. :D

Finally got around to trying it on my XT clone with a monographics card, and discovered this only supports CGA. But the program still ran and I could hear the sound, the screen was just blank.

Also, loading the samples from disk seems like it could be faster.

Awesome program!

Caluser2000
October 5th, 2013, 11:47 AM
It ran wonderfully on my Taiwanese XT clone using EGA. Although quiet the sound was crisp with no distortion whatsoever.