Log In  

https://pico-8.fandom.com/wiki/P8SCII_Control_Codes#Audio_commands
Because there doesn't seem to be a method to specify the audio channels with "\a" I am trying to transfer my sound effects to the sfx editor.

I don't understand how to do this though. Let's take this example:
?"\as16x3a0"
s16...spd set to 16
no volume is specified so the fourth column is 5 by default
x3...final 5th column set to 3 for all notes
a0...note a(press n cause idk how to type it in manually) and octave 0

In the sfx editor that gets me, with spd=16, this:
a 0053

?"\as16x3a0" does not sound like that at all....so idk what I'm missing here. I need to figureout how to do it for notes like ?"\as9x3a-2i0dd1" which includes "-" being a sharp and idk how to input a sharp at all, # seems to be the keys above n's row.

Would appreciate an explanation on what I am missing here, and if there is a way to transfer it without manually going through it like this.

P#114180 2022-07-11 00:25 ( Edited 2022-07-11 00:28)

1

I think the problem is the instrument. The default instrument in PSCII codes is instrument 5 but the sfx editor defaults to 0. So your sfx should look like this:

a 0553

Also, you are correct, sharps are in the rows above. Note entry is laid out like a piano keyboard: z-m are the white keys (notes C-A) and the row above has the black keys. Specifically, s=C#, d=D#, g=F#, h=G# and j=A#. The same pattern is repeated at the top of the keyboard with q-y being the notes C-A but an octave higher and 2, 3, 5, 6, and 7 being the corresponding sharps.

P#114190 2022-07-11 09:51
1

I answered your question on Twitter yesterday, but posting the P8SCII part here for posterity because I don't believe this is documented in the manual or wiki.

P8SCII control code parameters only accept a single character as an argument, so you're actually passing speed 1 and the 6 is ignored. The params do accept "hexadecimal", so just for example, say we want our P8SCII audio to play C3 at speed 15:

?"\asfc"

The reason I said it accepts "hexadecimal" is because the character we passed as the argument to speed is not really hex, but is just a regular P8SCII character which gets mapped to a corresponding integer. Instead of passing f for decimal 15, we can pass the escaped ordinal number of f:

?"\as\102c"

Similarly, for "hex" value 0 - 9 we can pass ordinals 48 - 57, and for "hex" values a - f we can pass ords 97 - 102. We can now see @zep has done a clever thing, and you may have guessed it already, but how do we pass a value higher than 15? Well, what comes after f? Of course, it's g!

?"\asgc"

Or, g's ord value:

?"\as\103c"

You can continue incrementing from there. Since P8SCII represents 8-bit characters, we can pass all the way up to ord 255 as our argument, but this also seems to mean that the maximum value P8SCII will accept as an argument is 169 since ?"\as\256c" is invalid.

Hope that helps! :)

P#114191 2022-07-11 11:38
1

Forgot your last question. The very first (optional) param is the sfx value to play, and unlike above, this arg can be multi-character decimal. So, to play sfx 32:

"\a32"

Per the manual, when you don't specify the sfx number, Pico-8 will automatically choose one between 60-63. Any time you pass P8SCII audio control codes to actually play a sound, some sfx in RAM is going to be overwritten, either one you specified or one Pico-8 chooses for you. So if you want to play the sound and write it to a specific sfx slot, in this case, 32:

"\a32ceg"

Now that we know where to expect to find our P8SCII sfx in RAM, all we have to do is store it in ROM

P#114195 2022-07-11 12:11

Okay, I think I have it figured out now. Thankyou for your help. To summarize my understanding:

?"\a0ceg"

Will play and store the sound in the ram so when I later use sfx(0) it will play the sound the same way. In the sfx editor it won't exist though. I wish to transfer the inlines over to sfx so I can more easily assign the channels each sound use. Because playing seems tied to storing, I'd have to play it in init once to store it then zzzzzzz...it's not good and I'd rather just have it on sfx to begin with for clarity's sake. So I need to write in to the sfx editor.

cstore() will let me grab the data stored to ram via the above and write it to the sfx...so I can presumably run the code once to transfer it then I no longer need the code since its now got the data stored in the sfx editor. Cool, great. I don't know where to expect to find my "P8SCII sfx in RAM" though.. I don't know what to write in cstore(destination,source,length).

sfxaddr = 0x3200 + sfxid68
sfxaddr = 0x3200 + 0
68 --3200+0

So my destination...and my source are...
cstore(0x3200,0x3200)

So I'll open a new pico8 and run the following...and find that both examples are now perma assigned to an sfx slot:

?"\a0a"
cstore(0x3200,0x3200) --working
?"\a1s9x3a-2i0dd1"
cstore(0x3268,0x3268) --working

Okay, this seems to work as desired now. Since this is unfamiliar territory I think I'll do this in a separate pico8 instance then just copy and paste the sfx() data over to my game...probably manually recreating each, just cause I've sometimes had weird issues copy and pasting into the sfx header of the textfile when the effect modifiers are used. One remaining problem was the second example you were helping me with earlier:

?"\as9x3a-2i0dd1"
i.e. "a-2i0dd1"
a-2..is g# 2553
i0..sets the instrument from default 5 to 0
d...d 3053
d1...d 1053
"
"a-2i0dd1" is:
g# 2553
d 3053
d 1053

This sounded close but was still a little off. Turns out:
d...d 3053
is actually:
d...d 2053

The reason is as soon as you specify an octave, that gets set as the new default for any preceding notes. So it was the "a-2" part which specified the octave of the first d note to 2.

Doesn't seem to be eez way to pause gif so:

P#114211 2022-07-11 22:05 ( Edited 2022-07-11 22:14)

Sounds like u got it!

For the cstore() call, you probably want to pass a length of 68 as the third argument. I'm not sure how the function behaves without a length arg, but based on your post, I'd assume it writes as much data as it can up to length 0x4300.

For the octave part, it's better to think of the declaration D2 as a single note (as opposed to a setting which affects the previous note), as this is also standard in music notation. As far as P8SCII/Pico-8 goes, the default octave is 3 until u say otherwise, and as soon as you do, that's the new default until u specify a new one, which is why your D1 note worked as expected.

P#114245 2022-07-12 17:25

I don't understand the implications of the length arg in cstore(). But I ran the code and copied the code-line from the sfx label of the .p8 file. Then I manually made the same sound effect and its code-line in the sfx label was the exact same. So the length argument doesnt affect that data and I'm safe since that's all I'm copying over to my real game file.

But if the cstore() command without a length arg somehow uses up more memory...I don't really get that process cause I can specify any amount and the thing in the sfx tab sounds the same...even a length of 0. And the idea that the storage jumps 68 spaces each sfx_id...
sfxaddr = 0x3200 + sfxid68
I don't really understand this. I would assume there are 68 pieces of data in the memory dedicated to each sfx_id thus it has all this space in memory reserved in intervals of 68. Me writing to it with cstore()..I mean I don't see any indication that the length argument matters in this case. Regardless, I'm missing some of the facts.

P#114604 2022-07-21 15:45 ( Edited 2022-07-21 15:59)

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-04-18 20:25:55 | 0.009s | Q:18