Log In  

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.

P#68518 2019-10-05 14:53 ( Edited 2019-10-05 14:53)

Err ... you don't. Not yet anyways. Hopefully in release D (upcoming).

I need that age to be a little higher to explain how people currently do it as it's not at all a simple process - at least for me it certainly isn't.

P#68521 2019-10-05 15:34 ( Edited 2019-10-05 15:49)

Ah ok...well, round up to whatever age necessary. How do you go about it atm?

P#68525 2019-10-05 16:41

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.

P#68526 2019-10-05 16:50

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?)

P#68527 2019-10-05 17:29

What music are you trying to transfer ? URL ?

P#68528 2019-10-05 17:36

@vincendi You're running into a problem because the _draw() function runs 30 times a second, so if music(33) is in the _draw() function, your music is starting 30 times a second. Maybe put it in _init(), which only runs once at the beginning.

P#68529 2019-10-05 17:37

@dw817 it's track 6 from here: https://www.lexaloffle.com/bbs/?tid=2619

@MBoffin Ah that makes sense.

EDIT bc I am an idiot: of course I need to copy the sprites across too. Derp. Thanks for the help everyone :)

P#68530 2019-10-05 17:53 ( Edited 2019-10-05 18:28)

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.

P#68531 2019-10-05 17:55 ( Edited 2019-10-05 18:05)

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.)

P#68538 2019-10-05 19:34

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-04-20 04:47:35 | 0.027s | Q:21