-
-
Notifications
You must be signed in to change notification settings - Fork 7
API Song
Song class
- Fields
-
Functions
- Musician.Song.create
- Musician.Song:GetId
- Musician.Song:IsPlaying
- Musician.Song:GetProgression
- Musician.Song:SetTrackMuted
- Musician.Song:TrackIsMuted
- Musician.Song:SetTrackSolo
- Musician.Song:Play
- Musician.Song:Reset
- Musician.Song:Seek
- Musician.Song:Resume
- Musician.Song:Stop
- Musician.Song.OnUpdate
- Musician.Song:PlayOnFrame
- Musician.Song:IsAudible
- Musician.Song:NoteOn
- Musician.Song:NoteOff
- Musician.Song:TrackNotesOff
- Musician.Song:SongNotesOff
- Musician.Song:ImportFromBase64
- Musician.Song:Import
- Musician.Song:CancelImport
- Musician.Song:OnImportError
- Musician.Song:Clone
- Musician.Song:Stream
- Musician.Song:StopStreaming
- Musician.Song:AppendChunk
- Musician.Song:StreamOnFrame
- Musician.Song:PackChunk
- Musician.Song.UnpackChunkHeader
- Musician.Song.UnpackChunkData
- Musician.Song.GetPlayingSongs
- Musician.Song.GetPlayingSongCount
- Musician.Song:ConvertToLive
- id (int) Song ID, used for streaming
- crc32 (int) CRC32 of imported song data
- tracks (table) Song tracks, including instrument and notes
- duration (float) Song duration in seconds
- name (string) Song title
- player (string) Player name, with realm slug
- notified (boolean) True when the notification for the song playing has been displayed
- playing (boolean) True when the song is playing
- streaming (boolean) True when the song is streaming
- importing (boolean) True when the song is being imported
- chunkDuration (number) Duration of a streaming chunk, in seconds
- mode (int) Song mode
- cropFrom (number) Play song from this position
- cropTo (number) Play song until this position
- cursor (number) Cursor position, in seconds
- soloTracks (int) Number of tracks in solo
- polyphony (int) Current theoretical polyphony
- drops (int) Dropped notes
Song class
Musician.Song.create()Return song ID
songId = Musician.Song:GetId()Returns
- songId (int)
Return true if the song is playing or about to be played (preloading).
isPlaying = Musician.Song:IsPlaying()Returns
- isPlaying (boolean)
Return playing progression
progression = Musician.Song:GetProgression()Returns
- progression (number)
Mute or unmute track
Musician.Song:SetTrackMuted(track, isMuted)Arguments
- track (table)
- isMuted (boolean)
Return true if the track is muted
isMuted = Musician.Song:TrackIsMuted(track)Arguments
- track (table)
Returns
- isMuted (boolean)
Set/unset track solo
Musician.Song:SetTrackSolo(track, isSolo)Arguments
- track (table)
- isSolo (boolean)
Play song
Musician.Song:Play(delay)Arguments
- delay (number) Delay in seconds to wait before playing the song
Reset song to initial position
Musician.Song:Reset()Seek to position
Musician.Song:Seek(cursor)Arguments
- cursor (number)
Resume a song playing
Musician.Song:Resume(eventSent)Arguments
- eventSent (boolean)
Stop song
Musician.Song:Stop()Main on frame update function
Musician.Song.OnUpdate(elapsed)Arguments
- elapsed (number)
Play notes accordingly to every frame.
Musician.Song:PlayOnFrame(elapsed)Arguments
- elapsed (number)
Returns true when the song is being played and can be heard
isAudible = Musician.Song:IsAudible()Returns
- isAudible (boolean)
Play a note
Musician.Song:NoteOn(track, noteIndex, retries)Arguments
- track (table) Reference to the track
- noteIndex (int) Note index
- retries (int) Number of attempts to recover dropped notes
Stop a note of a track
Musician.Song:NoteOff(track, key, audioOnly, decay)Arguments
- track (table) Reference to the track
- key (int) Note key
- audioOnly (boolean) Stop note audio only
- decay (number) Override instrument decay (optional)
Stop all notes of a track
Musician.Song:TrackNotesOff(track, audioOnly)Arguments
- track (table) Reference to the track
- audioOnly (boolean)
Stop all notes of the song
Musician.Song:SongNotesOff()Import song from a base 64 encoded string
Musician.Song:ImportFromBase64(base64data, crop, onComplete)Arguments
- base64data (string)
- crop (boolean) Automatically crop song to first and last note
- onComplete (function) Called when the whole import process is complete. Argument is true when successful (optional)
Import song from string
Musician.Song:Import(data, crop, previousProgression, onComplete)Arguments
- data (string)
- crop (boolean) Automatically crop song to first and last note
- previousProgression (number) Add previous progression (0-1) _(default=0)
- onComplete (function) Called when the whole import process is complete. Argument is true when successful (optional)
Cancel current import
Musician.Song:CancelImport()Handle importing error
Musician.Song:OnImportError()Clone song
song = Musician.Song:Clone()Returns
- song (Musician.Song)
Stream song
Musician.Song:Stream()Stop streaming song
Musician.Song:StopStreaming()Append chunk data to current song
Musician.Song:AppendChunk(chunk, mode, songId, chunkDuration, playtimeLeft, player)Arguments
- chunk (table)
- mode (number)
- songId (number)
- chunkDuration (number)
- playtimeLeft (number)
- player (string)
Stream a chunk of the song on frame
Musician.Song:StreamOnFrame(elapsed)Arguments
- elapsed (number)
Pack a song chunk
data = Musician.Song:PackChunk(chunk)Arguments
- chunk (table)
Returns
- data (string)
Unpack song chunk header
mode, songId, chunkDuration, playtimeLeft, position, trackCount, headerLength = Musician.Song.UnpackChunkHeader(data)Arguments
- data (string)
Returns
- mode (int)
- songId (int)
- chunkDuration (number)
- playtimeLeft (number)
- position (table) player position and GUID
- trackCount (int)
- headerLength (number)
Unpack song chunk data
chunk = Musician.Song.UnpackChunkData(data)Arguments
- data (string)
Returns
- chunk (table)
Return songs currently playing
playingSongCount = Musician.Song.GetPlayingSongs()Returns
- playingSongCount (int)
Return the number of songs currently playing
playingSongCount = Musician.Song.GetPlayingSongCount()Returns
- playingSongCount (int)
Convert song to live mode.
For testing only
Musician.Song:ConvertToLive()Table of contents
- User guide (FR)
- Optional modules
- What the FAQ
- Tips and Tricks
- Music producer guide
- Localization
- Technical design
- API documentation
Discord / MusicianList / Patreon / Donate