Log In  

Hi everybody,

I'm having some difficulty figuring out how to solve a problem with how PICO-8 handles music, and I was wondering whether any of you out there could help me.

Let's say I have a few SFX files that I intend to collate into a music composition for my game, like in the following image:

Notice that there are a few unused measures for this clip. Let's assume that I have several other clips that are similarly structured.

When I try to string these together in the music editor, the system plays all those empty measures like they are rests. But what I would really like to happen is for the music to "jump" directly from the end of the clip to the beginning of the next one.

Is there a way to make this happen?

Thank you for any and all input!

P#73814 2020-03-11 04:19

I'm not entirely sure, so I hope someone comes in to post authoritatively, but it feels like PICO-8's music engine decides how long to play each pattern by either taking:

  • 32 lines x the largest speed (SPD, corresponds to slowest track) among channels playing non-looping sfx, or
  • if all playing channels lines have loops, 32 lines x the largest speed.

So the looping pattern you posted by itself or with a non-looping pattern of the same SPD will play for 2-2/3rds loops (because 12x(2+2/3)=24+24/3=24+8=32) and played with an empty non-looping pattern of a smaller SPD will play for the length of that shorter sfx. So, in this case, if you play your pictured pattern alongside an empty sfx with SPD=6, it'll skip to the next pattern after one go through...

...but if you removed the looping from your pattern, it'll play all the silence no matter what you do. And more, if you give it a pattern with a slower (larger) SPD to go alongside.

I don't know if that gives you an idea of how to get the effects you want.

(edited to clarify that larger SPD = slower track)

P#73831 2020-03-11 19:23 ( Edited 2020-03-11 19:53)

Like, fundamentally, PICO-8 has no way to tell if an empty row is no data or specifically silence - the row is only empty because PICO-8 hides the data if the volume is zero. If you type in volume numbers:

...you'll see that it already has a note (I believe C two octaves below middle C), it just doesn't show the note when the volume is zero (unless that note is used in an arpeggio). If you look at this description of how the data is stored internally, you can see that it doesn't actually have any way of storing the length of a pattern, and there's no way to type a note to mean "terminate the pattern here" - they're all just notes.

P#73832 2020-03-11 19:33
:: Ulexes

Dang, that's what I was afraid of. It's going to be a bit harder to put together music if it needs to be exactly that many measures. But oh well -- we like constraints in PICO-8. :)

Thank you for your help!

P#73833 2020-03-11 19:49

Yeah - it's a pain when trying to do something in 6/8 or 3/4 or the like.

Glad to be of service!

P#73834 2020-03-11 19:51

Is this post helpful?

First channel SPD is 9.
Other channels SPD is 12.

Play 3beats.
This will play three beats.

P#74029 2020-03-18 08:04
:: Spaz48
1

Generally, the length of the music pattern depends on the length of the SFX in the first channel being used. So, if you're using channel 0, it'd be going off of that, if you aren't using 0, then 1, and so on. So basically, when the leftmost SFX ends, it moves onto the next pattern.

You can test this by making two SFX, one with speed 8, and one with speed 16. Put the 8 speed one in channel 0, 16 in 1, and it'll cut the 16 off halfway. Put the 16 speed in 0, 8 in 1, and the 16 one will keep going, leaving the 8 to end halfway through unless you set the 8 sfx to loop.

So if you want to, say, cut 3/4ths of the way through an SFX, you could have all of your actual music be on speed 16, and have an empty SFX in channel 0 at speed 12, or as shiftalow said, music on 12 speed, dummy channel on 12, and so on.

Just keep in mind that say, if you wanted to have your music be at speed 15 and cut it off 3/4ths in, that wouldn't work. 3/4ths of 15 is 11.25, but you can't have speed 11.25, only 11, so things might not sound too good.

P#74054 2020-03-19 21:35

[Please log in to post a comment]

Follow Lexaloffle:        
Generated 2020-06-01 06:25 | 0.014s | 4194k | Q:24