Jump to content
IGNORED

VGM Compression Tool


Tursi

Recommended Posts

Ported the ol' Blinkenlights viz from back when I was wrapping up the first tool... actually less a port than a rewrite so I could run it on both TI and Coleco. I didn't test that it properly manages dual chip tunes but it's coded to...

 

Just the piano left to go, then I'll build the chaining tool.

 

https://open.lbry.com/@tursilion:1/vgmcompblinky:f?r=9pDgdsqTMZDnDuNaQFPxMF43B9C3ZoZp

 

 

  • Like 4
  • Thanks 1
Link to comment
Share on other sites

And the Piano viz is in there now, so with that I have released the new version. In addition to the many changes to the Quickplayer, I've also added a binary compress mode to vgmcomp2, so that you can use the decoder as a decompressor as well. The packing is not as good as real lzh style compression (particularly since it can't do RLE as efficiently as it assumes no access to the unpacked data), but it's often good enough and in fact I used it to make the Chuck visualizer's graphics fit in 8k. The documentation has been updated and covers how to use it and how to call the unpacker, but you basically just use vgmcomp2 -pack <filein> <fileout> to pack it, and call getCompressedByte() over and over to unpack it.

 

The quickplayer comes as both a GUI version (just select the desired viz from a dropdown) and a command-line version, with the latter being intended to be easy to port to other systems. They both output the same code and all five visualizers run on both TI and ColecoVision. Only two of them support the secondary chips, though... for the most part I don't expect too many people to use them since the overhead is pretty tall.

 

image.thumb.png.8963255ec52838a3d7e29634f7898475.png

 

Commandline is even simpler, just: quickplayercmd -ti -viz piano -sn splash.sbf d:\classic99\dsk1\SPLASH

 

 

  • Like 2
  • Thanks 2
Link to comment
Share on other sites

In the guise of recent work, I was also inspired by confusion between VGMComp and ROM Playlists...

 

So there is now also a psg2playlist exporter and playlist2psg importer. Mostly good for curiousity, I think, but it was fun to play with @Asmusr's sound list ripper. ;)

 

That's on top of the Extended BASIC sample player routine I added but never mentioned here. ;)

 

Everything was updated: https://github.com/tursilion/vgmcomp2/blob/master/readme.md

 

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

  • 3 weeks later...

By chance anyone knows where you can find sound effect in VGM format ? or if there is a way to convert MP3 to VGM 

I found https://vgmrips.net/ very nice site but you can find only the sound of the video game and not the effects like gunshots ... scream ... sound effects in general ... 

 

@Tursi I tried with voice2psg but without success .... is any example or video tutorial available ?

 

Thanks in advance for a little hand

Edited by whoami999ster
errata corrige
Link to comment
Share on other sites

It's pretty hard to convert samples into discrete notes, and voice2psg doesn't really sound decent until you have 6 or more channels. I'd only use it if you really really need voice samples /and/ you are lucky enough to have a voice that converts well.

 

I wasn't able to find any nice generators for the SN... though I found a generic wave-based one. Maybe it can be altered, I will look when I get some time. 

 

 

 

  • Thanks 1
Link to comment
Share on other sites

On 9/27/2021 at 11:34 AM, whoami999ster said:

By chance anyone knows where you can find sound effect in VGM format ?

While wondering about this, I found sfxr, a neat little tool that can generate chip-style sound effects. It creates WAV files by default, but I hacked it up to generate VGM files with the SN format. I tried to capture the limitations and it's pretty close, but there are a few differences that cause some sounds not to work. The biggest issue is really that it can change the audio much faster than 60hz, and my VGM system is limited to 60hz, so faster sounds will be quantized.

 

But, it's a fun way to generate sound effects quickly, test them online, and download the VGM.

 

https://harmlesslion.com/sn_sfxr/

 

image.thumb.png.546c3f5533068a45c3ad7e7f4d1f417a.png

 

Square wave based sound effects are output on the first channel, and noise type sound effects are generated using custom frequencies on white noise. The VGMComp toolchain has tools to manipulate that if you need noise-channel only (with corresponding decrease in resolution, of course).

 

One other caveat - the VGM is not 100% correct... in particular the length indication in the header is populated with a BS big value. My tools will complain and deal with it, no promises on other tools (but all the ones I've tried cope). The VGM is also not at all optimized - every frame is output whether it needs to be or not.

 

Also, ignore the WAV based stuff on the right, and be merciful with bugs you find - it's the first javascript program I've editted. ;)

 

 

  • Like 4
  • Thanks 3
Link to comment
Share on other sites

3 hours ago, OLD CS1 said:

The VGMs produced lack the 0x66 end of data byte, and something else which is confusing my scripts.  I am investigating.

I think the eof() function in Regina REXX is not working as expected.  I just append an 0x66 byte to the VGM and I can process it into an ISR byte stream.  I also found that no matter what I try, some of my ISR byte streams are not recognized by SoundListRipper.

 

