nesbox / TIC-80

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

[help] tracker commands detailed documentation #2153

Open atesin opened 1 year ago

atesin commented 1 year ago

hi... i am trying to learn how to make games, at the moment my games have no music :( ....

the music editor reminds me a lot some vintage music creators like fasttracker ii ;)

but however, tracker commands are barely mentioned in wiki pages, they are cryptic and complicated, i.e. not so friendly,,, so it will have more detailed help .... for example, the "jump" command just say "Jump to frame/beat" and then "Commands are parameterized by using the X and Y values ..." .. NOTHING MORE

i couldn't make jump copmmand work properly as i wish.... if x/y are a single digit, it means it can just point the first 9 frames/rows ??? is rather insufficient... or is there another way to jump to lets say frame 23 ?? .. same with other commands, like "sustain notes between frames" button, what it does?

thanls to you that you had read my question

atesin commented 1 year ago

edit: is each track limited to 16 frames!!!, not 64

also... i want to compose a long chiptune song ... is each track limited to 64 frames?... if so i think i should compose many tracks and then play them in sequence with music() fumction

how can i know when the current playing track has finished?, does music() return some value?, or is there some function that returns the state of music "chip" ?.. or is there some formula to calculate song lenght in seconds or ticks?

atesin commented 1 year ago

another one.... in wave editor, the right panel (vol, arpeggio, pitch) shows LOOP.... loop values just cover HALF of the view i.e. cannot loop near the end or loop the entire wave

(fasttracker 2 had a nice feature: "ping pong" loop, that made playback bounce backward and forward between loop boundaries)

bztsrc commented 1 year ago

+1, I have the same problem here. Better wiki documentation would be really nice.

is each track limited to 64 frames? if so i think i should compose many tracks

Nope, on the left you can add multiple frames one after each other to one track. The number of tracks is limited anyway to 8, so you can't compose many tracks.

