Jump to content
IGNORED

RMT2LZSS: convert RMT tunes to LZSS for fast playback!


rensoup

Recommended Posts

1 hour ago, ivop said:
4 hours ago, Rybags said:

If a voice is left alone by the RMT music, will RMT2LZSS also leave it alone?  In theory you might then be able to use a modified RMT player to do the sfx portions - which in most cases should be pretty light on the CPU use.

I think it should be possible to modify RMT2LZSS to skip, say, the first channel and have a modified RMT player that only plays AUDF1/AUDC1.

yep, if a channel is left alone, LZSS only updates its pokey register once at the beginning, which is easy to comment out

Link to comment
Share on other sites

9 minutes ago, rensoup said:

well yeah its just a recording of the pokey stream so when it loops it goes back to the state it was in at that point... why would want to play a sound then loop on an empty pattern unless you were trying to break it ? ?

 

Now why the LZSS version fails to loop properly from time to time is perhaps because of what Emkay explained ?

 

or did I understand your question wrong ?

Yeah that was pretty much what I thought as well.

It's really not a big issue, it can be worked around very easily.

 

Like you said, in my case I pretty much tried to break it on purpose. Leaving the same empty pattern but reusing it many times to artificially make a very long "song" will work for that experiment I posted.

 

However for songs making use of this same effect, it might cause some loop issues, since a song may be expected to have something happening, sustaining or fading out in an "empty" channel, so looping back to that same part will be an abrupt cut.

That is however not a big problem, like I said, it simply requires the .rmt to be adjusted accordingly to avoid it :D

 

That's my observations about it so far.

 

I should post the conversions I did before I went to sleep, pretty much everything I threw at the program was flawless, 50hz and 60hz, either worked perfectly.

There were some really tiny differences too, but I noticed the LZSS conversion sort of... Runs smoother than a .xex from RMT?

Not exactly sure about how I could describe it. It's like any jittery playback I could have caused with all sort of fuckery magically disappeared :P

 

That for sure was really awesome, other than a very tiny looping limitation that can be avoided easily, there was nothing that did not work as expected, and that certainly makes me happy considering a lot of the things I tested were made with stock RMT 1.28 format (1.30), and a lot of fuckery was done in the modules themselves :D

 

Anyway I'll make sure to post the conversions I did once I can use my PC, I had fun revisiting really old projects of mine that were left unfinished.

 

Link to comment
Share on other sites

12 minutes ago, VinsCool said:

It's like any jittery playback I could have caused with all sort of fuckery magically disappeared :P

 

This could be because, IIRC, dmc's LZSS SAP-R player writes each channel as soon as it is available, i.e. decompressed. The RMT player buffers them and writes all values in quick succession. I'd like to try my fourth version of Noisy Pillars and hear what happens with the "resulting" sound :) Hopefully we can resolve the Linux mono issue.

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

1 hour ago, ivop said:

Trying to skip wine (installing dotnet45 failed), I tried running it with mono natively. When I open the file dialog and select a single rmt file, it crashes:

I've tried in wine and it's fine... not sure about mono but this is my clunky code:

 

Quote

 static public void Clear()
        {
            if (s_statusBox != null)
            {
                s_statusBox.Lines = new string[1];
                s_statusBox.Refresh();
            }
        }

so not sure how it's possible to crash...

 

Do you see this text after launching the app "RMT2LZSS by Rensoupp. LZSS encoder by Dmsc." ?

Link to comment
Share on other sites

12 minutes ago, rensoup said:

Do you see this text after launching the app "RMT2LZSS by Rensoupp. LZSS encoder by Dmsc." ?

Yes, that works fine.

 

rensoup-rmt2lzss-mono.thumb.jpg.6a581e5d98651d94451db10bc2fd9f28.jpg

 

Edit: oh, I just notice that the title bar says LZSS2RMT ?

 

Edited by ivop
Link to comment
Share on other sites

36 minutes ago, VinsCool said:

That's my observations about it so far.

I"m hopefully done with looping issues then ?

36 minutes ago, VinsCool said:

That for sure was really awesome, other than a very tiny looping limitation that can be avoided easily, there was nothing that did not work as expected, and that certainly makes me happy considering a lot of the things I tested were made with stock RMT 1.28 format (1.30), and a lot of fuckery was done in the modules themselves :D

Great because I'm in the process of cleaning up the code! it is C# but right now it looks a lot like 6502 ASM and it's pretty difficult to follow. Once the code is cleaned up though it may be more difficult to fix any bug I left during the initial conversion.

