Skip to content

Port ZerotoKoops' audio macros to the main oracles-disasm repo - #41

Open
mysterypaintwo wants to merge 9 commits into
Stewmath:masterfrom
mysterypaintwo:audio-general-macros
Open

Port ZerotoKoops' audio macros to the main oracles-disasm repo#41
mysterypaintwo wants to merge 9 commits into
Stewmath:masterfrom
mysterypaintwo:audio-general-macros

Conversation

@mysterypaintwo

@mysterypaintwo mysterypaintwo commented Aug 19, 2026

Copy link
Copy Markdown

Summary

Port the following audio macros into include/musicMacros.s, from ZerotoKoops' music repo:

  • tempo for defining note lengths from a BPM value
  • m_splitLength for subdividing note lengths into arbitrary timing divisions

These macros are additive and self-contained, and are intended for compatibility with older songs created using these macros, which are now also hosted on the Custom Music wiki page.

No changes to wram.s or audio.s are required, as these macros only provide timing functionality and do not introduce any new audio engine commands.

Details

tempo

Given a BPM value, calculates Q (frames per beat) and provides a set of eighth-note and twelfth-note length constants, along with their common groupings. This allows songs to specify note lengths using real musical divisions rather than manually calculated frame counts.

It also sets BEAT to 1.

m_splitLength

Provides a way to subdivide note lengths into arbitrary timing divisions that aren't covered by the built-in tempo groupings.

This is retained because it is needed for compatibility with songs using the original timing macros.

Deliberately excluded

The following macros from the external source are not being ported:

  • noteLen
  • volbeat
  • tarmbeat
  • echobeat
  • volbeat2
  • volbeat3

The associated volume, duty, echo, and phrasing functionality is outside the scope of this port.

The older wram.s / audio.s changes from the external source are also excluded, including renamed labels, outdated comments, the old $72 bank workaround, and the cmdf8/cmdfd/gotoCond/incCoda naming. These changes predate the current branch's engine and documentation work and should not be brought forward.

Comment thread include/musicMacros.s
; e8-ef: same as e0-e7

; f0: does various things for channels 0-5, sets volume and envelope for channel 7, see audio.s for details
; f0: unknown

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please undo the change to the comment for command $f0, the variable mentioned in the old comment has since been renamed.

Comment thread include/musicMacros.s
.endm

; e0-e7: set envelopes (for channels 0-3)
; e0-e7: set envelope (\1 $0-$7: software-simulated attack envelope speed, starting at volume 1 and

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new comment here no longer mentions that this only works for channels 0-3. I'm confused why the text mentions volume 15.

Comment thread include/musicMacros.s

; 61: wait without changing the previous note or rest, can be used to extend a note or rest (for channels 0-3)
.macro rest2 ; Unused?
; 61: extends the currently playing note/rest without retriggering or otherwise

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment should still mention that command $61 only works for channels 0-3. I think the note about command $60 would be more fitting above that command (and the decay only affects pulse channels). And I'm not sure if it's fair to call it bugged, it looks to me like it was intentionally programmed that way, whether or not it was communicated to the people who were inserting the music.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants