How exactly do we move music between carts? I'm trying to use one track ("Melancholy") from Robby Duguay's Nine Songs https://www.lexaloffle.com/bbs/?tid=2619 but, what code do I need exactly? I can copy the patterns into another cart but stuck where to go from there. I am googling in vain, someone please explain in the most basic terms possible what I gotta do.
Now I'm pretty sure someone else will have a better explanation.
The music editor is composed of sound effects played at certain times (and with the help of the green button):
https://www.lexaloffle.com/bbs/?tid=35517
You can now play sounds at different pitches.
So music is actually a bunch of SFX all played at a perfect time and tempo.
As for transferring, to the best of my knowledge there currently is no way to transfer SFX or music through clipboard. Not sure why but there it is.
I may write a utility to do just that later if there is a demand (and also if one doesn't already exist).
If I really wanted a piece of music from a cart and I had permission to use it (important this), I would load up the cart that has it.
Then clear all the source-code, then COPY and PASTE my source-code right there and save as a different name. Transfer my sprites over too if necessary.
That's the only easy way I know to "transfer" music to your work cart.
Ok cool, yeah I get that much.
So that's what I've tried, but my issue is putting "music(33)" (the first of the 4 patterns for this track) doesn't play the song it just sticks on the first note - and also it breaks the game cause nothing gets drawn. (Music should be in the _draw function right?)
What MBoffin said. Thanks ! :D
You don't have this problem with FLIP() but that's not a good programming practice.
Anyways - yeah, it's a bit more work with _INIT(), _DRAW(), and _UPDATE().
Just be certain the music() command only plays once when you're ready to hear that single song.
Place in _INIT() if you only need to play it once and it's keyed for auto-repeat, but if more than once and you want to reset it manually during code. Put this in _UPDATE()
if (btnp(4)) music(33) |
Hit (O) to play song. Hit again to interrupt and start over again.
Other ways to copy sections of carts, for future reference:
(Obligatory dddaaannn-mentions-picotool bit:) picotool does this.
p8tool build mygame.p8.png --music othercart.p8.png --sfx othercart.p8.png |
... copies the music and sfx from othercart into mygame, overwriting what is in mygame. This works with both .p8 and .p8.png files.
You can also save both the origin and destination carts as .p8 files, open the files in a text editor, then find the sfx and music sections in the files and copy the lines from the origin into the destination. (You can then re-open the destination in PICO-8 and re-save as .p8.png if you like.)
[Please log in to post a comment]