Jump to content
IGNORED

RMT2LZSS: convert RMT tunes to LZSS for fast playback!


rensoup

Recommended Posts

7 minutes ago, pps said:

My code shows some real time generated graphics on screen, uses DLI for additional colors and runs the dsmc player from VBI (direct as first thing, but that made no difference). The soundfile is not changed, just included into my intro. It's a pity, that this does not work - it's really frustrating.

5 minutes ago, rensoup said:

I suspect it's @pps's https://github.com/ppsberlin/tutorial_lzssplay_g2f_rasterconverter ? (it uses dmsc's original player)

Ahhh I see now! I didn't even know this existed until today.
Now I need to try using this out as well and see how it goes.

8 minutes ago, rensoup said:

@emkay: Can you confirm ? Because you message is a little cryptic (as often) and post both xex and the rmt ?

^^^ this especially was why I asked, because there could be many things involved.
 

  • Like 1
Link to comment
Share on other sites

15 minutes ago, rensoup said:

 

I suspect it's @pps's https://github.com/ppsberlin/tutorial_lzssplay_g2f_rasterconverter ? (it uses dmsc's original player)

 

@emkay: Can you confirm ? Because you message is a little cryptic (as often) and post both xex and the rmt ?

 

We're going back to how the Pokey registers are updated but when I did some tests, you said it played the same no matter how I updated them.

 

-The RMT player loads 2 values and updates a pair of Pokey registers and then the next pair, then AUDCTL.

 

-dmsc's player decrunches each channel then updates the Pokey value, so there's a "long" delay between eahc update. The registers are updated in reverse order too starting from AUDCTL

 

-my optimized version of dmsc's player loads 1 value and updates  the corresponding Pokey register. So very close to RMT.

 

Seems you may have a pretty good test case there...

 

Aha, did not know that you changed @dmsc's player routine, too. Of course I tried to use his routine, as I thought that is the one to use. Is your routine publicly available?

Link to comment
Share on other sites

9 minutes ago, pps said:

Aha, did not know that you changed @dmsc's player routine, too. Of course I tried to use his routine, as I thought that is the one to use. Is your routine publicly available?

nope, I was going to package it with RMT2LZSS but then I got lazy ?

 

I'm going to make it available, but please do send that tune (or at least the part that goes wrong) so that I can finally figure out the cause

  • Like 2
Link to comment
Share on other sites

12 hours ago, rensoup said:

nope, I was going to package it with RMT2LZSS but then I got lazy ?

 

I'm going to make it available, but please do send that tune (or at least the part that goes wrong) so that I can finally figure out the cause

 

Seems , the cause has been found . 

It's PPS's intro , so he has to decide. 

Link to comment
Share on other sites

21 hours ago, rensoup said:

...

-The RMT player loads 2 values and updates a pair of Pokey registers and then the next pair, then AUDCTL.

 

-dmsc's player decrunches each channel then updates the Pokey value, so there's a "long" delay between eahc update. The registers are updated in reverse order too starting from AUDCTL

 

-my optimized version of dmsc's player loads 1 value and updates  the corresponding Pokey register. So very close to RMT.

 

Seems you may have a pretty good test case there...

Thanks for this detailed info, what you changed. I will try if I can match to your player. If not, I will wait for official release by you ;)

  • Like 2
Link to comment
Share on other sites

4 hours ago, pps said:

Thanks for this detailed info, what you changed. I will try if I can match to your player. If not, I will wait for official release by you ;)

Should be easy to modify, Let us know your findings!

 

 

I'd like to add a few more things before releasing the player, hopefully you're not in a rush...

Link to comment
Share on other sites

7 hours ago, rensoup said:

Should be easy to modify, Let us know your findings!

 

 

I'd like to add a few more things before releasing the player, hopefully you're not in a rush...

Things should be easy. 

It's just that the data has to be played at the same point, where it is stored .

