Log In  

Mid-Atlantic USian. Fan of autobiographical games, unusual game experiences, and heavily stylized graphics. Queer, disabled, autistic.

Cart #zebijinota-0 | 2022-03-27 | Code ▽ | Embed ▽ | No License

I was updating a cart I was working on to use stat 46-56 instead of 16-26 and noticed that new bugs were introduced in the change. It looks like stat(16) updates immediately when a music() command is called, but stat(46) will sometimes show an erroneous value (e.g. -1) on the frame of the update.

P#109257 2022-03-27 15:08

Something I noticed today, browsing the PICO-8 forums on my iPhone 6: when I opened the Tell me about how you compose music thread, it would always crash the browser. Safari and Chrome would report that the tab had repeated errors, Opera would crash out entirely.

I'm guessing here when I suggest the embedded SFX music player is related to this, but I wonder if all the scripts are overloading the limitations of the device. Granted, this is a device that will sometimes struggle to run a PICO-8 cart at all, but it makes me wonder if some kind of click-to-activate option for SFX previews might be worth implementing.

P#108263 2022-03-08 14:56

There seems to be some kind of flaw on my system when playing music via the music pattern editor: it'll start playing normally, with the display scrolling, but despite my making no input with mouse, keyboard, or controller, it will abruptly stop scrolling and leave the cursor behind.

My first thought was that perhaps the active SFX in the SFX editor had started, but that wasn't the case in any of my tests. There's no obvious pattern to it - it's not after a fixed duration, after a fixed number of patterns, or after a specific pattern appears - but in each of the files I tried, it stopped on the same places in two separate tests.

The music continues playing as normal and correctly - it's as if, at an unpredictable point, PICO-8 decided I clicked on the SFX or the cursor or something to edit the current SFX.

Edit: I posted below that this seems to happen when the SFX in the selected channel changes from one pattern to the next; doing a quick test on 0.2.4, I didn't see it happen there. It looks like this may have been introduced in 0.2.4b.

Edit: Fixed in 0.2.4c!

P#106845 2022-02-13 18:41 ( Edited 2022-04-11 00:49)


This was an exercise I was doing in transcribing music from sheet music - in this case, the first Gymnopédies from Erik Satie's 3 Gymnopédies - and it actually turned out to contain a really interesting little technical challenge.

The thing about Gymnopédies 1 from a PICO-8 perspective is that there are simply too many voices in the harmony to contain in four channels. So, obviously, arpeggios.

...but also, Gymnopédies 1 is a very calm piece of music - tormented (one is instructed to play this "Lent et douloureux", or roughly "slow and painful" in English), but emotionally quiet. The plodding beat of the piece is the low bass note on the downbeat, not the middle chords between them, and launching directly at full volume into an arpeggio is far too dramatic and disruptive. So the question becomes: how do you simultaneously fade in and out an arpeggio while arpeggiating?

Which, I mean, custom SFX instruments, of course. But I actually accidentally played myself initially, because the first thing I always do looking at a piece of sheet music is ask, "how large can I make the subdivisions?", and the piece is entirely in quarter notes, so I made my subdivision a quarter note. And if each measure of 3/4 is three lines, then I can't use arpeggios in the music SFX because they overlap - I have to use arpeggios in the custom SFX instruments.

...and there are more distinct chords in the piece than I have custom SFX instrument slots. So I have to compromise. And I can't do much shaping of the notes, because I don't have any subdivisions within them. It functioned, but I was not happy.

This version makes each line an eighth note. Because each line is an eighth note, each block of two quarter notes where I want my arpeggios lands either on the border between two four-line blocks containing no other notes or in a four-line block by itself...

...and therefore I can build my arpeggios directly in PICO-8 and let custom SFX instruments handle the fade-in and fade-out. I have six custom SFX instruments and all the arps are, very nearly, the exact notes in the score.

And I can do more shaping of the other notes, because they cover twice as many lines.

There's more polish I could and probably should do of this - I have twenty-five empty SFX to work with - but I'm happy with it. It was a really good exercise.

