Jump to content

VGM music


Recommended Posts

I found this tune, Sonic Chaos by Chris Kelly, on http://www.smspower.org/Music/Homebrew


I converted it from VGM to EPSGMOD format, adjusted the bass notes (periodic noise) for the TMS9919, and set it up to play with Tursi's player. The result is on the attached disk (E/A#3: SONICCHAOS or E/A#5:SONICC).




It's pretty amazing what you can do with our little PSG...
@Tursi, any update on your VGM player?
  • Like 2
Link to comment
Share on other sites

Just ran this in Classic99... sounds awseome!


BTW, wanted to ask you about the maps for Road Hunter and Titanium - I see that you have INT/FIX 80 files in the archives; are these loaded dynamically so that you can update/load maps on the fly? Just curious. :)

Link to comment
Share on other sites

BTW, wanted to ask you about the maps for Road Hunter and Titanium - I see that you have INT/FIX 80 files in the archives; are these loaded dynamically so that you can update/load maps on the fly? Just curious. :)


Yes, Titanium and Road Hunter are loading the maps from disk when needed because I can't fit them all into RAM. For Scramble I managed to avoid it by using compression.

Link to comment
Share on other sites

(edit: fixed video links, added NES and VGM vids)


@Tursi, any update on your VGM player?

I've been working on the compressor again for the last few weeks, I have a couple hours a day on the train to work. As of this week I got the compression working reliably and the TI player working (so the one that's currently in libti99 will be changing, but since nobody but me had the compressor I suppose that's a moot point anyway). I'm a little unhappy about the complexity of the result, but, I suppose the results are decent.


It's not quite ready for release, though.. I need to do a little more before I can put the demo together. But I can talk about it a bit.


I've been after better music for a long time, but until I stumbled upon the PSGMod Tracker in 2007, I didn't realize how much potential our little sound chip had. I ported the player and released a sample app (http://www.harmlesslion.com/cgi-bin/onesoft.cgi?107, https://www.youtube.com/watch?v=lI4c0-mSdYM). This seemed good, since there was also a nice tracker app. But.. the updated release didn't come out, and the player was encumbered, and the MOD import frustrated me for not being able to map channels very well.


So that led to me working on my Protracker MOD converter in 2010 (http://www.harmlesslion.com/cgi-bin/onesoft.cgi?119), which I apparently didn't demo on YouTube till a year later (https://www.youtube.com/watch?v=nvBTdGuuncU). (It wasn't my first stab at a MOD player - I had a little player going in the 80's that just read the note table and sort of played Twinkle Twinkle Little Star, one of the few MODs I had that fit, but.. it didn't work really well and I was getting better results by hand-converting the MODs (Run EA#5 "DSK1.DEMO" in your Classic99 folder unless you deleted the files it came with ;) ).


When I did the MOD converter I made a decision that VGM was the format to use going forward. It's completely inappropriate for playback on the TI as-is, being a very, very bloated format (every byte to the sound chip has a control byte preceding it, at least doubling the size of every file.) VGM is a recording, rather than a command or track based format, but I expected that some compression would tame the file size a bit - for instance gzipped VGM files are not too bad. We can't really handle GZIP, so I had to do something else. My first pass at the compressor was here (https://www.youtube.com/watch?v=UnpIz6CZxXY) and second was here (https://www.youtube.com/watch?v=XCuP-seOXY0) - I was trying to show the number of tunes I could fit into 24k. ;) At the time the five songs took about 32k, thus I needed two programs. Today they compress to about 26k - wouldn't quite fit in 24k but I could probably squeeze them into the 32k with the player. ;)


In order to try to maximize the free memory for other tasks, I decided to do a real time decompression straight to the sound chip, without decompression buffers. The resulting overly complicated format will be fully documented in the release notes, but at the simplest level, it breaks the audio up into separate streams to maximize redundancy, then performs for RLE and string compression on the result.


I have all my MOD files and much of the SMS Power collection to test against, and most files end up about 20% the size of the original VGM (remember that the VGM, though, is twice the size of the mere audio data to start with). Out of the 1530 files I tested, only 9 were larger than 32k, and only another 6 were larger than 24k. (I suppose it's fair to note that beyond the converted MODs, most of the Game Gear tracks were short enough that the VGM itself wasn't much bigger than 32k.)


So it's close, and the TI Player is working. The last feature I need to add to the compressor is the ability to combine multiple sounds into a single bank, so they can share compression data (which may or may not be worth it, I'm still investigating, my first pass suggested yes but also broke horribly), and the player needs the ability to play prioritized sound effects that override channels of the music - that's mostly working in the Colecovision version of the player but not the TI one.


The features that it has and works: conversion of most VGM files containing the SMS/Coleco/TI sound chip, automatic ignore with warning of other chips, detection of 50hz and conversion to 60hz playback, detection and pitch correction of 16-bit user-defined noise channels to the TI's 15-bit noise, optional pitch correction of non-standard clock rates (I haven't seen any save one that PSGMod wrote), conversion to 8-level volume (for better compression), conversion to 30hz playback (to allow interleave of sound effects, reduce CPU, or improve compression - this function attempts to preserve arpeggio, too), and one tiny tweak to the compressor that lets you define how many uncompressed bytes live at the beginning of each stream (normally 63 bytes, which tends to make up for itself on most tunes, but for very small sounds it may make sense to reduce this, and 0 is an allowed option).


What it doesn't have right now is any kind of header. I'm still trying to decide whether I should add a word to track how many songs it contains and whether it's 30hz, or just make the programmer know. I suppose I will add it but then not rely on it myself, then if people like me want to overwrite that one word and reclaim it, we can. ;)


The lib will eventually contain separate playback functions for single song, song with sound effects, and both options at 30hz instead of 60hz. Since the linker only pulls in the code it uses, making separate functions should allow programs that need fewer functions to require less memory.


I don't have an ETA yet, I was hoping to post a YouTube demo this weekend, but the multi-song packing needs to work first. Another week or two, I hope. (I have a Classic99 update that needs a bit more polish too). I only have about 2.5 hrs a day, a few days a week, for projects right now, and that's on a train, so all output has slowed. :)


