Page 1 of 3
Famicom-music on VIC-20
Posted: Sat Mar 13, 2021 7:24 am
by tokra
Just found this on Reddit r/vic20 and it was too good not to crosspost here:
https://www.reddit.com/r/vic20/comments ... mitracker/
https://www.reddit.com/r/vic20/comments ... converted/
This Megaman 2-music sure is catchy. Sounds better in NTSC I think.
Re: Famicom-music on VIC-20
Posted: Sat Mar 13, 2021 8:08 am
by Noizer
very promising and loud !

Re: Famicom-music on VIC-20
Posted: Sun Mar 14, 2021 12:53 am
by nbla000
Awesome!
Re: Famicom-music on VIC-20
Posted: Sun Mar 14, 2021 11:36 am
by ThePhotoChemist
Hey everyone! I'm glad you like the project so far. I was lucky enough to snag a VIC-20 off of Craigslist last year for dirt cheap, and I've really enjoyed learning about and working with Commodore computers. This started as an afternoon side-project while I work on a machine to laser cut music box punch tape, and I ended up going down a huge rabbit hole, and learning assembly along the way!
The github for the python script I'm writing to convert Famitracker .txt exports to VIC PRGs can be found here:
https://github.com/ThePhotoChemist/Fami2Vic
Big warning, it's very much a WIP project and isn't really intuitive to use yet...
I've recompiled the Ecstasy of Gold PRG for PAL and NTSC systems, as well as another song I've been working on. I didn't recompile the Megaman 2 song yet, since I seem to have created a bug where it plays a bunch of extra notes now for whatever reason, and I don't have time to hunt it down today
Both files still need an 8K (or higher) expansion. My original goal was to try and shoot for being able to run on unexpanded systems, but some of these songs seem to simply have
too many notes, and I'm out of ideas on how to reduce size further.
Here's the video of the new PRG, the "Death Egg Robo" theme from Sonic 2.
https://www.youtube.com/watch?v=LZuVxmvGZtY
Ultimately I would like to start converting entire soundtracks to games and releasing them as D64s, probably starting with Castlevania. Most vanilla NES songs I've thrown at it so far sound pretty good. Newer arrangements using expansion chips are a lot more challenging, but I have some ideas on how to implement support.
I have one quick question, for whoever might be able to answer... What can I look at in memory to determine whether the system is PAL or NTSC? I had a cursory glance yesterday, but I wasn't able to find too much. Once I figure that out, it should be really simple to have a PRG that can support both systems.
Re: Famicom-music on VIC-20
Posted: Sun Mar 14, 2021 11:48 am
by tokra
ThePhotoChemist wrote: βSun Mar 14, 2021 11:36 amI have one quick question, for whoever might be able to answer... What can I look at in memory to determine whether the system is PAL or NTSC? I had a cursory glance yesterday, but I wasn't able to find too much. Once I figure that out, it should be really simple to have a PRG that can support both systems.
Welcome to Denial!
That would be address 60900 ($ede4) in KERNAL-ROM. This will contain 12 on PAL and 5 on NTSC. This is the setup-table for the VIC-chip for register $9000 and on NTSC this is 5 since it has less cycles per rasterline than PAL.
Re: Famicom-music on VIC-20
Posted: Mon Mar 15, 2021 1:02 pm
by aeb
Impressive!

Re: Famicom-music on VIC-20
Posted: Wed Mar 17, 2021 2:00 am
by nbla000
tokra wrote: βSun Mar 14, 2021 11:48 am
That would be address 60900 ($ede4) in KERNAL-ROM. This will contain 12 on PAL and 5 on NTSC.
Just to point out, for PAL the value 12 is decimal ($0C hexadecimal)
Re: Famicom-music on VIC-20
Posted: Wed Mar 17, 2021 6:20 am
by ThePhotoChemist
tokra wrote: βSun Mar 14, 2021 11:48 am
ThePhotoChemist wrote: βSun Mar 14, 2021 11:36 amI have one quick question, for whoever might be able to answer... What can I look at in memory to determine whether the system is PAL or NTSC? I had a cursory glance yesterday, but I wasn't able to find too much. Once I figure that out, it should be really simple to have a PRG that can support both systems.
Welcome to Denial!
That would be address 60900 ($ede4) in KERNAL-ROM. This will contain 12 on PAL and 5 on NTSC. This is the setup-table for the VIC-chip for register $9000 and on NTSC this is 5 since it has less cycles per rasterline than PAL.
Thanks! This did the trick. I haven't had time to clean up the rest of the code on the Wily PRG just yet, but now the PRG will autodetect the system and pull the tone values from a different table, depending on whether it's NTSC and PAL. It'll load a different tempo too. That should have my bases covered now, I think!
nbla000 wrote: βWed Mar 17, 2021 2:00 am
tokra wrote: βSun Mar 14, 2021 11:48 am
That would be address 60900 ($ede4) in KERNAL-ROM. This will contain 12 on PAL and 5 on NTSC.
Just to point out, for PAL the value 12 is decimal ($0C hexadecimal)
Much appreciated! Luckily, my brain still defaults to decimal instead of hex, so this wasn't a problem