36 minutes ago, VinsCool said:

Anyway I'll make sure to post the conversions I did once I can use my PC, I had fun revisiting really old projects of mine that were left unfinished.

?

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

25 minutes ago, ivop said:
36 minutes ago, VinsCool said:

It's like any jittery playback I could have caused with all sort of fuckery magically disappeared :P

 

This could be because, IIRC, dmc's LZSS SAP-R player writes each channel as soon as it is available, i.e. decompressed. The RMT player buffers them and writes all values in quick succession. I'd like to try my fourth version of Noisy Pillars and hear what happens with the "resulting" sound :) Hopefully we can resolve the Linux mono issue.

Not exactly actually,

 

Dmsc's version updates like this:

 

 decompress data byte for $D208

 sta $D208

...

down to $D200

 

I update like this (similar to RMT but not exactly)

lda Buffer;x

sta $D200 

...

to $D208

 

RMT updates 

lda val1

ldx val2

sta $D200 

stx $D201

...

 

Not sure if such small delay differences can change the sounds?

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

Ah yeah I run the program in WINE here. Works perfectly for me.
 

3 minutes ago, rensoup said:
35 minutes ago, ivop said:

Edit: oh, I just notice that the title bar says LZSS2RMT ?

yeah, I'm going to fix that too ?

I did not even notice that until now lol

  • Like 1
Link to comment
Share on other sites

1 minute ago, VinsCool said:

Ah yeah I run the program in WINE here. Works perfectly for me.

Okay, I'll try again in a sandbox. Which version of dotnet do you have installed?

 

1 minute ago, VinsCool said:

I did not even notice that until now lol

Yeah, I only noticed it because I grabbed a screenshot :)

 

Link to comment
Share on other sites

Okay, gave up on mono. Rensoup sent me a non-verbose version, but it crashed later on. BUT, I have a reliable way to get it working with wine. Forget about winetricks.

 

Download the .msi file from https://dl.winehq.org/wine/wine-mono/5.1.1/

Then:

 

$ cd ~
$ mkdir .wine-rmt2lzss
$ cd .wine-rmt2lzss
$ export WINEPREFIX=`pwd`
$ winecfg

# Set to windows 10. Not sure if that was neccesary, but that's what I did

$ wine uninstaller

# click install, and install the aforementioned .msi file
# it looks like nothing is happening, but just wait
# you'll see some crap on the console, but it's fine
# ten minutes later, close the (un)installer and:

$ cd drive_c
$ mkdir rmt2lzss
$ cd rmt2lzss
$ unzip somewhere/RMTLZSS.ZIP
$ cd Release
$ wine RMT2LZSS.EXE

 

  • Thanks 1
Link to comment
Share on other sites

So as promised here's the conversions I did so far.

Most of theses are my own tunes, as well as my friend's, where I also edited or helped working on.
Included a lot of my unfinished and unreleased projects for testing purposes too, so if a song feels incomplete it most likely is :D 

Everything was converted with the LZSS16 and RMT 1.28 (Unpatched) settings.
So far I have to say, this is a really robust program and converter. Not once something failed, or broke, or just was wrong after the process.

The only thing as I said earlier is regarding the loop *if* there is something being expected to continue during the loop, it will be abruptly interrupted, but that can be fixed easily in RMT, so that is really not a problem since everything else had at least something to interrupt in the first place.
I also noticed some visual glitches in a few of the .obx conversions, but it only happens for a split second each time so it's not a big deal.

Playback in both 50hz and 60hz is working perfectly, just make sure to pick the right one when specified in the archive, otherwise it's 60hz by default. :P 

Conversions by Vin.zip

  • Like 3
Link to comment
Share on other sites

5 hours ago, rensoup said:

Not exactly actually,

 

Dmsc's version updates like this:

 

 decompress data byte for $D208

 sta $D208

...

down to $D200

 

I update like this (similar to RMT but not exactly)

lda Buffer;x

sta $D200 

...

to $D208

 

RMT updates 

lda val1

ldx val2

sta $D200 

stx $D201

...

 

Not sure if such small delay differences can change the sounds?

 

Here's my fourth version of Noisy Pillars, with a fourth channel, and a "resulting sound" ;)

 

Similar to @VinsCool's findings, it seems to sounds more smooth than the RMT player!

 

And, I like the visuals @rensoup added :)

 

 

 

noisy-pillars-t1-ivo-edit-fourth-channel.obx

  • Like 2
Link to comment
Share on other sites

