-
-
Notifications
You must be signed in to change notification settings - Fork 7
API documentation
-
Functions
- Main
-
Communication
- Musician.Comm.CanBroadcast()
- Musician.Comm.CanPlay()
- Musician.Comm.PlaySong()
- Musician.Comm.StopSong()
- Musician.Comm.TogglePlaySong()
- Musician.Comm.GetCurrentSongCrc32()
- Musician.Comm.SetBandPlayReady(isReady)
- Musician.Comm.QueryBandReady()
- Musician.Comm.IsBandPlayReady()
- Musician.Comm.PlaySongBand()
- Musician.Comm.StopSongBand()
- Registry
-
Live
- Musician.Live.Enable(enabled)
- Musician.Live.IsEnabled()
- Musician.Live.IsPlayingLive()
- Musician.Live.CanStream()
- Musician.Live.NoteOn(key, layer, instrument, isChordNote)
- Musician.Live.NoteOff(key, layer, instrument, isChordNote)
- Musician.Live.AllNotesOff(onlyForLayer)
- Musician.Live.InsertNote(noteOn, key, layer, instrument)
- Musician.Live.IsBandSyncMode()
- Musician.Live.SetBandSyncMode(enabled)
- Musician.Live.ToggleBandSyncMode()
- Musician.Live.IsPlayerSynced(player)
- Musician.Live.BandNote(noteOn, key, layer, instrument)
-
Utility functions
- Musician.Utils.Print
- Musician.Utils.Debug
- Musician.Utils.PlaySoundFile
- Musician.Utils.PrintError
- Musician.Utils.Error
- Musician.Utils.Popup
- Musician.Utils.Highlight
- Musician.Utils.GetColorCode
- Musician.Utils.FormatText
- Musician.Utils.GetLink
- Musician.Utils.GetPlayerLink
- Musician.Utils.FormatPlayerName
- Musician.Utils.GetChatIcon
- Musician.Utils.DisplayEmote
- Musician.Utils.RemoveChatMessage
- Musician.Utils.NoteName
- Musician.Utils.NoteKey
- Musician.Utils.ReadBytes
- Musician.Utils.PackNumber
- Musician.Utils.UnpackNumber
- Musician.Utils.Base64Decode
- Musician.Utils.PackTime
- Musician.Utils.UnpackTime
- Musician.Utils.PackPlayerGuid
- Musician.Utils.UnpackPlayerGuid
- Musician.Utils.PackPlayerPosition
- Musician.Utils.UnpackPlayerPosition
- Musician.Utils.FromHex
- Musician.Utils.ToHex
- Musician.Utils.GetInstrumentName
- Musician.Utils.GetSoundFile
- Musician.Utils.SongIsPlaying
- Musician.Utils.MuteGameMusic
- Musician.Utils.GetNormalizedRealmName
- Musician.Utils.GetRealmLocale
- Musician.Utils.NormalizePlayerName
- Musician.Utils.SimplePlayerName
- Musician.Utils.PlayerRealm
- Musician.Utils.PlayerIsInGroup
- Musician.Utils.PlayerIsMyself
- Musician.Utils.PlayerIsOnSameRealm
- Musician.Utils.PlayerGuidIsVisible
- Musician.Utils.GetPromoEmote
- Musician.Utils.HasPromoEmote
- Musician.Utils.ResetFullPromoEmoteCooldown
- Musician.Utils.OverrideNextFullPromoEmote
- Musician.Utils.SendPromoEmote
- Musician.Utils.GetVersionText
- Musician.Utils.VersionCompare
- Musician.Utils.PaddingZeros
- Musician.Utils.FormatTime
- Musician.Utils.ParseTime
- Musician.Utils.GetInstrumentData
- Musician.Utils.GetSampleId
- Musician.Utils.PlayNote
- Musician.Utils.PreloadNote
- Musician.Utils.DeepCopy
- Musician.Utils.DeepMerge
- Musician.Utils.FlipTable
- Musician.Utils.GetOs
- Musician.Utils.EasyMenu
- Musician.Utils.EasyMenu_Initialize
- Musician.Utils.SetFontStringTextFixedSize
- Classes
-
Events
- Musician.Events.Frame
- Musician.Events.RegistryReady
- Musician.Events.CommChannelUpdate
- Musician.Events.CommSendAction
- Musician.Events.CommSendActionComplete
- Musician.Events.SongPlay
- Musician.Events.SongStop
- Musician.Events.SongChunk
- Musician.Events.StreamStart
- Musician.Events.StreamStop
- Musician.Events.SongCursor
- Musician.Events.SongInstrumentChange
- Musician.Events.NoteOn
- Musician.Events.NoteOff
- Musician.Events.VisualNoteOn
- Musician.Events.VisualNoteOff
- Musician.Events.LiveNoteOn
- Musician.Events.LiveNoteOff
- Musician.Events.NoteDropped
- Musician.Events.PreloadingProgress
- Musician.Events.PreloadingComplete
- Musician.Events.SongImportStart
- Musician.Events.SongImportProgress
- Musician.Events.SongImportComplete
- Musician.Events.SongImportSucessful
- Musician.Events.SongImportFailed
- Musician.Events.SourceSongLoaded
- Musician.Events.PromoEmote
- Musician.Events.Bandwidth
- Musician.Events.BandPlay
- Musician.Events.BandStop
- Musician.Events.BandPlayReady
- Musician.Events.BandReadyPlayersUpdated
- Musician.Events.LiveBandSync
Import song from encoded string. Triggers SongImport* events
Musician.ImportSource(str)Arguments
- str (string)
Mute or unmute a player
Musician.MutePlayer(playerName, isMuted)Arguments
- playerName (string)
- isMuted (boolean)
Return true if the player is muted
isMuted = Musician.PlayerIsMuted(playerName)Arguments
- playerName (string)
Returns
- isMuted (boolean)
Display a message in the console
Musician.Utils.Print(msg)Arguments
- msg (string)
Print debug stuff in the console
Musician.Utils.Debug(module, ...)Arguments
- module (string)
- ... (string)
Safely play a sound file, even if the sound file does not exist.
willPlay, soundHandle = Musician.Utils.PlaySoundFile(soundFile, channel)Arguments
- soundFile (string)
- channel (string)
Returns
- willPlay (boolean)
- soundHandle (int)
Display an error message in the console
Musician.Utils.PrintError(msg)Arguments
- msg (string)
Display an error message in a popup
Musician.Utils.Error(msg)Arguments
- msg (string)
Display a message in a popup
Musician.Utils.Popup(msg, callback, force)Arguments
- msg (string)
- callback (function)
- force (boolean)
Highlight text
highlightedText = Musician.Utils.Highlight(text, color)Arguments
- text (string)
- color (string|Color)
Returns
- highlightedText (string)
Get color code from RGB values
colorCode = Musician.Utils.GetColorCode(r, g, b)Arguments
- r (number) 0-1
- g (number) 0-1
- b (number) 0-1
Returns
- colorCode (string)
Format text, adding highlights etc.
formattedText = Musician.Utils.FormatText(text)Arguments
- text (string)
Returns
- formattedText (string)
Get hyperlink
link = Musician.Utils.GetLink(command, text, ...)Arguments
- command (string)
- text (string)
- ... (string)
Returns
- link (string)
Get player hyperlink
playerLink = Musician.Utils.GetPlayerLink(player)Arguments
- player (string)
Returns
- playerLink (string)
Get player name for display
formattedPlayerName = Musician.Utils.FormatPlayerName(player)Arguments
- player (string)
Returns
- formattedPlayerName (string)
Return the code to insert an icon in a chat message or a text string
chatIcon = Musician.Utils.GetChatIcon(path, r, g, b)Arguments
- path (string)
- r (number) 0-1 (optional)
- g (number) 0-1 (optional)
- b (number) 0-1 (optional)
Returns
- chatIcon (string)
Display a faked emote
Musician.Utils.DisplayEmote(player, playerGUID, message)Arguments
- player (string)
- playerGUID (string)
- message (string)
Remove a chat message by its line ID
Musician.Utils.RemoveChatMessage(lineID)Arguments
- lineID (int)
Return the note name corresponding its MIDI key
name = Musician.Utils.NoteName(key)Arguments
- key (int) MIDI key index
Returns
- name (string) from Musician.NOTE_NAMES
Return the MIDI key of the note name
key = Musician.Utils.NoteKey(noteName)Arguments
- noteName (string) from Musician.NOTE_NAMES
Returns
- key (int)
Read some bytes from a string and remove them
data, str = Musician.Utils.ReadBytes(str, bytes)Arguments
- str (string)
- bytes (int)
Returns
- data (string) read bytes
- str (string) new string
Pack an integer number into a string
data = Musician.Utils.PackNumber(num, bytes)Arguments
- num (int) integer to pack
- bytes (int) number of bytes
Returns
- data (string)
Unpack a string into an integer number
num = Musician.Utils.UnpackNumber(data)Arguments
- data (string)
Returns
- num (int)
Decode base 64 string
Lua 5.1+ base64 v3.0 (c) 2009 by Alex Kloss alexthkloss@web.de
licensed under the terms of the LGPL2
http://lua-users.org/wiki/BaseSixtyFour
str = Musician.Utils.Base64Decode(data)Arguments
- data (string)
Returns
- str (string)
Pack a time or duration in seconds into a string
data = Musician.Utils.PackTime(seconds, bytes, fps)Arguments
- seconds (float)
- bytes (int) Number of bytes
- fps (float) Precision in frames par second
Returns
- data (string)
Unpack a string into a time or duration in seconds
seconds = Musician.Utils.UnpackTime(data, fps)Arguments
- data (string)
- fps (float) Precision in frames par second
Returns
- seconds (float)
Pack player GUID into a 6-byte string
data = Musician.Utils.PackPlayerGuid()Returns
- data (string)
Unpack player GUID from string
guid = Musician.Utils.UnpackPlayerGuid(data)Arguments
- data (string)
Returns
- guid (string)
Pack player position into a 18-byte chunk string
data = Musician.Utils.PackPlayerPosition()Returns
- data (string)
Unpack player position from chunk string
posY, posX, posZ, instanceID, guid = Musician.Utils.UnpackPlayerPosition(str)Arguments
- str (string)
Returns
- posY (number)
- posX (number)
- posZ (number)
- instanceID (int)
- guid (string)
Convert hex string to string
str = Musician.Utils.FromHex(hex)Arguments
- hex (string)
Returns
- str (string)
Convert string to hex string
hex = Musician.Utils.ToHex(str)Arguments
- str (string)
Returns
- hex (string)
Return instrument name from its MIDI ID
instrumentName = Musician.Utils.GetInstrumentName(instrument, key)Arguments
- instrument (int)
- key (int)
Returns
- instrumentName (string) used as key in Musician.INSTRUMENTS
Get the path to a sound file for an instrument and a key.
Also returns the instrument data from Musician.INSTRUMENTS
and all other suitable sound file paths for randomization.
filePath, instrumentData, soundFiles = Musician.Utils.GetSoundFile(instrument, key)Arguments
- instrument (int) MIDI instrument index
- key (int) MIDI key
Returns
- filePath (string) file path to be played
- instrumentData (table) from Musician.INSTRUMENTS
- soundFiles (table) all suitable file paths for this instrument and note
Return true if a song is actually playing and is audible
isPlaying = Musician.Utils.SongIsPlaying()Returns
- isPlaying (boolean)
Start or stop the actual game music if a song can actually be heard
Musician.Utils.MuteGameMusic(force)Arguments
- force (boolean)
Return the normalized realm name the player belongs to
Safer than the standard GetNormalizedRealmName() that may return nil sometimes
realmName = Musician.Utils.GetNormalizedRealmName()Returns
- realmName (string)
Return the short locale code of the realm the player belongs to
locale = Musician.Utils.GetRealmLocale()Returns
- locale (string) 'en', 'fr' etc.
Return the normalized player name, including realm slug
normalizedPlayerName = Musician.Utils.NormalizePlayerName(playerName)Arguments
- playerName (string)
Returns
- normalizedPlayerName (string)
Return the simple player name, including the realm slug if needed
simpleName = Musician.Utils.SimplePlayerName(playerName)Arguments
- playerName (string)
Returns
- simpleName (string)
Return the player realm slug
realmSlug = Musician.Utils.PlayerRealm(playerName)Arguments
- playerName (string)
Returns
- realmSlug (string)
Return true if the player is in my party or raid
isInMyGroup = Musician.Utils.PlayerIsInGroup(playerName)Arguments
- playerName (string)
Returns
- isInMyGroup (boolean)
Return true if the provided player name is myself
isMyself = Musician.Utils.PlayerIsMyself(playerName)Arguments
- playerName (string)
Returns
- isMyself (boolean)
Return true if the provided player name is on the same realm or connected realm as me
isOnSameRealm = Musician.Utils.PlayerIsOnSameRealm(playerName)Arguments
- playerName (string)
Returns
- isOnSameRealm (boolean)
Return true if the player whose GUID is provided is visible (loaded) by the game client
isVisible = Musician.Utils.PlayerGuidIsVisible(guid)Arguments
- guid (string)
Returns
- isVisible (boolean)
Return the "Player is playing music" emote with promo message
promoEmote = Musician.Utils.GetPromoEmote()Returns
- promoEmote (string)
Return true if the message contains the promo emote, in any language
hasPromoEmote, isFullPromoEmote = Musician.Utils.HasPromoEmote(message)Arguments
- message (string)
Returns
- hasPromoEmote (boolean)
- isFullPromoEmote (boolean) true if the emote contains the part invinting other players to install Musician
Mark the full promo emote as recently seen
Musician.Utils.ResetFullPromoEmoteCooldown()Override the next full promo emote
Musician.Utils.OverrideNextFullPromoEmote()Send the "Player is playing music" emote with promo message
Musician.Utils.SendPromoEmote()Return the current version as text for the end user
version = Musician.Utils.GetVersionText()Returns
- version (string)
Compare two version numbers
difference = Musician.Utils.VersionCompare(versionA, versionB)Arguments
- versionA (string)
- versionB (string)
Returns
- difference (number) 0 if A = B, 1 if A > B, -1 if A < B
Add padding zeros
formattedNumber = Musician.Utils.PaddingZeros(number, zeros)Arguments
- number (int)
- zeros (int)
Returns
- formattedNumber (string)
Format time to mm:ss.ss format
formattedTime = Musician.Utils.FormatTime(time, simple)Arguments
- time (number)
- simple (boolean)
Returns
- formattedTime (string)
Parse time in seconds from mm:ss.ss format
seconds = Musician.Utils.ParseTime(timestamp)Arguments
- timestamp (string)
Returns
- seconds (number)
Return instrument data for given MIDI key number
instrumentData = Musician.Utils.GetInstrumentData(instrumentName, key)Arguments
- instrumentName (string)
- key (int) MIDI key number
Returns
- instrumentData (table) from Musician.INSTRUMENTS
Return sample ID for note and instrument data
sampleId = Musician.Utils.GetSampleId(instrumentData, key)Arguments
- instrumentData (table) as returned by Musician.Utils.GetSoundFile()
- key (int) MIDI key number
Returns
- sampleId (string)
Start playing a note
Returns true if sound will actually be played, sound handle and instrument data
willPlay, soundHandle, instrumentData = Musician.Utils.PlayNote(instrument, key)Arguments
- instrument (int) MIDI instrument
- key (int)
Returns
- willPlay (boolean)
- soundHandle (int)
- instrumentData (table) from Musician.INSTRUMENTS
Preload note
hasSample, preloadTime = Musician.Utils.PreloadNote(instrument, key)Arguments
- instrument (int)
- key (int)
Returns
- hasSample (boolean)
- preloadTime (number) in seconds
Deep copy a table
http://lua-users.org/wiki/CopyTable
copy = Musician.Utils.DeepCopy(orig)Arguments
- orig (table)
Returns
- copy (table)
Deep merge two tables
merged = Musician.Utils.DeepMerge(merged, orig)Arguments
- merged (table)
- orig (table)
Returns
- merged (table)
Flip a table
flipped = Musician.Utils.FlipTable(orig)Arguments
- orig (table)
Returns
- flipped (table)
Return operating system name
os = Musician.Utils.GetOs()Returns
- os (string)
Blizzard's EasyMenu using MSA_DropDownMenu
Musician.Utils.EasyMenu()Blizzard's EasyMenu_Initialize using MSA_DropDownMenu
Musician.Utils.EasyMenu_Initialize()Set text to a FontString element ensuring the visual text size is respected
Musician.Utils.SetFontStringTextFixedSize(fontString, text)Arguments
- fontString (FontString)
- text (string)
Fired at every screen refresh. OnUpdate functions can be attached to this event without needing to create a new frame.
Arguments
- elapsed (number) Time in seconds since last frame
Fired when the player registry is ready to use.
Fired when the status of the communication channel has changed
Arguments
- isConnected (boolean) True when connected to the channel
Fired when a communication action has been initiated
Arguments
- action (string) Action name, from Musician.Comm.action
Fired when a communication action has been completed
Arguments
- action (string) Action name, from Musician.Comm.action
Fired when a song starts playing
Arguments
- song (Musician.Song)
Fired when a song stops playing
Arguments
- song (Musician.Song)
Fired when a song chunk has been received
Arguments
- sender (string) Player name
- mode (number) Song mode (Musician.Song.MODE_DURATION or Musician.Song.MODE_LIVE)
- songId (number)
- chunkDuration (number) in seconds
- playtimeLeft (number) in seconds
- posY (number) Player world position Y
- posX (number) Player world position X
- posZ (number) Player world position Z
- instanceID (number) Player instance ID
- guid (string) Player GUID
Fired when a song starts streaming
Arguments
- song (Musician.Song)
Fired when a song stops streaming
Arguments
- song (Musician.Song)
Fired when the song cursor position has changed
Arguments
- song (Musician.Song)
Fired when the instrument of a song track has changed in the song editor
Arguments
- song (Musician.Song)
- track (table) Track object of the song
- midiId (number) MIDI id of the instrument
Fired when a song note starts playing and is audible
Arguments
- song (Musician.Song)
- track (table) Track object of the song
- key (number) MIDI key of the note
Fired when a song note stops playing
Arguments
- song (Musician.Song)
- track (table) Track object of the song
- key (number) MIDI key of the note
Fired when a song note starts playing, even when it's not audible (track muted, note dropped due to low polyphony etc.)
Used for visual feedback
Arguments
- song (Musician.Song)
- track (table) Track object of the song
- key (number) MIDI key of the note
- play (boolean) true when the note is audible
Fired when a song note stops playing, even when it was not audible (track muted, note dropped due to low polyphony etc.)
Used for visual feedback
Arguments
- song (Musician.Song)
- track (table) Track object of the song
- key (number) MIDI key of the note
Fired when a note on event is being sent in live mode
Arguments
- key (number) MIDI key of the note
- layer (number) Keyboard layer from Musician.KEYBOARD_LAYER
- instrumentData (table) Instrument data from Musician.INSTRUMENTS
- isChordNote (boolean) true when note is a power chord
Fired when a note off event is being sent in live mode
Arguments
- key (number) MIDI key of the note
- layer (number) Keyboard layer from Musician.KEYBOARD_LAYER
- isChordNote (boolean) true when note is a power chord
Fired when one or more note have been dropped due to a lack of polyphony during one frame while playing
Arguments
- song (Musician.Song)
- totalDrops (number) Total dropped notes since the song has been created
- drops (number) Number of notes dropped during the same frame
Fired when the preloading process is making progress
Arguments
- progress (number) Progression between 0 and 1
Fired when the preloading process is complete and all samples are now in disk cache
Fired when the song importing process is starting
Arguments
- song (Musician.Song)
Fired when the song importing process is making progress
Arguments
- song (Musician.Song)
- progress (number) Progression between 0 and 1
Fired when the song importing process is complete, regardless if it failed or not
Arguments
- song (Musician.Song)
Fired when the song importing process is complete successfully
Arguments
- song (Musician.Song)
Fired when the song importing process failed
Arguments
- song (Musician.Song)
Fired when the source song Musician.sourceSong has been successfully loaded
Fired when a "promo" emote has been received and filtered in the chat
Arguments
- isPromoEmoteSuccessful (boolean) true if the music can be heard
- msg (string)
- fullPlayerName (string)
- ... (string) Other arguments provided by ChatFrame_AddMessageEventFilter() (languageName, channelName...)
Fired when bandwidth limit indicator has changed while streaming a song
Arguments
- bandwidth (number) Equals to 0 when < Musician.BANDWIDTH_LIMIT_MIN and > 1 when exceeding Musician.BANDWIDTH_LIMIT_MAX
Fired when a player of the party or raid starts playing a song as a band
Arguments
- sender (string) Player name
- songCrc32 (number) The song CRC32 that will play
Fired when a player of the party or raid stops playing a song as a band
Arguments
- sender (string) Player name
- songCrc32 (number) The song CRC32 that will be stopped
Fired when a player of the party or raid is ready (or no longer ready) for band play
Arguments
- player (string) Player name
- songCrc32 (number) The song CRC32 the player has loaded
- isReady (boolean) Player is ready when true
- eventPrefix (string) Message prefix from Musician.Comm.event
Fired every time the list of players ready for band play should be updated
Fired when a player of the party or raid is synchronized (or no longer synchronized) for band play in live mode
Arguments
- player (string) Player name
- isSynced (boolean)
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