-
Notifications
You must be signed in to change notification settings - Fork 0
obsi.audio
This module is designed for playing noteblock music. Some of the stuff was made specifically for the developer to handle themselves.
Here are some file formats that are supported:
- NBS - Note Block Studio format that is used by Open Note Block Studio.
- ONB - Obsi Note Block format that was designed specifically for Obsi game engine.
Editors for the supported file formats:
- NBS - Open Note Block Studio
- ONB - Any text editor, this is a text format that was made for easy editing.
Functions of obsi.audio:
function | description |
---|---|
obsi.audio.playNote | Plays a single note of any instrument, with any pitch, after any or none delay |
obsi.audio.playSound | Same as obsi.audio.playNote, but plays any sound using Speaker.playSound |
obsi.audio.isAvailable | Checks if Obsi can use any of the speakers attached. |
obsi.audio.refreshChannels | Refreshes the list of speakers (channels). |
obsi.audio.getChannelCount | Returns the number of speakers (channels) that Obsi can use. |
obsi.audio.notesPlaying | Returns the number of notes that are queued for playing using audio.playNote |
obsi.audio.newSound | Creates a new obsi.Audio object that can be used later to play music. |
obsi.audio.play | Plays an obsi.Audio object with optional looping. |
obsi.audio.stop | Stops playing the music. If the obsi.Audio is provided, then all of the playing instances are stopped. |
obsi.audio.isID | Checks if the playing music at the specific ID is indeed the obsi.Audio object. |
obsi.audio.pause | Pauses the playing music. If the obsi.Audio is provided, then all of the playing instances are paused. |
obsi.audio.unpause | Unpauses the paused music. If the obsi.Audio is provided, then all of the paused instances are unpaused. |
obsi.audio.isPaused | Checks if the music at the specific ID is paused or not. Will return false if there is no song at that ID. |
obsi.audio.setVolume | Sets the volume at the specific ID is paused or not. If obsi.Audio is provided, then will set the volume of every playing audio of that source. |
obsi.audio.getVolume | Returns the volume at the specific ID. Returns 0 if audiobuffer at the ID is empty. |
Plays a single note of any instrument, with any pitch, after any or none delay.
Declared as:
obsi.audio.playNote(channel: integer, instrument: string, pitch: number, volume?: number, latency?: number)
Same as obsi.audio.playNote, but plays any sound using Speaker.playSound
Declared as:
obsi.audio.playSound(channel: integer, sound: string, pitch: number, volume?: number, latency?: number)
Checks if Obsi can use any of the speakers attached.
Declared as:
obsi.audio.isAvailable() -> boolean
Refreshes the list of speakers (channels).
Declared as:
obsi.audio.refreshChannels()
Returns the number of speakers (channels) that Obsi can use.
Declared as:
obsi.audio.getChannelCount() -> number
Returns the number of notes that are queued for playing using audio.playNote
Declared as:
obsi.audio.notesPlaying() -> number
Creates a new obsi.Audio object that can be used later to play music.
Declared as:
obsi.audio.newSound(soundPath: string) -> obsi.Audio
Plays an obsi.Audio
object with optional looping. Returns the ID where the audio is playing in the audiobuffer.
Declared as:
obsi.audio.play(source: obsi.Audio, loop?: boolean) -> number
Stops playing the music. If the obsi.Audio
is provided, then all of the playing instances are stopped.
Declared as:
obsi.audio.stop(source: obsi.Audio)
-- or
obsi.audio.stop(id: number)
Checks if the playing music at the specific ID is indeed the obsi.Audio
object.
Declared as:
obsi.audio.isID(source: obsi.Audio, id: integer) -> boolean
Pauses the playing music. If the obsi.Audio
is provided, then all of the playing instances are paused.
Declared as:
obsi.audio.pause(source: obsi.Audio)
-- or
obsi.audio.pause(id: integer)
Unpauses the paused music. If the obsi.Audio
is provided, then all of the paused instances are unpaused.
Declared as:
obsi.audio.unpause(source: obsi.Audio)
-- or
obsi.audio.unpause(id: integer)
Checks if the music at the specific ID is paused or not. Will return false if there is no song at that ID.
Declared as:
obsi.audio.isPaused(id: integer) -> boolean
Sets the volume at the specific ID is paused or not. If obsi.Audio
is provided, then will set the volume of every playing audio of that source.
Declared as:
obsi.audio.setVolume(source: obsi.Audio, volume: number)
-- or
obsi.audio.setVolume(id: integer, volume: number)
Returns the volume at the specific ID. Returns 0 if audiobuffer at the ID is empty.
Declared as:
obsi.audio.getVolume(id: integer) -> number