P#102309 2021-12-10 17:14

So, using PICO-8 with a US QWERTY keyboard (Wikimedia Commons image link), there's a kind of virtual music-keyboard embedded in it when you're editing SFX, with the bottom row from Z to M being the white keys of the octave below the one selected and the top row from Q to P being the white keys of the octave and a third above, and the black keys being on the lines above their adjacent white keys. C1 = z, C#1 = s, D1 = x, and so on.

For people using PICO-8 with other keyboard layouts, in the default keybindings, is this physical arrangement the same, or are the key names the same instead? Or some other situation?

P#99495 2021-11-02 01:53

As of 0.2.3, if you want to export a music composition in the tracker at the PICO-8 command line, the length of export caps at 32768 music ticks, or about four minutes and thirty-two seconds. To export something longer requires doing it in real time, be that five, ten, or seventy minutes, which is a pain and is slow.

Other exporters - sprite sheet, web application, binary - have flags to change how the export works; would it be possible to do something similar with the music/SFX exporter? Number of patterns played (or number of repeats, for a looping SFX) would seem the most intuitive for the end user, and (unlike music ticks) would involve numbers of a reasonable size, but I'm not attached to any specific solution.

P#97300 2021-09-14 04:00

Weird tiny bug I've noticed in 0.2.2c on Windows 7: if, either when PICO-8 is booting or rebooting, I hit Ctrl+M to toggle mute before the commandline appears, the M appears at the commandline after boot.

P#94146 2021-06-27 17:04


In versions of PICO-8 prior to 0.2.2, and according to the manual:

SFX instruments are only retriggered when the pitch changes, or the previous note
has zero volume. This is useful for instruments that change more slowly over time.
For example: a bell that gradually fades out. To invert this behaviour, effect 3
(normally 'drop') can be used when triggering the note. All other effect values have
their usual meaning when triggering SFX instruments.

However, in version 0.2.2, these SFX also retrigger when they have exceeded their total length.

The SFX up top demonstrates this: in 0.2.1b,

  • SFX 03 plays a single 16-tick note three times, 128 ticks apart, and
  • SFX 04 plays eight 16-tick notes at equal 32-tick intervals;

but in 0.2.2c,

  • SFX 03 plays a 64-tick note, two 16-tick notes, and then two 16-tick notes, and
  • SFX 04 plays eight 16-tick notes at a syncopated rhythm, alternating 48 and 16 ticks.

This will break some pre-0.2.2 compositions.

p.s. Slight edit correction: the manual is also incorrect in the opposite direction, because custom SFX instruments do not retrigger if the previous note has zero volume but uses the same pitch and instrument.

P#93989 2021-06-24 19:58 ( Edited 2021-06-24 20:12)

This is the most minor thing ever, but the manual currently says under stat x

20..23  Note number (0..31) on channel 0..3

...but if the LEN of the SFX or LOOP endpoint of the SFX is greater than 32 and the SFX plays that long, then stat(20..23) will display numbers greater than 32 just fine.

I don't know if this is worth fixing, but something like "(normally 0..31)" would be technically accurate and still probably convey the desired information.

P#92483 2021-05-24 02:07


For reasons, I loaded up the IMSLP page for Bach's first cello suite yesterday and downloaded one of the scores - Shin-Itchiro Yokoyama's, I think it was - to transcribe into PICO-8.

I don't know if anyone on here has a dire need for more PICO-8 J.S. Bach beyond Gruber's arrangements of Bach's 2-Part Inventions from a couple years ago, but it was pretty rewarding to do and I like the results.

P#87805 2021-02-17 17:01

So, I wanted to do a quick experiment to see what happened if you played a note on a custom SFX instrument with reverb - would the reverb continue past the line where the note is played? would it cut off? Either would definitely be cool.

So I made a test cart:

Cart #dezapemiyi-0 | 2021-02-15 | Code ▽ | Embed ▽ | No License

...and did an export command from the command line to save a .wav of SFX 1 to open in Audacity, and PICO-8 immediately crashed.

