So, as demonstrated by my recent post, I have finished my Pico-8 album, noclip. Now I want to export all the music from the cartridges. However, the exporter for music only exports one pattern. If you select multiple, it will simply export the one you just clicked on. Are there any tools made by the community which can export all the music from a cart and reconstruct it? Cheers in advance.
I'm no expert, but it exports full music fine for me: load the P8, switch over to the Music tab, choose the starting Pattern, hit Escape, "EXPORT TEST.WAV" gives me a full 4+ minute song WAV. You have to be on the Music editor tab (last tab) though.
From what I can tell, there are two built-in ways to turn PICO-8 audio into a .wav file. I believe both ways require audio to be not muted; the amplitude in the output file will be based on the current volume config setting.
Option A: export
If you move to a pattern (not select as in to copy+paste, scroll to as if you were about to start playing) and then hit Esc and type "export [filename].wav" at the command line, it will export music in the order it would be played until it hits a blank pattern, until it hits a stop flag, or until it hits 32768 music ticks (about 4:31), whichever comes first.
Edit: If the editor doesn't have the music editor open, I think it defaults to exporting an sfx instead - it will tell you what you did and you can course-correct if needed.
Option B: extcmd
If you run code something like this:
pattern = 0 extcmd("audio_rec") music(pattern) repeat flip() until stat(24)==-1 or btnp(4) or btnp(5) extcmd("audio_end") |
then PICO-8 will play your music starting at the specified pattern until it stops (at which point stat 24 = -1) or until you press a button. Then it will export everything that played, however long. This is slower, but you can use it to export arbitrarily long pieces of music, and [edit: use something similar to record] any kind of generative music if you make music programmatically.
Thanks @packbat, I didn't know about the hard 32k tick limit, that puts a slight damper in using PICO-8 as a chiptune DAW...
When I exported my music I assumed it was detecting that it exported the same looped section a couple times and intelligently stopped.
And thanks for the workaround using audio_rec, instead of seconds that will take several minutes, but it's OK.
Yeah, I think I thought the same thing, @touk? I'm very glad the extcmd workaround functions, though, because using an external program to record PICO-8 is a pain if all you want is the audio.
Ah, it seems I have greatly misunderstood the way exporting audio works lol. I thought that it exports only the patterns selected and no further, which, as shown by @packbat's explanation of the command, is not the case. Thanks, I'm glad to be part of such a helpful community!
Hmm... I seem to be experiencing the same issue I posted a while ago where it only exports about a single note of audio. That's both solutions. Strange...
That's very weird.
Would you be up for sharing a cart with some music that's not exporting correctly? I could test if it's broken on my machine, too.
Here's an example with the first song in the album, SEEN. When I run the cart, it plays the music for the right amount of time, then stops, but the resulting audio is half a note.
@wallgraffiti Sorry for the delay! I did the export both ways and it worked fine both times? I have no idea why it wouldn't work for you.
[Please log in to post a comment]