If you use always the same "offset" for storing data and saving data, it will be stable for sure. 

  • Confused 1
Link to comment
Share on other sites

17 hours ago, emkay said:

Things should be easy. 

It's just that the data has to be played at the same point, where it is stored .

If you use always the same "offset" for storing data and saving data, it will be stable for sure. 

?

 

The Pokey data isn't created by any kind of emulation, it's just a PC player which outputs Pokey data without any kind of accurate timing. 

Link to comment
Share on other sites

3 hours ago, rensoup said:

?

 

The Pokey data isn't created by any kind of emulation, it's just a PC player which outputs Pokey data without any kind of accurate timing. 

Sorry. I should have pointed to this:

It was about your question in post #324

 

"

We're going back to how the Pokey registers are updated but when I did some tests, you said it played the same no matter how I updated them.

"

 

 

Link to comment
Share on other sites


New version with a bunch of experimental features!

 

1.7 Apr 2021


    -added 400 & 800hz playback (speed 5 & 6). This turns off the equalizer. It may also not work in NTSC.

 

For the new playback speeds, the RMT file needs to be hacked because it's not supported by the RMT editor.

 

    -added simple sample playback (speed is limited to 50hz->800hz !). See .erti example

 

Sample playback is limited to 4bit at playback frequency. 


The sample data is stored into the envelope. 


There's no way to interactively change the playback speed (the note doesn't matter). 


I've tried with a bass sample and it doesn't sound very good ?. I've also tried a simple sample playback test at 15KHz with the same bass sound for reference (also in 4bits).

 

I'm curious if anybody has a better sample for testing ?

 

    -added envelope speed. See .erti example

 

Envelope speed (EnvelopeStep) specifies how quickly the envelope pointer moves for each playback step(locked to 1 in RMT). 

If using steps smaller than 1.0, the envelope effects and commands are only processed once moving to the next step. 


This feature was requested by @VinsCool because there's already a notetable speed in RMT. However having looked at the code, I'm not sure how well it's going to interact with instrument effects. It is useful for sample playback at least because it lets you specify the playback speed (because the sample data is stored in the envelope).

 

    -optimized player source code is now included

 

Same as dmsc's original player, just unrolled to take a bit more space and a bit less CPU time.

 

    -added Vinscool's latest custom notetables

 

I also hacked one of Vinscool's tunes for my sample playback test hence it might sound vaguely familiar ?

 


Right now I'm not convinced sample playback is useful, mainly because the max playback frequency is too low... but perhaps there are ways to improve it (PWM/PDM seem out of question)?

 

sampletest.png.623cedf50be8d4ce943cd0d01e262366.png

 

sampletest.zip

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

3 hours ago, rensoup said:

 

 


Right now I'm not convinced sample playback is useful, mainly because the max playback frequency is too low... but perhaps there are ways to improve it (PWM/PDM seem out of question)?

 

sampletest.png.623cedf50be8d4ce943cd0d01e262366.png

 

sampletest.zip 8.87 kB · 3 downloads

It looks like, the sample playback is cancelling the tone generator. 

Can this be changed?

Also, if there is no tool to adjust "samples" with the rest of the tune, things may keep to be "not convincing". 

And, btw. : How to activate/deactivate the "samples" in a tune anyways?

Edited by emkay
Link to comment
Share on other sites

12 hours ago, emkay said:

It looks like, the sample playback is cancelling the tone generator. 

Can this be changed?

I'm not sure what you mean ? the AUDC dist ? I can set it to any value of course... not sure what the correct settings are for proper sample playback.

 

12 hours ago, emkay said:

Also, if there is no tool to adjust "samples" with the rest of the tune, things may keep to be "not convincing". 

If you mean adjust the sample frequency with the note, that could be done of course. This is more of a proof of concept to see if it's actually worth exploring...

Any complex amiga soundtracker effect could be done too since it all ends up as raw registers anyway...But would it be worth it at 800hz ?