Re: Famicom-music on VIC-20
Posted: Wed Mar 17, 2021 10:46 am
by beamrider
Very Impressive. Not used to hearing such polished tunes on the Vic.
btw, I see they have a new 'tracker' in the pipline over on the
TRSE project that outputs Vic-20 code amongst others. Maybe worth considering a version of your script to output into that format for use in games and demos etc.
Re: Famicom-music on VIC-20
Posted: Wed Mar 17, 2021 3:06 pm
by ThePhotoChemist
beamrider wrote: βWed Mar 17, 2021 10:46 am
Very Impressive. Not used to hearing such polished tunes on the Vic.
btw, I see they have a new 'tracker' in the pipline over on the
TRSE project that outputs Vic-20 code amongst others. Maybe worth considering a version of your script to output into that format for use in games and demos etc.
Interesting! I'll check it out and see what I can do.
Here's an updated version of Wily's Castle from Megaman, which should now be compatible with both NTSC and PAL systems.
Re: Famicom-music on VIC-20
Posted: Fri Mar 19, 2021 7:53 am
by Gorf
This is epic! Will be fun to play around with this when I get time. I'm a particular fan of Kirby's Adventure and Gradius, so I'll be excited to see how they sound on the VIC.

Re: Famicom-music on VIC-20
Posted: Fri Mar 19, 2021 4:47 pm
by ThePhotoChemist
Gorf wrote: βFri Mar 19, 2021 7:53 am
This is epic! Will be fun to play around with this when I get time. I'm a particular fan of Kirby's Adventure and Gradius, so I'll be excited to see how they sound on the VIC.
Thanks!
Just for fun I ran the only song I recognized from that game through the script. It's kinda... shrill. This one is weird, since it actually uses the triangle voice as a part of the melody, whereas most of these songs use it for the bassline. There are offsets in the script to shift the output data up/down octaves, but pushing it much lower made it sound kind of weird, just a bit too low.
Right now you sort of have to play around with those offsets, and shift things around until things sound right. Each channel is limited to about six octaves (B0 - B5), but you can kind of manually get around that sometimes for a larger range, since each of the VIC's square wave oscillators are also offset by one octave from each other. Ideally, the patterns with higher notes from the triangle channel (S1 in the VIC) could be manually swapped with Square1 or Square2 in Famitracker or Famistudio first for a better sound.
https://www.youtube.com/watch?v=fCY0WBFvTsA
Also for some reason any time I even think about updating the code, the noise track breaks Β―\_(γ)_/Β― Oh well
Re: Famicom-music on VIC-20
Posted: Sat Mar 20, 2021 3:49 am
by nbla000
wow, talking about classic famicon titles and musics... what about mb and smb saga?
Re: Famicom-music on VIC-20
Posted: Tue Mar 23, 2021 8:31 pm
by ThePhotoChemist
nbla000 wrote: βSat Mar 20, 2021 3:49 am
wow, talking about classic famicon titles and musics... what about mb and smb saga?
Here's some Mario for you!
https://www.youtube.com/watch?v=hObMuc5bbKw
https://www.youtube.com/watch?v=Z8REr1Z4uIE
Also, here's another one I thought was really neat. Moonlight Sonata Mvt. 3, arranged by Chips n' Cellos.
https://www.youtube.com/watch?v=OEYOvSHw5oA
I made some improvements to the script. Since the VIC's oscillators are offset each by an octave, you also have to apply an offset to the Famitracker data to get them all in line with each other. Before, if the tone array underflowed (e.g. the offset was too much and it tried to select a negative element), the script would exit with a warning. Now, it just mutes any notes outside of the range. This makes more complex songs that use a large range like the Moonlight Sonata possible. Some of the very low notes get cut off, but it's hard to notice unless you're really listening for it.
Repeated notes tend to blur together sometimes. This is because some of these NES songs didn't actually use a "stop note", but instead would lower and raise the volume. This is especially apparent in the Mario Athletic theme. I'm thinking, if the script detects a big jump up in volume, it might add a pause for a few frames, just to separate the notes a bit.
I'd say my work on the Castlevania soundtrack is about 75% done now!
Re: Famicom-music on VIC-20
Posted: Wed Mar 24, 2021 4:54 am
by nbla000
Many thanks, I've just tested your music on my real PAL Vic-20, Mario is Fantastic, I've also compared it with
the nes version and is really impressive, very good job!