This Powershell 7 one-liner does the trick to append 0x66 byte (with appropriate path/filenames):

(Get-Content -AsByteStream "D:\ISR\sfx\random.vgm")+[byte]0x66|Set-Content -AsByteStream "D:\ISR\sfx\random_fix.vgm"

 

  • Like 1
Link to comment
Share on other sites

3 hours ago, OLD CS1 said:

The VGMs produced lack the 0x66 end of data byte, and something else which is confusing my scripts.  I am investigating.

Sorry about that, I thought about the end byte after I went to bed. It's fixed now. I also realized I'm not dumping straight to disk this time, and so added the code to go back and fix up the end of file position in the header. ;)

 

  • Like 2
Link to comment
Share on other sites

3 minutes ago, OLD CS1 said:

I guess I could use that, too.  I have to check... I think my export creates that header but my import ignores it.

I don't think I use it either, but I check it cause I wanted the import code to tell me if something was malformed ;)

 

Link to comment
Share on other sites

17 hours ago, Tursi said:

I don't think I use it either, but I check it cause I wanted the import code to tell me if something was malformed ;)

My method of conversion is oafish and uncivilized, but it is working with these generated VGMs.  I have been building a small library of sound effects over the years, and this handy tool puts me out of work.

  • Like 3
Link to comment
Share on other sites

  • 5 months later...

Oh wow.. holy cow!!  I've been away for quite a while; sorry for arriving back so late to the party.  I see this VGM compression/conversion software has come super far along just as promised.  The last time I checked in on this post (wow, almost 2 years ago now) we could only compress/playback .VGMs for the SN76489 specifically which still provided access to a huge archive of awesome music from multiple systems.  Back then I figured out how to convert NES music to SN76489 oriented VGM format manually by copying/pasting the track information out of one tracker to another.  Now it's great to see the new conversion tools can do this automatically but not to mention all those other chips it handles...  where even to begin :)

 

Naturally I want to get in on this but unfortunately I seem to be having a problem with the QuickPlayer.  When I give it a prepared .SBF and build the files, it creates 2 files but when I look at these files with TIDir (the PC program I use to create disk images) only one of them is seen as a TI program file and the other one shows as a PC DOS file.  Shouldn't both of these files be TI files?  I try copying them into a .DSK image I made with TIDir and the TI program file copies over fine but for the PC DOS file it asks me what kind of file to copy it over as.  I copied it over as a program file but it seems to be corrupt when I try accessing it in Classic99.  I tried loading both files in EA option #5 but I get I/O error code 7.

 

I tried this with a few different VGMs from NES and SEGA but always the same results, even with some of the same SEGA VGMs that I got to work previously with the old compression tool.  Just to provide some more detail on my complete process (using a SEGA VGM for simplicity sake): I start with vgm_psg2psg to extract the individual tracks out of the VGM, then use prepare4SN to make a single file out of the individual tracks, then use vgmcomp2 to compress this single file into a .SBF file.  All of these steps seem to work fine--I get no errors and the TestPlayer plays all the files up to this point, even the final .SBF file.  So I don't know if the problem is with the QuickPlayer or is it something on my end?--am I not understanding something correctly?  The old QuickPlayer (which sadly I no longer have due to a hard drive crash) used to spit out 2 files, one with an "A" at the end and the other with a "B"--or maybe that was just my own naming convention, I can't remember honestly but the first file--the one that ended in "A" was the one to be run in EA option 5.  But as I say, the new QuickPlayer is only producing one TI file, the other seemingly a PC file and neither being able to load in EA...  can anybody clear up this mystery for me?   Would be greatly appreciated as I am just a humble BASIC programmer and haven't the knowledge to use this music proper in assembly. :)

Link to comment
Share on other sites

Well, as I don't feel like hacking into your computer, I'll have to ask you to show me the files you are asking about. ;)

 

Which quickplayer are you using, the GUI or the command line?

 

Are you telling it TI output?

 

Those are off the top of my head, I don't know what is going wrong. If you can please post your SBF and the two output files, I'll try to reproduce the problem. That way I can either answer the question or show you the step you're missing. :) It's possible I broke something at some point - the quickplayer tools do a lot. But I was pretty sure I tested them pretty well when I added the visualizers to them.

 

 

 

  • Haha 1
Link to comment
Share on other sites