12 hours ago, emkay said:

And, btw. : How to activate/deactivate the "samples" in a tune anyways?

If you check the example RMT tune, there is an associated .erti file which just replaces instrument $01 with a 16bit mono wav. You just output that tune with RMT2LZSS with the custom tables option.

 

  • Like 1
Link to comment
Share on other sites

11 hours ago, VinsCool said:

Holy SHIT this was not an expected update!
Incredible work! I am so excited to try this out :D 

I can't wait to see if you can come up with something great... Less anxious to read your bug report ?

 

Like I said... sample playback at 800hz is unconvincing (so far) but perhaps 800hz is good enough to get Pokey to produce interesting bass sounds

  • Thanks 1
Link to comment
Share on other sites

1 minute ago, rensoup said:

I'm not sure what you mean ? the AUDC dist ? I can set it to any value of course... not sure what the correct settings are for proper sample playback.

 

Your test tune just is doing some "neutral" wave, and the source rmt file play some aspeggios in that channel. 

 

1 minute ago, rensoup said:

If you mean adjust the sample frequency with the note, that could be done of course. This is more of a proof of concept to see if it's actually worth exploring...

Of course it is worth exploring. But the state of development is crazy. 

Just like ordinary building  house and to put tiles to the roof, the "rmt2lzss tool is now like some juggler throwing all tiles to their places on and on while it  is raining. 

 

1 minute ago, rensoup said:

Any complex amiga soundtracker effect could be done too since it all ends up as raw registers anyway...But would it be worth it at 800hz ?

Of course it will be there. 

 

1 minute ago, rensoup said:

If you check the example RMT tune, there is an associated .erti file which just replaces instrument $01 with a 16bit mono wav. You just output that tune with RMT2LZSS with the custom tables option.

 

I tried that before writing my post. But there only was the standard RMT played after converting. 

Link to comment
Share on other sites

39 minutes ago, emkay said:

Your test tune just is doing some "neutral" wave, and the source rmt file play some aspeggios in that channel. 

neutral wave ? it's that bass sample which is included in that example zip.

 

39 minutes ago, emkay said:

Of course it is worth exploring. But the state of development is crazy. 

Just like ordinary building  house and to put tiles to the roof, the "rmt2lzss tool is now like some juggler throwing all tiles to their places on and on while it  is raining.

Sounds like a Nintendo game & watch ?

 

This new options were more like low hanging fruits, there's nothing complex about them, they're just extensions of what's already there

 

39 minutes ago, emkay said:

I tried that before writing my post. But there only was the standard RMT played after converting. 

Ooops... I forgot to set the replay rate to 800Hz in the song... I forced it in the code while testing, but you need to hack the song speed yourself: it's the 3rd byte after the RMT4 signature (currently set to $01)

 

sampletest.rmt

Edited by rensoup
added .rmt file with hacked 800hz speed
  • Like 2
Link to comment
Share on other sites

You don't need to play every channel at 800Hz. Just play 4 times AUDF/AUDC, and AUDCTL, at 50Hz or 60Hz. And then have a certain RMT instrument trigger the volume-only waveform player with a certain wave. And optionaly ORA'd with a tone generator, what emkay means. This is more or less what HARDbass does. And AtariSid6 at a higher replay rate. Don't play full samples, but round-robin a 256 or 512 byte waveform, and jump around with fixed point math. And different waveforms for different volume levels, but I doubt that is necessary for bass lines.

 

  • Like 1
Link to comment
Share on other sites

2 hours ago, ivop said:

You don't need to play every channel at 800Hz

I know, it's just easier to not have to change LZSS to compress channels a different frequencies for now. Yes it would be great to be able to select the replay rate per channel of course.

2 hours ago, ivop said:

Just play 4 times AUDF/AUDC, and AUDCTL, at 50Hz or 60Hz. And then have a certain RMT instrument trigger the volume-only waveform player with a certain wave.

