Jump to content
Sign in to follow this  
Tursi

VGM Compression Tool

Recommended Posts

Rasmus sent me an example of a tune that compressed poorly, and I found a couple more bugs thanks to it! So v102 was just posted:

 

Changed the default frequency lossy compression method to popularity (with scaling for musical notes). The decision of what the notes should become is still a little arbitrary, but it seems(?) to work. The old method is available with the argument -lossyslide

-There was a bug in the lossy slide code too that made it compare against the wrong values and be somewhat arbitrary in what it removed - fixed that.

-There was a bug in the user-defined noise tuning code so that when it needed to tune notes in channel three, it would leave the original note alone and tune it on the next frame instead.

-Improved the previous first-note hack to be a little more resilient, just in case

 

http://harmlesslion.com/software/vgmcomp

  • Like 3

Share this post


Link to post
Share on other sites

Thanks for the continued improvements Tursi.

 

Having said that, I tried the latest version in a virtual machine running Windows 10 on my Mac (all I have, I retired my last Windows machine a year or so ago), but it doesn't seem to work:

  • First it prompts me that I need msvcr100.dll, which isn't installed on my win 10 instance (don't know if this is standard or not)
  • After downloading the dll, the application just errors out (generic error message, "application cannot be started" or somesuch).

Not sure if win 10 is supported or not, am I doing something wrong?

Share this post


Link to post
Share on other sites

Thanks for the continued improvements Tursi.

 

Having said that, I tried the latest version in a virtual machine running Windows 10 on my Mac (all I have, I retired my last Windows machine a year or so ago), but it doesn't seem to work:

  • First it prompts me that I need msvcr100.dll, which isn't installed on my win 10 instance (don't know if this is standard or not)
  • After downloading the dll, the application just errors out (generic error message, "application cannot be started" or somesuch).

Not sure if win 10 is supported or not, am I doing something wrong?

 

It works fine on my real Windows 10.

Share this post


Link to post
Share on other sites

