Songs¶
A song contains all the information about its notes and the instruments that control how the notes sound. It also contains settings related to how LSDJ should play the song.
Notes¶
A song is defined by its sequence. A sequence consists of a number of sequence steps. Each step specifies a chain for each of the Game Boy’s four audio channels (pulse 1, pulse 2, wave, and noise). See Chains for more information on how Chains are structured.
A song’s sequence is stored in its sequence
field as a two-dimensional
dictionary of chains.
Usage Examples¶
from pylsdj import Sequence
# Get the chain in step $3 of PU2 from the sequence
curr_chain = song.sequence[Sequence.PU2][0x3]
# Get that same chain from the global chains table
curr_chain_another_way = song.chains[curr_chain.index]
# Get chain $2D from the global chain table
chain_two_d = song.chains[0x2d]
Instruments¶
The sound of a note is determined by an instrument. An instrument can also refer to a synth or a macro table to control how it behaves over time.
A song contains global tables for instruments, synths and macro tables. These
are stored in the song’s instruments
, synths
and tables
fields,
resp.
Appearance and Playback Behavior¶
Songs also have a number of fields that control the appearance of LSDJ and its synchronization setting. A complete overview of what all these settings do is out of this document’s scope; see the API documentation below for a list of supported settings.
API Documentation¶
-
class
pylsdj.
Song
(song_data)¶ A song consists of a sequence of chains, one per channel.
-
bookmarks
¶ list of screen bookmarks
-
chains
¶ the song’s chain table, represented as a list of Chain objects
-
clock
¶ the amount of time LSDJ has been used since the last memory reset, represented as a Clock object
-
clone
¶ chain cloning depth; one of
"deep"
,"slim"
-
colorset
¶ the selected LSDJ colorset
-
file_changed
¶ 1
if the file has changed since last save,0
otherwise
-
font
¶ the selected LSDJ font
-
global_clock
¶ the amount of time LSDJ has been used total, represented as a Clock object
-
grooves
¶ the song’s groove table
-
instruments
¶ the song’s instrument table, represented as a list of Instrument objects
-
key_delay
¶ the delay before key repeat is activated for Game Boy buttons
-
key_repeat
¶ the key repeat speed for Game Boy buttons
-
phrases
¶ the song’s phrase table, represented as a list of Phrase objects
-
prelisten
¶ if non-zero, play notes and instruments while entering them
-
sequence
¶ the song’s sequence, showing the order in which chains are played on each of the four channels
-
song_version
¶ the song’s version number
-
speech_instrument
¶ the song’s speech instrument settings, represented as a SpeechInstrument object
-
sync_setting
¶ LSDJ’s sync setting; one of
"off"
,"slave"
,"master"
,"midi"
,"nano"
, and"keyboard"
-
tables
¶ the song’s table of macro tables, represented as Table objects
-
tempo
¶ the song’s tempo
-