Sure, that's optimizing for speed & space but I'm just trying to figure out if this is worth it. Hardbass runs at 1950hz, which seems to be enough for convincing bass "samples". 

2 hours ago, ivop said:

And optionaly ORA'd with a tone generator, what emkay means.

lda sample4bit

ora #VolumeOnly

ora #ToneGen

sta AUDC0

 

Is that what you mean ? 

3 hours ago, ivop said:

Don't play full samples, but round-robin a 256 or 512 byte waveform, and jump around with fixed point math

Does that have any influence on the sound quality ( produces purer sounds) ? Or is it space saving ?

 

  • Like 1
Link to comment
Share on other sites

2 hours ago, rensoup said:

Another thing I'm wondering is why my reference sample playback at 15khz sound better than the same at 7.5khz since this is a bass sample ?

Because there is no oversampling. 

It's technical stuff ;)

If you read my posts carefully, I was explaining it. 

If you do the manipulations directly at the aimed frequency, it is not really a sample. 

The sampling that can capture everything in the audible range, is at least the double of the audible range. So you won't hear the corny edges of the sampling. 

Using 15kHz sampling does a lot "oversampling" on the low tone. But the bass is more than a low tone.

Particular drums contain a big amount of "sine-wave". So the wave is continuously changing at a much higher frequency (and resolution).  

The point with that low speed sampling, is to get the additional punch of the faster updates. But it only works best, if there is a "modulo" in the resulting wave. That's why Softsynth works with a good result at about 3000Hz sampling for higher notes. 

The "sampling is a part of the resulting tone" .

 

It sounds corny, but correct.

And, if adding the generator waves, you can produce resulting deep waves like an LFO.

 

But this all makes only sense, if you can produce the sounds in some "synthesizing" tool, where you can listen to the resulting sound directly. 

 

 

 

 

  • Like 1
Link to comment
Share on other sites

Quote

lda sample4bit

ora #VolumeOnly

ora #ToneGen

sta AUDC0

 

Is that what you mean ? 

Sort of. You can store your 4-bit samples with ora'd with $10, and then ora $a0 if you want to hear the tonegenerator, too.

 

Quote

Does that have any influence on the sound quality ( produces purer sounds) ? Or is it space saving ?

Both :)

 

256-bytes is enough for a repeating wave to get a pure tone. The 512 bytes I use in AtariSid contains the same 256 bytes twice! That way it is easier, and faster, to index without checking for overflow everytime, at the cost of usiing double the amount of memory.

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

1 hour ago, ivop said:

Sort of. You can store your 4-bit samples with ora'd with $10, and then ora $a0 if you want to hear the tonegenerator, too.

I meant #$10 and #$a0 obviously ;)

 

Also, if you are still going on using true samples, be sure to filter them properly before downsampling. For example, if you are going to replay the samples at 800Hz, 400Hz is the maximum frequency it can capture. It's best too filter out every frequency above that, to avoid aliasing when downsampling to 800Hz. Set a low-pass filter to something like 380Hz with a very sharp knee, or run the filter a few times. After that, normalize to the volume you want.

 

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

Ah, I see the problem. 

Normally, RMT is mixing AUDCx together for the generators and the volume. 

The used method here just hikes a channel and writes the volume only . 

 

btw. any suggestion for an editing tool? 

Even "Edit" means to do something good "formatting" data .

 

 

Link to comment
Share on other sites

28 minutes ago, emkay said:

The used method here just hikes a channel and writes the volume only . 

ITYM hijacks ;) Not that I don't make spelling errors, but hiking is something completely different :)

 

3 hours ago, ivop said:

256-bytes is enough for a repeating wave to get a pure tone.

This was at 15.6kHz. At the proposed low replay rate, you can go as low as 16 bytes per period. Perhaps even less, but it complicates the replay routine because of resetting the index register, or LSB with self-modifying code.

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