It looks like it's an issue with SFX that contain custom SFX instruments, from my very quick testing.

Edit: I haven't noticed this error at any point recently; I'm going to chalk it up to gremlins and resolve the report.

P#87706 2021-02-15 23:06 ( Edited 2022-02-15 16:03)

As we've been messing around with doing various things in PICO-8, we've realized that there are a fair few operations involving moving blocks of bytes around in base RAM - animating sprites by switching sprites with each other on the spritesheet, storing the current draw state or random number seed during an operation so it can be restored afterwards, etc. and so on - where hardcoding memory addresses for temporary storage could lead to one operation clobbering data for another.

We don't know a lot about computer science, but it feels like the proper way to handle this is either using a peek to grab the data as a variable in Lua RAM and poke()ing it back afterwards or with a call stack somewhere in the user data RAM that functions can push data onto and pull data from. If a call stack actually is a good tool to have for this, it seems like a good function to implement as a library routine.

When we were thinking about it a while ago, we came up with:

-- stack handling in 55 tokens
-- incl. 25 tokens of overflow/
-- underflow handling

    local pointer=0x5e00
    -- i.e. just after user data

    function push(addr,len)
        pointer -= len
        if pointer < 0x4300 then
            stop("call stack overflow from "..addr)
    function pop(addr,len)
        if pointer+len > 0x5e00 then
            stop("call stack underflow to "..tostr(addr,true))
        pointer += len

...but I wanna kick it out onto the forums for people better at optimizing PICO-8 code to review and comment on.

P#84842 2020-11-29 18:49

*edit 2: 0.2.3 has a built-in way to do this with tostr

edit: see downthread for a better function

I was thinking about high scores in PICO-8 a while ago and it occurred to me that they'd make more sense as unsigned 32 bit integers than 16b.16b fixed point decimals. The easy part in that case is adding points - simply increment in units of 0x0.0001 instead of units of 1 - but if it's a high score, I'd also like to be able to display it.


function tostr_u32(n)
    -- return n as a 32-bit uint
    -- 92 tokens, ~1/780 of a 30 FPS CPU per call
    -- " " as thousands divider

    -- calculate ones
    -- (0x.03e8 = 1000 * 0x0.0001)
    local s=tostr(shl(n%0x.03e8,16))
    if n>0 then
        -- if not-actually-a-sign-bit is set
        -- have to be a little tricksy

        -- splitting in half
        --  n&0x0.ffff lower
        --  lshr(n,16) upper
        -- upper half unit = 65 536
        -- so within thousands:
        local m=536*lshr(n,16)
        -- originally used
--      local m=536*lshr(n,16)+n&0x0.ffff
        -- but that returned wrong results
        -- and doing the division by
        -- 1000 in two steps:

    while n~=0 do
        while #s%4~=3 do
            -- pad with zeros
            .." "..s

    return s

I'm sure this could be minimized further and/or optimized further and/or made more general, but I'd be willing to use it as is so I figured I'd share.

P#82745 2020-10-09 19:53 ( Edited 2021-09-10 12:40)

Cart #packbat_taptempo-1 | 2020-08-05 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

This one is super basic and was originally just going to be a utility within a bigger project, but it turned out so useful by itself that I wanted to share it. I'm sure not everyone has this problem, but I've found that changing the tempo after the SFX is written usually doesn't feel right - the piece ends up being built to make sense at the tempo it was created at.

To use the tap tempo tool, you decide what kind of rhythm you want to use, pick beats to tap on, figure out how many SFX lines between each beat you're tapping on, set that number appropriately, and tap it out.