Yeah, usually downloading a single DLL won't do the trick (and most of the DLL download sites are somewhat shady - I don't recommend) - there are two possibilities. You need to install the MSVC runtime (many packages do this for you, that's why not everyone need to), or I accidentally released the debug version and Rasmus can run it because he has MSVC installed. ;)

 

You can find the MSVC runtime installer here: http://www.microsoft.com/en-pk/download/details.aspx?id=26999

 

The code is built for x86, so I think that's the one you'll need. (The page has multiple versions).

 

The generic error you mention can be caused by a lot of things, when it's not DLL dependency errors, it's manifest related, which was a pain that started up for me around Vista. So if installing that package doesn't work and you see it put the DLL in the system properly, let me know and I'll dig into the build process on my end.

Share this post


Link to post
Share on other sites

Tursi, I believe I've found a small bug in the newest version of the compressor: when compressing multiple .vgm files into one .spf file, the resulting file becomes garbled after a second or two when played back. Reverting to the previous version I was using fixed the issue, but unfortunately I'm not sure which version this would exactly be since the program doesn't output a version number. The creation timestamp of the working vgmcomp.exe on my system is 5/5/2014, although that might not be trustworthy since it has been move from computer to computer a couple of times.

 

Let me know if you want the source files to test with, or if there's any other information that would help you chase the bug.

 

(PS: I'm using the -30hz command line option and nothing else, not sure if that makes a difference).

Share this post


Link to post
Share on other sites

I don't keep old versions of the software, best to download the latest and make sure that's the version the bug is happening in. Are you saying that /all/ the songs in the SPF file are corrupted when played back? At the beginning, the end, the middle? I do have source control so I can check for regressions in the code once we prove it.

 

The test files would be handy, I don't have much of a test bed. But I am using the compressor for multiple songs in Super Space Acer without any noted issues.

 

I don't think 30hz should be a problem but I haven't tested it very much. It's worth a look. :)

Share this post


Link to post
Share on other sites

I don't keep old versions of the software, best to download the latest and make sure that's the version the bug is happening in. Are you saying that /all/ the songs in the SPF file are corrupted when played back? At the beginning, the end, the middle? I do have source control so I can check for regressions in the code once we prove it.

 

The test files would be handy, I don't have much of a test bed. But I am using the compressor for multiple songs in Super Space Acer without any noted issues.

 

I don't think 30hz should be a problem but I haven't tested it very much. It's worth a look. :)

 

I can confirm that the problem exists with the newest version and not with the older version I have on my PC. Attached is an archive with the vgm's that trigger the issue for me, it also includes a binary of vgmcomp.exe that does work (in case you need to create a working version to analyze the difference). I basically create an spf file that contains a main theme song first (song 0) and then a bunch of sound effects. Both song 0 as well as the sound effects are impacted. The sound effects all sound mostly wrong (as in none of them sound completely right), and the song start glitching out after 1 or 2 seconds.

 

HTH

Archive.zip

Share this post


Link to post
Share on other sites

Thanks, that was enough to help me home in on the problem. It was a memory corruption that only happened on multiple song banks, caused by a thinko on my part. I've pushed the fixed version, that should fix it up, at least it sounds better on my test! I also made the version number more prominent, you'd only see it before on the help screen.

 

V103: http://harmlesslion.com/software/vgmcomp

Share this post


Link to post
Share on other sites

Tursi, do you happen to know of any kind of windows based software that outputs TI 99 Music play lists which I can use in GPL. Your VGM player is awesome but I cannot use it given that what I am writing will have to stay as pure GPL just for the sake of having a game 100% in GPL. Thanks. Hopefully by April I can launch my new game with some simple music or sound effects.

  • Like 2

Share this post


Link to post
Share on other sites

Tursi, do you happen to know of any kind of windows based software that outputs TI 99 Music play lists which I can use in GPL. Your VGM player is awesome but I cannot use it given that what I am writing will have to stay as pure GPL just for the sake of having a game 100% in GPL. Thanks. Hopefully by April I can launch my new game with some simple music or sound effects.

 

Sound List Ripper should be able to provide you with loads of play lists. Yes, ISR based sound lists to use with GPL.

 

;)

 

ISR = Interrupt Service Routine

Share this post


Link to post
Share on other sites

ISR sound lists are played by assembly code, it just happens to be in the ROM. ;) You COULD write a GPL player for my tunes too. ;)

 

But if you can't find what you need from Sometime's suggestion, sound lists are a pretty simplistic format, I'm sure you can create your own. Beyond that, I have nothing. :)

Share this post


Link to post
Share on other sites

ISR sound lists are played by assembly code, it just happens to be in the ROM. ;) You COULD write a GPL player for my tunes too. ;)

 

But if you can't find what you need from Sometime's suggestion, sound lists are a pretty simplistic format, I'm sure you can create your own. Beyond that, I have nothing. :)

GPL HOW 2 Series

 

http://atariage.com/forums/topic/153704-ti-994a-development-resources/

 

Most of the tools are there if you have a list to run.

Share this post


Link to post
Share on other sites

Could it be that the current version on github is broken with the latest version of gcc? Music plays fine, but sound effects are completely wrong. It might also be that my particular build environment does something the compiler or library doesn't like.

 

I've set up a 'minimal' test environment that shows the problem and pushed it to github: https://github.com/themole-ti/compiler-test

Share this post


Link to post
Share on other sites

Am I doing anything wrong here?:

unsigned char levelsounds[MAX_SOUNDLIST_SIZE];

int main(int argc, char *argv[])
{
	unsigned int    joyst_result;

	// set the interrupt routine
	VDP_INT_CTRL = VDP_INT_CTRL_DISABLE_ALL;
	VDP_INT_HOOK = stplaysfx;

	// Mute all playing stuff
	allstopsfx();
	MUTE_SOUND();

	// Load title music and sound effect into RAM
	rom_to_ram(RES_START(music_theme_1), RES_END(music_theme_1), (unsigned char*)levelsounds);

	// Play song
	stinitsfx(levelsounds, 0);

	// Print how many 'songs' we have in the loaded file?
	vdpchar(0x0000, 48 + stcount(levelsounds));

	while (1)
	{
		// wait for fire
		joyst_result = 0;
		while (!(joyst_result & JOYST_FIRE))
		{
			joyst_result = read_joyst(JOYST_1);

			// wait for vsync
			vdpwaitvint();
		}

		// Pressed fire, make noise!
		sfxinitsfx(levelsounds, 1, 0);
	}

	return 0;
}

