February 2025

S M T W T F S
      1
23456 78
9101112131415
16171819202122
232425262728 

Style Credit

Expand Cut Tags

No cut tags
packbat: A bat wearing a big asexual-flag (black-gray-white-purple) backpack. (Default)
Saturday, July 25th, 2020 10:29 pm

PICO-8 does not really have a concept of tempo with regard to music, it has a concept of time.

One PICO-8 music tick is approximately 1/120th of a second.[1] At 60 frames per second, that's about two ticks per frame; at 30 frames per second, that's about four ticks per frame.

This shows up in an SFX two ways:

  • The SPD of an SFX (a misleading name, gonna say that right upfront) is how many music ticks each line holds for. The default SPD is 16 - if you're thinking of each line as a sixteenth note in 4/4, that works out to about 112 BPM, which is a pretty normal allegro.
  • The two arpeggio effects - effect 6 being the faster one and 7 the slower one - hold each of their notes for 4 ticks or 8 ticks, respectively.[2] (Which is to say: a blur of notes or a rapid sequence of notes, respectively.[3]) How exactly this works actually gets really messy if the SPD of the SFX is not a multiple of 16[5].

There is a kind of third way, which is: if you use a custom SFX instrument, that instrument will go through its ticks as long as its note is held. So, for example, a custom SFX instrument at SPD=1 that goes through all 32 lines of its SFX will take two lines of a SPD=16 SFX to finish playing. You can match this kind of thing to the music being created - we've created both staccato and grace notes for a SPD=24 piece by scheduling things within 24 ticks of a SPD=1 SFX, and we've taken a custom drum SFX and set it to loop exactly the right number of lines to do a double-stroke on that drum in a single line of a piece.

While the arpeggio effects (mostly[2]) aren't, a lot of the effects - 1=slide, 3=drop, 4=fade in, and 5=fade out - are based on the SPD of the line where the effect is played. The volume and pitch of the note in a slide will transition linearly from the previous note's at the beginning of the line to the destination note over the length of the line; the pitching-down of a note in a drop will be stretched out over the length of the line; the fade-in and fade-out will be linear between 0 and the given volume over the length of the line. If a slide or fade is too quick, it can be spread out between multiple slides; if it is too slow, there's ... not much you can do, other than make a custom SFX instrument.

But that's basically how it works. PICO-8 sounds are scheduled pitches of specific timbres over periods of time measured in music ticks.

[1] We suspect, but cannot prove, that it is actually 183/22 050 seconds - that is, 183 sample points at 22.05 kHz, the sampling frequency of an exported PICO-8 .wav file. This could be an artifact of exporting, however.

[2] If arpeggios are used in an effect with SPD 8 or less, these times are halved to 2 and 4 and the arps cycle twice as fast.

[3] An exception to this: if multiple lines have the same pitch - say, two lines at C2[4] and two lines at B2 - those notes will hold over and therefore sound slower and longer.

[4] PICO-8's C2 is C4 - middle C - in scientific pitch notation. Because reasons.

[5] There are grids, starting at the start of each SFX, for fast-arpeggios and slow-arpeggios within those SFX. Notes in the arpeggio during a line with an arpeggio effect will be picked based on what lines of that arpeggio's grid they fall on. ...you might just have to try it and see if it works.

packbat: A bat wearing a big asexual-flag (black-gray-white-purple) backpack. (Default)
Wednesday, July 1st, 2020 09:06 pm
A snippet from PICO-8's music editor view, showing four channels each playing a note one after the next.

So, in PICO-8, each channel can only play one note at a time. There is technically a way to add hardware echo, but it's undocumented and pretty inflexible; it does one thing and that's it.

That said, there's actually no rule that a melody has to be contained in a single SFX channel.

A PICO-8 custom SFX instrument using the phaser and triangle wave instruments. It's not a difficult technique, just a bit tedious: in essence, one composes music with instruments that tail off in volume (in this case, first within the custom SFX instrument shown to the right, and then further in the SFXes where the instrument is played), decides how many SFX channels to dedicates to the piece, and then starts each note in each channel in turn, giving each previous note as long as possible to tail off while the others are playing. In the example up top, the first channel comes in on the first line, the second on the second, the third on the third, and then the fourth waits a moment and comes in on the fifth.

(If one note interrupts the tail of a prior one - cuts it off before it fully fades out - it's not a big deal. After all, this is the moment when the note is the most quiet, and therefore least noticeable and most easily drowned out by, say, the new note that just started playing.)

Where we've really been using this technique is in imitating string instruments with a lot of sustain, like guitars or maybe harps? It's a cool sound, anyway.