1 hour ago, MrFish said:

I converted the extensions of all your files to XEX, for ease of use (I used Bulk Rename Utility, in case anyone was wondering if I did them all by hand. No!)

 

Conversions by Vin.zip 617.52 kB · 2 downloads

 

Been using G6 Utilities since the late 90s.  Still works in Windows 10.  Been free for almost 20 years I think.

 

P.S.

Sorry for the off-topic.  not sure why I needed to mention this, but it may be useful to someone.

Link to comment
Share on other sites

1 hour ago, ivop said:

 

Here's my fourth version of Noisy Pillars, with a fourth channel, and a "resulting sound" ;)

 

Similar to @VinsCool's findings, it seems to sounds more smooth than the RMT player!

 

And, I like the visuals @rensoup added :)

 

 

 

noisy-pillars-t1-ivo-edit-fourth-channel.obx 10.04 kB · 1 download

Sounds great! That could be pushed even further if you fill some empty spaces between drums and bassline, to add even richer harmony, and even use filter to manipulate the timbre nicely, I think :P 
Sounds very smooth indeed!

EDIT: just noticed some parts seemed to alternate between noise and tone, at the same frequency. Was that intentional or just an instrument mistake?

Edited by VinsCool
Link to comment
Share on other sites

58 minutes ago, VinsCool said:

EDIT: just noticed some parts seemed to alternate between noise and tone, at the same frequency. Was that intentional or just an instrument mistake?

I noticed that, too. Not at first, but after I uploaded the RMT/Altirra rendition to YouTube. I thought it was a side effect of what I was doing, and didn't find it annoying :) Noticed it again today after the conversion. And now you mention it. That's great! Because, I went back to the rmt file, and indeed I made an instrument mistake. Instead of setting the volume to 0, it sets the distorion to 0. Hence the "rumble" at a volume of 1. Here's a fixed version. I'll update the YT video later.

 

 

noisy-pillars-t1-ivo-edit-fourth-channel-v2.obx

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

I hate to be a bit dumb here but I would like to understand this better. Please note no malice in my speech, I just want to get my head around this conversation.

 

What is the advantage of using this rather than RMT? I seem to see the comment that it uses less CPU. However when looking at CPU usage, it still seems to take up approximately 16 or so scanlines when playing music back. Is that significantly a lot less than using RMT directly?
 

I can also see that this method uses significantly more memory. If this is the case, doesn't this then leave you with a much smaller amount of memory to use when programming your game? 

 

I can kind of understand using this if you have a small game, with an amazing soundtrack. Please let me know in what situations this is useful for you.

 

Also, is there any way to be able to "stream" the music from a cartridge (switching banks as needed) or would all the bank switching slow everything down too much?
 

Now I would like to congratulate Rensoup. You have come from nowhere it seems and you have produced what you have of P.O.P and you have done this and the five colour tool. I am really amazed by you, you deserve immense credit.

  • Like 2
Link to comment
Share on other sites

22 minutes ago, ivop said:

I noticed that, too. Not at first, but after I uploaded the RMT/Altirra rendition to YouTube. I thought it was a side effect of what I was doing, and didn't find it annoying :) Noticed it again today after the conversion. And now you mention it. That's great! Because, I went back to the rmt file, and indeed I made an instrument mistake. Instead of setting the volume to 0, it sets the distorion to 0. Hence the "rumble" at a volume of 1. Here's a fixed version. I'll update the YT video later.

 

 

noisy-pillars-t1-ivo-edit-fourth-channel-v2.obx 10.01 kB · 2 downloads

Great conversion, I just wished you'd use some PWM magic for that modern retro feel ?

  • Like 1
Link to comment
Share on other sites

1 hour ago, ivop said:

I noticed that, too. Not at first, but after I uploaded the RMT/Altirra rendition to YouTube. I thought it was a side effect of what I was doing, and didn't find it annoying :) Noticed it again today after the conversion. And now you mention it. That's great! Because, I went back to the rmt file, and indeed I made an instrument mistake. Instead of setting the volume to 0, it sets the distorion to 0. Hence the "rumble" at a volume of 1. Here's a fixed version. I'll update the YT video later.

 

 

noisy-pillars-t1-ivo-edit-fourth-channel-v2.obx 10.01 kB · 2 downloads

Very nice! Thanks for coming back to it :)
I suspected it was exacly that, ahah, I make these mistakes all the time too.
 

56 minutes ago, rensoup said:

Great conversion, I just wished you'd use some PWM magic for that modern retro feel ?