(A couple examples: if I'm tapping quarter notes that I'll later subdivide into sixteenth notes, I leave it on 4 and tap every quarter note; if I'm planning to use a tresillo rhythm, 3+3+2, I set it to eight lines, tap the first beat of each group on the [x] button, and tap the other beats on the table.)

Then, when you're done tapping, you can hit [o] (z or c on keyboard, usually) to stop, reboot PICO-8, and punch in the calculated SPD to start composing with it.

If the tempo is jumping around weirdly while you're tapping, there might be some taps counting as multiple (I think the electrical engineering term is "bouncing"); increasing the "ignore gaps under" threshold will probably help stabilize it. (2 worked fine for me with PICO-8 standalone, but I found myself turning it up to 5 when I was testing it on the web just now.)

Hope it works for folks!

Edit: Figured out that I introduced a bug right before uploading - should work better now.

P#79921 2020-07-25 15:06 ( Edited 2020-08-05 15:43)

I was testing out various PICO-8 cartridges in the new version, including my own Rain Gif cart, and I discovered that when I chose the built-in "Save Gif" option, it would report that a GIF was saved to the desktop:

...but no file would appear.

On further testing, I discovered that on manually saving an image, it throws an error:

I'm not sure why this would happen - I've already checked whitelisting PICO-8 in my virus checker and that changes nothing. (And besides, I can save files and use the audio exporter just fine.) I'm running Windows 7 (yes, I know...) and installed PICO-8 yesterday using the installer download.

P#78963 2020-07-06 01:31


Something I noticed today while experimenting with PICO-8 sound effects: in 0.2.0i, if a silent (volume=0) row immediately before a non-silent row with an SFX instrument has the same SFX instrument as its instrument (e.g. if the user shift-clicked the SFX instrument to set the entire SFX to that instrument), even though the UI shows no difference, the program sometimes plays the SFX differently. (It looks like the effect lasts as long as the nominal length of the SFX instrument - 32 times its SPD.)

I assume this is a bug in how SFX instruments are implemented; if it's not, it strikes me as a bug in how the information is displayed.

P#77796 2020-06-08 16:28

In previous versions of PICO-8, pressing the Backspace key would consistently delete the note on the line immediately above the cursor.

In 0.2.0i, it doesn't seem to consistently do that:

On at least one occasion not captured here, Backspace deleted the effect that had just been added, rather than any notes.

This unpredictability makes it frustrating to work, because I don't know what my inputs will do.

P#76394 2020-05-11 20:57


For fairly whimsical reasons, I decided to write a four-part crab canon in PICO-8. Tenor and soprano channels play the melody forwards, bass and alto channels play the melody backwards.

If anyone wants to use it for anything, feel free to ask - but given that it uses all 64 SFX slots and all four sound channels for eighty seconds of music, I don't expect it to be useful to anyone in particular. It was fun to break out some of the partwriting skills from community college music theory classes again, though.

P#76249 2020-05-09 18:07

Cart #packbat_parametric_demo-0 | 2020-03-02 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

Pretty straightforward: uses the feature of line() that it will draw from the end of the previous line to connect the dots around a curve defined parametrically (i.e. x,y both written as functions of t). Uses whatever the current pen color set by color() is.

Tried to build in some basic politeness features - it resets the draw state when it's done, it sets the sign on deltat to make sure that it points from t0 towards t1, it chooses a default value if deltat is given as 0 or not given, and it will always draw a line that starts at t0 and ends at t1 whether or not deltat is an integer factor of (t1-t0). With all of those implemented, it works out to 82 tokens; cutting all of those out drops it to 33 tokens. Haven't given this a bulletproof QA treatment but it passed some basic checks.

Demo uses the parametric representation of the standard ellipse off Wikipedia.

P#73616 2020-03-02 17:39

I realize it's not applicable for all games, but would it be feasible to implement screen reader support for PICO-8? I don't know a lot about WAI-ARIA for web or anything about accessibility of standalone applications, so I don't know how such a thing is to be done, but we already have printh() commands sending data to the "@clip"board - adding something like "@tts" (text to speech) seems PICO-8-ish.

PICO-8 already does a lot of accessibility-positive things - the color palette includes a lot of nicely contrasting brightnesses and hues, the controls can already be remapped freely, carts can implement optional mouse and keyboard input - and setting up for speech reader integration would give programmers another way to make their carts playable by everyone.

P#73131 2020-02-15 20:29

View Older Posts
Follow Lexaloffle:        
Generated 2022-07-02 17:01:23 | 0.098s | Q:49