Afterwards, I plan to revamp the MOD converter and try to make my NES/NSF converter https://www.youtube.com/watch?v=OC4DWUglg4g) into something releasable.

Edited by Tursi
  • Like 3
Link to comment
Share on other sites

Excellent news that your project has progressed that far. :) How big is the TI player and how many clock cycles does it use (rough estimate)?

The single track player takes 590 bytes of code and 156 bytes of RAM (including workspace). It is currently designed to store its variables in 8-bit RAM and workspace in scratchpad. I ran some timing loops in Classic99 and for a moderately complex MOD it took between 1000 and 10,000 cycles per frame, with an average of 2000. (It depends on how many streams it needs to fetch new unpack instructions for). This is roughly 2-20%, with an average of 4%. When I add sound effect playback, memory usage will increase to about 280 bytes (for two song playbacks). CPU usage could double but in theory most sound effects won't use all four channels when you also have music playing. If it is that bad, the 30hz mode allows you to alternate music and sound effects on alternate ticks.


(This compares with the EPSGMOD player taking about 1892 bytes of code space, and about 162 bytes of RAM including workspace (plus a nearly 2k vibrato table). I don't remember the CPU usage of that one but I thought it was around 25-30%? All for just the song.)


BTW, perhaps you can explain why a 14K VGM file (MISSION76496) grows to 31K when converted to epsgmod? I thought the latter was a much more compact format.

I took a look. The answer is that it's a compressed VGM (used to be these were tagged as "vgz") -- it has been gzipped. Unzipped, it's 94k.


My compressor takes that tune to 16,766 bytes with default settings, so I'm happy with that result (and that's a good test!) Right now it only works with uncompressed VGMs, but if they are not even changing the extension anymore, maybe it's time to drop a quick unzip in there too.




Is that Axel F you ported this Amiga MOD, Tursi?

If so, it's a pretty darn good port!

That's the one! Thank you!


WOW !!! so i could port my old .MOD on the TI99 ? :lust: :lust: :lust:

Protracker only at the moment, unless I can find a better playback library to hack into. But I've got a collection of about 230 that I've been using for testing. The one manual step is that you must be able to tell it which samples you want it to play as noise... if it tries to run all four channels as tones at the same time, it will attempt arpeggio on one of them, results range from 'barely okay' to 'not very happy', so it works best with a drum beat. ;)

  • Like 3
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...