Famicom-music on VIC-20

Discuss anything related to the VIC
User avatar
tokra
Vic 20 Scientist
Posts: 1123
Joined: Tue Apr 27, 2010 5:32 pm
Location: Scheessel, Germany

Famicom-music on VIC-20

Post 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.
User avatar
Noizer
Vic 20 Devotee
Posts: 297
Joined: Tue May 15, 2018 12:00 pm
Location: Europa

Re: Famicom-music on VIC-20

Post by Noizer »

very promising and loud !🕺🏽
Valid rule today as earlier: 1 Byte = 8 Bits
-._/classes instead of masses\_.-
User avatar
nbla000
Salmon Run
Posts: 2582
Joined: Thu Oct 13, 2005 8:58 am
Location: Italy

Re: Famicom-music on VIC-20

Post by nbla000 »

Awesome!
Mega-Cart: the cartridge you plug in once and for all.
User avatar
ThePhotoChemist
Vic 20 Newbie
Posts: 14
Joined: Sat Mar 13, 2021 9:11 am
Website: http://www.jonhilty.com
Location: Grand Rapids, MI

Re: Famicom-music on VIC-20

Post 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 :lol:

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.
Attachments
Gold.zip
(5.24 KiB) Downloaded 68 times
DeathEgg.zip
(3.87 KiB) Downloaded 68 times
User avatar
tokra
Vic 20 Scientist
Posts: 1123
Joined: Tue Apr 27, 2010 5:32 pm
Location: Scheessel, Germany

Re: Famicom-music on VIC-20

Post 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.
aeb
Vic 20 Amateur
Posts: 68
Joined: Sat Jun 19, 2004 2:06 pm

Re: Famicom-music on VIC-20

Post by aeb »

Impressive! :)
User avatar
nbla000
Salmon Run
Posts: 2582
Joined: Thu Oct 13, 2005 8:58 am
Location: Italy

Re: Famicom-music on VIC-20

Post 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)
Mega-Cart: the cartridge you plug in once and for all.
User avatar
ThePhotoChemist
Vic 20 Newbie
Posts: 14
Joined: Sat Mar 13, 2021 9:11 am
Website: http://www.jonhilty.com
Location: Grand Rapids, MI

Re: Famicom-music on VIC-20

Post 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 :D
User avatar
beamrider
Vic 20 Scientist
Posts: 1452
Joined: Sun Oct 17, 2010 2:28 pm
Location: UK

Re: Famicom-music on VIC-20

Post 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.
User avatar
ThePhotoChemist
Vic 20 Newbie
Posts: 14
Joined: Sat Mar 13, 2021 9:11 am
Website: http://www.jonhilty.com
Location: Grand Rapids, MI

Re: Famicom-music on VIC-20

Post 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.
Attachments
WilysCastle.zip
(2.32 KiB) Downloaded 73 times
User avatar
Gorf
Vic 20 Dabbler
Posts: 92
Joined: Tue Feb 09, 2016 6:55 pm
Website: http://home.macintosh.garden/~europa/
Location: United States
Occupation: Eccentric Musician

Re: Famicom-music on VIC-20

Post 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. :D
User avatar
ThePhotoChemist
Vic 20 Newbie
Posts: 14
Joined: Sat Mar 13, 2021 9:11 am
Website: http://www.jonhilty.com
Location: Grand Rapids, MI

Re: Famicom-music on VIC-20

Post 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. :D
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
User avatar
nbla000
Salmon Run
Posts: 2582
Joined: Thu Oct 13, 2005 8:58 am
Location: Italy

Re: Famicom-music on VIC-20

Post by nbla000 »

wow, talking about classic famicon titles and musics... what about mb and smb saga?
Mega-Cart: the cartridge you plug in once and for all.
User avatar
ThePhotoChemist
Vic 20 Newbie
Posts: 14
Joined: Sat Mar 13, 2021 9:11 am
Website: http://www.jonhilty.com
Location: Grand Rapids, MI

Re: Famicom-music on VIC-20

Post 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!
Attachments
Mario1.zip
(1.96 KiB) Downloaded 69 times
MOON3.zip
(3.53 KiB) Downloaded 66 times
ATHLETIC.zip
(1.96 KiB) Downloaded 71 times
User avatar
nbla000
Salmon Run
Posts: 2582
Joined: Thu Oct 13, 2005 8:58 am
Location: Italy

Re: Famicom-music on VIC-20

Post 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!
Mega-Cart: the cartridge you plug in once and for all.
Post Reply