nesbox / TIC-80

TIC-80 is a fantasy computer for making, playing and sharing tiny games.
https://tic80.com
MIT License
5.05k stars 490 forks source link

Need help with TIC-80 sounds/music #2146

Open bztsrc opened 1 year ago

bztsrc commented 1 year ago

Hi,

As some of you might know, I'm working on a PICO-8 to TIC-80 cartridge converter.

So far it can convert Lua (including API calls), sprites, maps, flags, etc., everything except for the sounds effects and music. All data is decoded from PICO-8, all I need is help with writing it out in TIC-80 format. I understand that TIC-80 is a lot more capable than PICO-8, but that's all right, there's no need to support all TIC-80 features. What is needed just one particular configuration that sounds like PICO-8's, that's all (from what I've gathered the TIC-80 sound effect should contain only one waveform all along for example).

Any help would be appreciated, bzt

BuoYancYdabl commented 1 year ago

Dont get a problem here. Do you trying to write wafeforms into ram without success, or you cant undertsand how to convert it?

bztsrc commented 1 year ago

Thank you for your answer!

Do you trying to write wafeforms into ram without success

Nope, I'm writing into .tic files directly.

you cant undertsand how to convert it?

More like it. Let's assume you have a melody made with PICO-8. I've parsed and decoded that, and now I need to write out TIC-80 chunks that when get loaded would play the same (or as similar as possible) melody on TIC-80.

Unfortunately I've found the documentation insufficient to properly do this, that's why I'm asking for help from someone who is more familiar with TIC-80 audio than me.

To be precise, I have already converted the waves, but not sure how to write CHUNK_SAMPLES.

The same goes for CHUNK_MUSIC. I'm pretty sure I'm going to need 4 patterns (TIC-80 can re-use patterns, but PICO-8 can't so each patterns will be different). My problem is, the wiki does not answer my questions how to create these chunks so that they sound the same as in PICO-8.

Hope this makes more sense to you. bzt

EDIT: the documentation was pretty good for all the other parts (script, map, sprites, tiles etc.), it is just the audio that I can't figure out from the wiki.

BuoYancYdabl commented 1 year ago

Well I know little much about sounds and music in TIC-80, so unfortunatelly I can't help with this

nesbox commented 1 year ago

Unfortunately, I'm not familiar with how sound works on PICO-8 and I'm not even sure if it's possible to convert it

bztsrc commented 1 year ago

Unfortunately, I'm not familiar with how sound works on PICO-8

That's okay, I've already figured out that part (FYI: you can find descriptions in great detail in my source).

I'm not even sure if it's possible to convert it

Surely it has to be. All audio made up of soundwaves after all, and TIC-80 has lot more features than PICO-8.

And the similarities speak for themselves. Both consoles build on 4-bit wavepatterns of 32 samples (okay, TIC-80 allows user defined wavepatterns, while PICO-8 has built-in ones, but this means PICO-8 to TIC-80 is doable, I've already generated the CHUNK_WAVES chunk into the output), both consoles use similar effects (arpeggio, slide, volume slide etc.), similar loop features (although TIC-80 is capable of setting up loops independently, but again, I see no reason why the more limited PICO-8 loops can't be described as TIC-80 loops), and in both cases sound effects are parameterized wavepatterns, and music parameterized sound effects (okay, here TIC-80 allows re-usable patterns per channels, but again, there's no reason why PICO-8 patterns couldn't be described as TIC-80 patterns).

Let's do one step at a time. First we need to convert a simple PICO-8 sound effect that uses standard (0-7) wave, and store it as a TIC-80 sound effect. I already have the CHUNK_WAVES, but I'm not sure if I generate CHUNK_SAMPLES correctly.

Cheers, bzt

BuoYancYdabl commented 1 year ago

Surely it has to be. All audio made up of soundwaves after all

Well PICO-8 migth just use different wave decoder and there you might stumble, because then it would be really impossible to convert, unless record it and run trought wave coder

bztsrc commented 1 year ago

Well PICO-8 migth just use different wave decoder

As I've said, it does not. I've put all of those comments in my previous post for a reason.

Yeah, the decoder is different and TIC-80's audio has lot more features, sure, but it seems like it supports everything that the PICO-8 decoder uses. It is possible to convert PICO-8 audio into TIC-80 audio (the other way around isn't).

Cheers, bzt