Another difference to FT II is that here you reference channels independently in the frames, while in Amiga MOD and XM one row contains all values for each channels. Hard to explain... Imagine that mod has 64 x 4 values for each pattern and that's it. On the other hand TIC-80 has 4 array selectors per pattern, and each points to an array that hold 64 values (one coloumn of notes), so you can use the same coloumn multiple times. I'm not sure if this has any real value in composing (who want's to play the same pattern on two channels at the same time?) but reduces the size of the cartridge.

Cheers, bzt

atesin commented 1 year ago

on the left you can add multiple frames one after each other to one track. The number of tracks is limited anyway to 8, so you can't compose many tracks.

on the left where? ... where can you add more than 16 frames to current track?

... also, i think at least we need some (intent of) concept definitions, in the absence of another official ones:

bztsrc commented 1 year ago

on the left where? ... where can you add more than 16 frames to current track?

That's it. You have 8 tracks (songs), each with 16 frames, each frame 64 rows tops. That's 1024 rows per track tops. If every 4th row gives 150 BPM (not sure about this part), that means each track can be one and a half minutes long.

also, i think at least we need some (intent of) concept definitions

I totally agree. I'd be willing to help, but I don't understand everything TIC-80 audio related myself.

A few notes on your definitions: in the world of trackers,

beat, tempo, speed

Yeah, total confusion I agree, instead of explaining things, the wiki makes things less clear for me. It says:

The TEMPO (32..255) of the music track is 150 plus the value of tempo.

The number of ROWS (1..64) in the music track is 64 minus the value of rows.

The SPD (1..31) of the music track is 6 plus the value of speed.

Now how does TEMPO influence beat and ROWS? And SPD indeed makes no sense if you already have BPM. Either you specify the number of ticks per row (SPD) or number of rows per minute (BPM), but both? One should be calculated from the other, so I don't understand why are both configurable and stored in the TIC-80 memory (provided that the tracker/player audio frequency is constant).

For example, in a classic MOD tracker, you have 3000 ticks per minute, and the default speed is 6, which means placing notes in every 4th rows gives you 125 BPM (3000 / 6 / 4 = 125). If you set the speed to 3, and place notes in every 8th rows, then the BPM doesn't change, it remains 125, because these things are related.

A few more things from the wiki that makes no sense to me, section sound registers:

The frequency value is converted to a period value (clamped to 10...4096) suited for a virtual 2,088,960 Hz clock.

And in section music patterns:

note      | 4bit
octave    | 3bit

How does this 4+3 7 bits end up in a 12 bits frequency (that's actually period and not frequency)? No clue.

So yeah, some better explanation on the wiki about what's going on with the TIC-80 sounds and music would be really appreciated.

Cheers, bzt

atesin commented 1 year ago

on the left where? ... where can you add more than 16 frames to current track?

That's it. You have 8 tracks (songs), each with 16 frames, each frame 64 rows tops. That's 1024 rows per track tops. If every 4th row gives 150 BPM (not sure about this part), that means each track can be one and a half minutes long.

so do you really mean, the frames per track is actually fixed at 16 and cannot be changed?? ... what a pity

... so the spd=6 is like a de-facto standard that somebody set at early times and is preserved until today mainly by historical reasons? (i am not a music expert)

bztsrc commented 1 year ago

so do you really mean, the frames per track is actually fixed at 16 and cannot be changed?? ... what a pity

TIC-80 like any other fantasy console is restricted on resources. But 1024 rows per track is quite a lot actually.

i had heard the term "voices" to indicate polyphony

Yeah, but let's not do that. Let's stick to your previous definition, "voice, like a single musician that can play one instrument at a time". It worth noting that a single instrument can play multiple notes at once, which does not increase the number of voices, but it does increase the number of required channels (number of polyphony).

afaik, an "instrument" is a sound sample PLUS bundled effects... even here in tic80 the so called "sfx" is actually a waveform + vol/arpeggio/pitch envelopes... that doesn't deny that you can have per row effects too

Depends how one defines effect I guess. You cannot add vibrato or portamento to sfx, only to row for example. In fact, arpeggio (make it sound like a chord) is the one and only effect that TIC-80 supports at sfx level, nothing else. All the others are encoded in the rows as "commands".

i think i understood the "spd" concept (more or less), can be used like song "resolution"

Not sure about TIC-80, but in any other tracker speed is - as I wrote - the number of ticks per row.

by halfing the spd but doubling the bpm, you have more notes to put in between

Not exactly. To double the bpm you either set the speed to half or use more notes in between, but not both. If you half the speed AND use more notes in between then you would quadriple the BPM, not double it.

speed 6:
 1 note  <- played at tick 0
 2 ...
 3 ...
 4 ...
 5 note  <- played at tick 24
 6 ...
 7 ...
 8 ...
 9 note  <- played at tick 48

speed 3, same number of notes:
 1 note  <- played at tick 0
 2 ...
 3 ...
 4 ...
 5 note  <- played at tick 12
 6 ...
 7 ...
 8 ...
 9 note  <- played at tick 24

speed 6, with more notes in between:
 1 note  <- played at tick 0
 2 ...
 3 note  <- played at tick 12
 4 ...
 5 note  <- played at tick 24
 6 ...
 7 note  <- played at tick 36
 8 ...
 9 note  <- played at tick 48

speed 3, with more notes in between:
 1 note  <- played at tick 0
 2 ...
 3 note  <- played at tick 6
 4 ...
 5 note  <- played at tick 12
 6 ...
 7 note  <- played at tick 18
 8 ...
 9 note  <- played at tick 24

so the spd=6 is like a de-facto standard that somebody set at early times and is preserved until today mainly by historical reasons? (i am not a music expert)

More or less yes. Definitely historical. The first guy who ever wrote a tracker wrote it in a way to play music during vertical retrace, and he was using an Amiga PAL machine which had 50 Hz screen refresh rate. Now 50 Hz refresh means 50 interrupts per second, so his machine called his music player code 3000 times per minute, that's where the 3000 ticks come from. Using speed as 6 (in ticks per row) made it so that every 4th row gave 125 BPM, and every odd row gave 250 BPM. Putting a note in every row would result in 3000 / 6 = 500 BPM which is pretty rapid and looks like a reasonable upper limit in any music (at default speed). By setting the speed to 1 ticks per row, 3000 rows would be parsed in every minute, giving the maximum 3000 BPM. (For a classical tracker. More modern trackers does not use vertical retrace anymore, so they can specify ticks differently and therefore they might even allow varying frequency. Regardless speed means ticks per row in modern trackers too.)

Cheers, bzt

bztsrc commented 1 year ago

Dear @nesbox,

Would you be kind to clearify a few things for us?

Does TIC-80 use fixed number of ticks per minute, or is it variable? If it's a constant, what's the number? Can you confirm that SPD in TIC-80 means number of ticks per row? If so, and the number of ticks per minute is a constant as well, then how does the BPM calculation goes (in regard to the number of rows processed per minute)?

It would help a lot to put these in the wiki. I'd do that, but I don't know the answers to these questions.

Thank you in advance, bzt

atesin commented 1 year ago

so do you really mean, the frames per track is actually fixed at 16 and cannot be changed?? ... what a pity

TIC-80 like any other fantasy console is restricted on resources. But 1024 rows per track is quite a lot actually.

ok, but that doesn't answer my question.... can we have more than 16 frames per track?, i am trying to compose a song but with just 16 frames i found very short

In fact, arpeggio (make it sound like a chord) is the one and only effect that TIC-80 supports at sfx level

i never really understood what arpeggio is, for me is like a pre-recorded "melody" that can be played at different scales... like if you press a couple keys in your keyboard and the keyboard itself plays a melody with those notes, or by pressing down a key it plays a little melody in that scale (i remembered kraftwerk xD)

by halfing the spd but doubling the bpm, you have more notes to put in between

Not exactly. To double the bpm you either set the speed to half or use more notes in between, but not both. If you half the speed AND use more notes in between then you would quadriple the BPM, not double it.

i understood the amiga and vbi thing (vertical blank interrupt).... but as i am just a normal guy with no technical music knowledge, with more resolution i meant, if i half the "spd" and double the "tempo" i heard the song the same but i can put more notes between "beats"

bztsrc commented 1 year ago
   so do you really mean, the frames per track is actually fixed at 16 and cannot be changed?? ... what a pity

TIC-80 like any other fantasy console is restricted on resources. But 1024 rows per track is quite a lot actually.

ok, but that doesn't answer my question.... can we have more than 16 frames per track?

Sorry if I wasn't clear. Yes, you're correct, the frames per track is fixed at 16, you cannot have more. At least, that's what the wiki says.

i am trying to compose a song but with just 16 frames i found very short

Yep, that's the point of virtual consoles: you're always short on resources, because they want to force you to be creative.

if i half the "spd" and double the "tempo" i heard the song the same but i can put more notes between "beats"

That's the idea. If you half the speed, then each row will take half the time to parse, therefore twice as many rows will cover the same amount of time. So you'll have more rows to use for the same time interval.

Cheers, bzt

nesbox commented 1 year ago

Crash course tracking music in TIC-80

https://www.youtube.com/watch?v=V9oAccwjeDA image