There is definitely a lot of room for that, I can almost taste it :D 

  • Haha 1
Link to comment
Share on other sites

1 hour ago, snicklin said:

What is the advantage of using this rather than RMT? I seem to see the comment that it uses less CPU. However when looking at CPU usage, it still seems to take up approximately 16 or so scanlines when playing music back. Is that significantly a lot less than using RMT directly?
 

Depends what tune you're playing, there are 50/100/150/200hz examples in the zip attached earlier... 200hz takes 4x the CPU usage of a 50hz tune (which is what most people use).

 

So if you're comparing a 200hz tune played with LZSS vs a 50hz RMT, that's not exactly fair...

 

LZSS was written by @dmsc, my version is merely unrolled to get some extra speed, so any complaints or praise about the speed should go to him...

 

Here's a 200hz side by side example played with RMT and my unrolled player (light green is CPU usage):

 

200hzcmp.thumb.png.bae528c6f22437960b94c5790ccb8407.png

 

?

 

Shocking eh... ?

 

The RMT version doesn't  properly sync so that the 4x per frame updates are done in one shot for easier comparison and it looks about 4 times faster!

 

I took the screenshot when CPU usage peaked, if you try the obx, you'll see that it varies a lot (but it peaks often enough that you have to plan for it)

 

RMT's CPU usage will vary depending on the effects you use and it can vary a lot. LZSS' CPU usage will vary depending on how well the data is compressed, but it's peak usage is never extreme and the sounds effects can be as complex as you want without affecting speed much.

 

1 hour ago, snicklin said:

I can also see that this method uses significantly more memory. If this is the case, doesn't this then leave you with a much smaller amount of memory to use when programming your game? 

That's going to depend on a lot of factors:

 

1. playback frequency: RMT is not affected but LZSS is because your producing much more data. 

 

2.LZSS version: you can select how well you want to compress your data but this will affect the amount of memory required for the decompression buffers. There are 3 predefined LZSS settings 8/12/16. LZS8 will require 16 bytes per channel I believe (so 16*9 bytes), while LZS16 will require 256*9 bytes.

Then you have to add a tiny amount of space for the replay code (around 150 bytes?). For the unrolled version you need to add a few more hundred bytes.

 

3.For RMT, the player code takes a variable amount of space, between 1-2.5KB I believe ? So the difference with LZSS is not that significant.

 

4. Song Length. RMT can replay slightly different patterns for a long time, so you can have very small tunes that play for 10 minutes. 10 minutes of compressed LZSS would take a significant amount of space.

If you try the converter with typical tunes (1-2 mins) it's on average a tie, or maybe a slight advantage to RMT.

 

The .obx generated by the tool take more space because there's a proportional font and the code to display it, Vu meters code, space for a lot of text. the RMT player is very bare in comparison.

 

2 hours ago, snicklin said:

I can kind of understand using this if you have a small game, with an amazing soundtrack. Please let me know in what situations this is useful for you.

Any game where performance is critical and you want that amazing soundtrack too!  (I use it in PoP btw).  Yes you may have to give it a bit more space for runtime, but your compressed tunes can stay in ROM if you use a cart

 

2 hours ago, snicklin said:

Also, is there any way to be able to "stream" the music from a cartridge (switching banks as needed) or would all the bank switching slow everything down too much?

absolutely yeah. There's no extra work required if your tunes don't cross bank boundaries, and probably a tiny bit of work if you want to split the tunes to avoid wasting ROM space.

 

2 hours ago, snicklin said:

Now I would like to congratulate Rensoup. You have come from nowhere it seems and you have produced what you have of P.O.P and you have done this and the five colour tool. I am really amazed by you, you deserve immense credit.

Thanks, keep some for dmsc because LZSS is a great piece of tech and may allow the A8 sounds capabilities to finally shine!

 

thermostat7_rmt.obx

  • Like 1
Link to comment
Share on other sites

I'd say the most important part with this player is that you can build the music using any editor. Then throw it through the particular converter  to get the "LZSS" format. Throw them onto a cartridge and play endless pokey stuff with just one player.

 

Then use the always the "under control" music player on any visual effect.... without any hazardous sound experience. 

Having a look at "Rescue on Fractalus"... there is enough RAM available but every cycle counts.

Or how about "Encounter" playing "noisy pillars" during gameplay without any slowdown... ;)  

Think about how impressive the tune E1M1 might sound while playing "wayout!" :D

Edited by emkay
  • Like 1
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...