Pulse Sounds..

Basic and Machine Language

Moderator: Moderators

Post Reply
andym00
Vic 20 Newbie
Posts: 16
Joined: Sun Jan 30, 2011 10:50 am

Pulse Sounds..

Post by andym00 »

Well, actually more about synthesising lots of software voices, but with little CPU overhead, well much less than traditional means, and the bonus is the voices are playing back at 15.6K.. Really :)

It's an idea from a long time ago, and after a few silly ideas ideas ended up with something useful..

So, without further ado, here's a demo of it for the unexpanded VIC..

In the pacfollin.zip at https://sites.google.com/site/andym00/files

There's the original development of the idea here:
http://formatwar.net/forums/viewtopic.php?f=5&t=265
Although it started off on the Atari A8 since I really didn't think the ~1MHz machines would have the power for it, but a revelation in being able to (essentially) compress the output samples so we have way less interrupts than usual due to the nature of the pulse waves we're synthesising made for a game changer..

In this demo, the colours bars off the irq at the bottom of the screen do nothing other than..

Code: Select all

IRQ:
			lda $9124
			dec $900f
			ldy #$0
-
			inc $900f
			inc $900f
			inc $900f
			dec $900f
			dec $900f
			dec $900f
			dey
			bne -
			inc $900f
			jmp	$eb18
It's simply there to burn cycles and show how much time left in the main loop for synthesis is required, and how much the interrupts slow down the code..

Also this version doesn't due the full NSF driver emulation.. It's simply playback a cached version of the registers, even so, this pacfollin tune still only comes to 1.5K.. Huge I know for what it is, but there's no way I can get the NSF driver working on the VIC due to the memory map.. But since using the NSF driver was merely a stepping stone to writing a proper music driver for this it did the job nicely..

I've also done a 64 version, which is exactly the same bar the VIAs make it some cycles quicker (and less memory) to setup the time to the next sample, it also show you more how much cpu time it actually uses..
http://noname.c64.org/csdb/release/?id=106466

And the code is there as well for the core of it..
http://noname.c64.org/csdb/forums/?room ... icid=90296

It's a lot less CPU time than you might imagine, and doesn't sound too bad, although the VICs volume register doesn't sound as nice as the SIDs..
FD22
Vic 20 Hobbyist
Posts: 148
Joined: Mon Feb 15, 2010 12:31 pm

Post by FD22 »

Impressive!
User avatar
Witzo
Vic 20 Afficionado
Posts: 381
Joined: Thu Dec 01, 2011 9:14 am
Location: The Hague

Post by Witzo »

I ran

https://sites.google.com/site/andym00/f ... ects=0&d=1

and it sounds remarkably un-VIC-like; that these things are even possible.

Where is the music from?
andym00
Vic 20 Newbie
Posts: 16
Joined: Sun Jan 30, 2011 10:50 am

Post by andym00 »

Well the whole thing was initially just an idea of a way to synthesis some additional voices without the normal massive cpu-overhead required..
To test it out, rather than writing a full blown music driver in parallel, I simply grabbed so NES NSF music files, and then wrote a later to convert the 3 main channels to my driver..
Unfortunately on the VIC there's not enough memory to do this, so I just captured the tunes APU register output, and stored that, simply to get it working..
The code itself is tiny for the playback system, and the CPU overhead would really surprise you ;)
And once it has a proper music driver in place, rather than the NES NSF player, things will get brighter, and less memory intensive..
User avatar
Kweepa
Vic 20 Scientist
Posts: 1315
Joined: Fri Jan 04, 2008 5:11 pm
Location: Austin, Texas
Occupation: Game maker

Post by Kweepa »

Pretty cool!
I don't quite understand. Are the borders indicative of how much CPU is free? If so is it the blue bit or the multicolour bit that is the free time?
andym00
Vic 20 Newbie
Posts: 16
Joined: Sun Jan 30, 2011 10:50 am

Post by andym00 »

Erm, it's not clear is it, but I didn't have the memory for a fancy CPU load like the 64 version..

The multicoloured bit is just a fixed loop (of ~10000 cycles) run from a per frame interrupt.. It's there to show how much variance there is from the interrupts running in the background, hence why it varies in time..

The blue bit is just how much CPU is free after the interrupts fixed timing thing has finished.. The actual synthesis doesn't take all of that time, although the load varies depending upon the frequencies of the notes being synthesised..

I should have put in some better cpu load display, but for some reason I really wanted to get this into an unexpanded VIC, for reasons I'm not entirely sure of myself ;)
Vic20-Ian
Vic 20 Scientist
Posts: 1214
Joined: Sun Aug 24, 2008 1:58 pm

Post by Vic20-Ian »

Sounds good, tried it on Vice and get some fuzzy bars top and bottom and a short loop of what sounds like a Pop remix of Pacman!

I agree it is very unlike a Vic.

Try datapop on this forum also.

http://sleepingelephant.com/ipw-web/bul ... ht=datapop
Vic20-Ian

The best things in life are Vic-20

Upgrade all new gadgets and mobiles to 3583 Bytes Free today! Ready
matsondawson
The Most Noble Order of Denial
Posts: 343
Joined: Fri May 01, 2009 4:44 pm

Post by matsondawson »

Here's the JS Vic20 link for those to lazy to download and vice it.

http://www.mdawson.net/vic20chrome/vic2 ... eType=ntsc

Took me ages to figure out why it didnt' work in NTSC turned out to be the branch not taken interrupt ignoring feature of the 6502. Oddly enough it really sucks the cpu emulating it. But I have things in motion for a 5+ times speed up. It should run 100% speed on Android when I'm done.
User avatar
Jeff-20
Denial Founder
Posts: 5759
Joined: Wed Dec 31, 1969 6:00 pm

Post by Jeff-20 »

I just love that online VIC script so much!
High Scores, Links, and Jeff's Basic Games page.
Post Reply