(For what it's worth, the number of output files on the TI is dependent on how large the output program is - that's Editor/Assembler #5 convention which splits the binary program into 8k chunks. But they should all be valid TI files ;) )

 

Link to comment
Share on other sites

Thanks Tursi.  I was using the GUI version which is set to TI-99/4a by default, I left the dropdown selection on QuickPlayer (didn't choose any of the visualizers though I did try one at some point in my many attempts), usually checked Loop playback though I did some tests without it, plugged in the .SBF file in the field directly underneath labeled SN Music, pretty much left everything else as is (had no SID music, left the 3 channels set to pulse and usually tried typing something in the text window though sometimes I'd try leaving this blank as well).  Clicked Build, typed sonic for the filename and the program outputted 2 files named sonic and sonid, the first of which sonic is showing up as a DOS file, the other is a TI file.  I've included them in the attached .zip along with the .SBF that I made them with in the QuickPlayer.

 

I had actually forgotten about the command line version of QuickPlayer so I just tried that out and unfortunately things just got weirder.  The command line version takes the same .SBF and outputs 2 files again, but this time they are both showing up as TI files in TIDir.  So I figured it was working and I dropped those two files into a .DSK image and mounted that in Classic99.  But both files give me I/O error code 7 when trying to run in EA option 5.  I've also included those 2 files in the .zip--they are built from the same .SBF and are named TEST and TESU.

 

Much appreciated you looking into this for me!

test.zip

Link to comment
Share on other sites

I checked these files and noted that yeah, SONIC has corruption to the TIFILES header. It's okay, in general, but the TIFILES part is corrupted. Despite that (somehow) Classic99 loaded and ran the files... possibly this is why I never saw it.

 

As usual, I will discourage using disk images for development with Classic99, I think it's a terrible way to treat an open filesystem. ;) But I think I know your issue.

 

Are you running DSK1.TEST or DSK1.test? Remember the TI Filesystem is case sensitive, and you sent me lowercase filenames. I ask because I made this exact error when I made the image with TI99Dir. FILE NOT FOUND is also returned as error code 7. ;)

 

As for the invalid header - looks like I found that when I wrote the command line version of the player and forgot to port the fix back to the GUI player - it was one of the patches for number of lines of text available. I'll push a fix for all that in the next 30 mins. But the command line quickplayer is outputting valid files.

 

  • Like 1
Link to comment
Share on other sites

Thanks again.  You were right about that--I was indeed trying to load all these files using all caps.  Actually you really cleared up a couple mysteries for me--for one, I wasn't really sure if you could even use lowercase characters for file names on the TI and I figured it defaulted to all caps.  And so I just assumed TIDir was writing the filenames in all caps when I copied them into the .DSK image.  I guess I just wasn't paying enough attention cause sure enough, TIDir clearly shows that the files retain their lowercase names within the .DSK image.

 

Didn't realize it was recommended not to use .DSK images in Classic99...  can understand the argument for an open file system.  I've been using .DSK images just cause it's easy to transfer them to my CF7 and most of the time I'm using the real machine.

 

  • Like 1
Link to comment
Share on other sites

That's why everything I build writes TIFILES files - that's what Classic99 was built around. DSK image support exists at all only because people are very insistent. ;) But I don't use it except to test and so it can be considered second class.

 

Transferring to real hardware is nice, for sure. I got enough docs to make a proper DSR for the CF7, but I found that it's pretty flakey in 8-bit mode, which would be needed to access a real file system. Only like 1 in 6 CF cards I tested worked that way (and I don't think it's the CF7's fault, but the cards themselves). That was the system I built to program the Dragon's Lair boards. ;) But that proved it is technically possible... it would probably be pretty slow. Anyway, not even on my list, that one.

 

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

@Tursi, I have tried out the latest version of Quick Player so I can use the animations like Chuck in the converted songs. 

Problem is that I can't load the finished files on my TI with E/A.

I have put the files on a TIPI folder and when I look at the files it says that file 01A is a DIS/FIX128 and 01B is a PROGRAM.

It load and works perfect on your TI-99 emulator.

I have tried it several times with the same result, I attach the latest files in case it may be helpful to find what I do wrong.

 

 

01A 01B

  • Sad 1
Link to comment
Share on other sites

[mention=12959]Tursi[/mention], I have tried out the latest version of Quick Player so I can use the animations like Chuck in the converted songs. 
Problem is that I can't load the finished files on my TI with E/A.
I have put the files on a TIPI folder and when I look at the files it says that file 01A is a DIS/FIX128 and 01B is a PROGRAM.
It load and works perfect on your TI-99 emulator.
I have tried it several times with the same result, I attach the latest files in case it may be helpful to find what I do wrong.
 
 
01A 01B
Have you made sure both files are TI files format? You can use the web interface or TIdir to check

Sent from my Pixel 6 Pro using Tapatalk

Link to comment
Share on other sites

15 hours ago, arcadeshopper said:

Have you made sure both files are TI files format? You can use the web interface or TIdir to check

Sent from my Pixel 6 Pro using Tapatalk
 

The web interface has a question mark on the A01 file but not on the B01, so I guess it says A01 is not a TI file. But I don't understand why, it comes straight from the Quick Player and it´s saved in TI-format.

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.

Guest
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.

Loading...
  • Recently Browsing   0 members

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