How To

Audio Register Questions


nathanielbabiak 2022-06-05 03:40

The manual shows some info under advanced topics, could anyone provide explanations about how these work? The ones I haven't listed are explained elsewhere in the manual. I suppose I could run some tests and figure these out, but it might be faster just to ask y'all...

was8bit 2022-06-05 18:00 (Edited)


the program...

in the code...





Pay attention to the YELLOW one.... notice how the graphics change based on how loud or soft the sound is playing...

was8bit 2022-06-05 18:08

The others seem to be settings which would normally be set as you edited a sound on the sound edit page... I haven't explored those yet, but as you have peaked my interest, I will experiment with these just for fun to see what happens :)

Timo 2022-06-05 20:33 (Edited)

Gate basically means if the key (of a music instrument) is pressed or not. Switching to 1 is like pressing and switching to 0 is like releasing.
It’s one of the things the PLAY command does.

Timo 2022-06-05 20:36

Timeout and its length is a mechanism to release a note after the given time. Otherwise the note needs to be released by some other command.

Timo 2022-06-05 20:38

I don’t remember Init now. Maybe it’s set to 1 for only one frame when a note starts.

SP4CEBAR 2022-06-05 21:04 (Edited)

Status bit 6, Init and Status bit 7, Gate

If I reverse engineered my old code correctly then:

Peak meter (read only)

a byte that shows the volume of the sound, can be used to make audio visualizers

Attribute bit 6, timeout enabled and Length (timeout)

in the NX documentation it mentiones "length" (or "len") two times:

  1. "PLAY v,p[,len] [SOUND s]" in this section, len is described as "The optional parameter len is the length in 1/60 seconds, the maximum is 255. 0 means, that the the sound won't stop automatically. If the parameter is omitted, the current value of the voice is kept."

  2. "SOUND v,[w],[pw],[len]" in this section, len is described as "len is the sound length in 1/60 seconds, the maximum is 255. 0 means, that the sound won't stop automatically. If the length is set using this command, the length parameter of PLAY can be omitted."

It says "the maximum is 255", which means that the length of a sound is a byte, this is probably what's stored inside "Length (timeout)"

it also says "0 means, that the sound won't stop automatically" this is probably what's stored inside the Length (timeout) bit

nathanielbabiak 2022-06-06 03:39

Thanks everyone - this is exactly what I was hoping for!

was8bit 2022-06-06 11:16

Changing INIT or GATE values do not change anything... (unless i am doing something wrong)

Timo 2022-06-06 12:50

I guess you have to change GATE and set INIT to 1 at the same time.

SP4CEBAR 2022-06-06 14:00 (Edited)

They have to be changed at the same time, that is also what I found in a program I made a while ago

this should start a sound on voice 1
POKE $FF42,PEEK($FF42)MOD 64+64+128
this should stop a sound on voice 1
POKE $FF42,PEEK($FF42)MOD 64+64

In this code
the audio registers are read [PEEK($FF42)]
both init and gate are set to zero [MOD 64]
init is set to one [+64]
gate is set to one [+128]
the audio register is written with the new data [POKE $FF42,]

was8bit 2022-06-06 22:17

So this works..

PLAY 0,50,1 SOUND 0
POKE $FF42,PEEK($FF42)MOD 64+64+128

But it doesnt yield an advantage over just using PLAY

SP4CEBAR 2022-06-08 08:13 (Edited)

I've used it to play sound without overwriting the frequency registers here
(Play without defining a note to play)

was8bit 2022-06-08 11:04

Ah, that assumes you have the note defined.... for certain circumstances that IS a very handy thing :)

Log in to reply.