Edited by TheMole

Share this post


Link to post
Share on other sites

I have not had opportunity to build or run anything for a long time -- I'm trying to get spare time back. I can't say anything about the latest version of GCC as a result...

 

One suggestion - make sure you stop music and mute before you load the interrupt hook (it's okay if you know the hook is disabled, but it's cleaner not to worry about whether the interrupt might fire before you initialize the player).

 

I don't see anything wrong offhand, sorry for that. Do you have some older code that worked you can try to recompile?

Share this post


Link to post
Share on other sites

Well, I probably should have specified I'm using the 30hz version (I just renamed it to have the same function names as the regular one). I just tried it with the 60hz version and that one works fine (apart from of course playing back everything at twice the speed :) ). Any chance a bug snuck into the 30hz version? I'll try to dig in the code myself to see if there are any immediate differences that jump out at me as being the possible culprit when I get some time.

 

Also, in case it could be a clue, if I call stplaysfx30() directly instead of from the VDP hook, js99er complains about an odd PC address and the whole things simply doesn't work at all. It smells like an alignment issue to me.

Edited by TheMole

Share this post


Link to post
Share on other sites

Odd PC addresses are completely wrong... did you try breakpointing at the vector address to see if it is odd? Having an odd PC stored in the registers can cause surprising breakages (and yet appear to almost work, since the PC itself is only 15 bits).

 

I don't use the 30Hz version myself, but calling directly without the VDP hook I do often enough. There could well be a bug in there... I haven't touched any of it for longer than I'd like and looking at your code the other day was like looking at a foreign moonscape.... ;) The only difference with the 30hz version is /supposed/ to be that it alternates the music and the sound effects on alternate calls, rather than doing them both. At worst you could re-split the 60hz version ;)

Share this post


Link to post
Share on other sites

Also, in case it could be a clue, if I call stplaysfx30() directly instead of from the VDP hook, js99er complains about an odd PC address and the whole things simply doesn't work at all. It smells like an alignment issue to me.

 

Ignore this, I forgot you have to reset the workspace back to 0x8300 manually if you call stplaysfx directly... added an lwpi 0x8300 and now it works for the 60hz version. I figure I'm just going to use that one and call it every other frame (I call it as part of the sprite flicker routine now, which also does different things on even and odd frames, so it's probably a bit faster than the 30hz version anyway :) ).

  • Like 1

Share this post


Link to post
Share on other sites

Ah, excellent! And no problem, it's good to call this stuff out from time to time, helps me remember too ;)

Share this post


Link to post
Share on other sites

Two questions :)

 

1. Is there a MOD converter that can be used with the 60Hz player?

 

2. I am trying to convert a few VGZ files from this site https://vgmrips.net/packs/ and am running into trouble.  I've tried a few different chips and received messages like the one below. Any hints or suggestions?

 

 

D:\>vgmcomp "goonies-02.vgz"

 

v106 - 12/27/2016
Reading goonies-02.vgz - 4047 bytes
Decompressed to 21769 bytes
Unusual clock rate 0Hz. Scale factor 1.#INF00.
weird refresh rate 0

 

goonies-02.vgz
 

  • Like 1

Share this post


Link to post
Share on other sites

Mod converter: http://harmlesslion.com/software/modconvertpsg

Read the readme - it's VERY manual, you have to call out the samples to play as noise rather than tone, and you may need to volume adjust some channels. It only handles 4 channel protracker though.

 

As for the VGZ - it's very likely that the reader can't parse it, since as you see it couldn't find the clock rate, refresh rate or scale factor. The only supported chip is the TI PSG chip - so Master System or ColecoVision source.

 

I'll load up that file and see what it is. :)

 

 

  • Like 1

Share this post


Link to post
Share on other sites

Yeah, that file is for the AY-8910. Only the SN76489 format files are supported by that version of the converter.

 
  • Like 1

Share this post


Link to post
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.

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...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...