Skip to content

music.play_notes

Kyuchumimo edited this page Jul 23, 2024 · 1 revision

🧩🔊 This is a general-purpose audio-related function.

music.play_notes(notes)

Parameters

  • notes: Notes to play.

Description

Play music notes.

Supported values are:

Notes: C, C#, D, D#, E, F, F#, G, G#, A, A#, B
Voice: Vn, where n is:0, 1 or 2
Octave: On, where n is: 0-9
Volume: Un, where n is: 0-9
Note duration: W, H, Q, I or S
W: Whole,
H: Half,
Q: Quarter
I: Eighth
S: Sixteenth

Inspired by C128 "play" BASIC command:
https://www.commodore.ca/manuals/128_system_guide/sect-07b.htm#7.3.html

This function is used to play music jingles using the AY-3-8910.
⚠️ Limitations: Due to the way the function works, the volume range to choose goes from 0 to 9 and not from 0 to 15 as the AY-3-8910 allows. This cannot be easily fixed without completely rewriting the function.

Note that you can only control the AY-3-8910 and not the Konami SCC. This is because the Konami SCC is intended to be used exclusively for music, while the AY-3-8910 is for sound effects and noise. It is a design choice.

This function is not meant to be used during gameplay, as it depends on time.sleep to work. It should be used at break times, for example, when opening a chest, when picking up an important item, at the beginning or end of a level, etc.

Example

music.play_notes('SO4GAO5CO4AQO5EIEQDSO4GAO5CO4AQO5DIDQC')
Clone this wiki locally