Love2D APIAudioOn this pageAudio Description: Provides an interface to create noise with the user's speakers. newSource Type: Function. Description: Creates a new Source from a filepath, File, Decoder or SoundData. -- Sources created from SoundData are always static. Signature: newSource: function(filename: string, source_type?: string): Source Parameters: ParameterTypeDescriptionfilenamestringThe filepath to the audio file.source_typestringStreaming or static source. Returns: Return TypeDescriptionSourcesource — A new Source that can play the specified audio. newSource Type: Function. Description: Creates a new Source from a filepath, File, Decoder or SoundData. -- Sources created from SoundData are always static. Signature: newSource: function(data: SoundData): Source Parameters: ParameterTypeDescriptiondataSoundDataThe SoundData to create a Source from. Returns: Return TypeDescriptionSourceA new Source that can play the specified audio. The SourceType of the returned audio is 'static'. newQueueableSource Type: Function. Description: Creates a new Source usable for real-time generated sound playback with Source:queue. Overload details: The sample rate, bit depth, and channel count of any SoundData used with Source:queue must match the parameters given to this constructor. Signature: newQueueableSource: function(sample_rate: integer, bit_depth: integer, channels: integer, buffers?: integer): Source Parameters: ParameterTypeDescriptionsample_rateintegerNumber of samples per second when playing.bit_depthintegerBits per sample (8 or 16).channelsinteger1 for mono or 2 for stereo.buffersintegerThe number of buffers that can be queued up at any given time with Source:queue. Cannot be greater than 64. A sensible default (~8) is chosen if no value is specified. (Default: 0.) Returns: Return TypeDescriptionSourceThe new Source usable with Source:queue. play Type: Function. Description: Starts playing all Sources contained in a table simultaneously. Signature: play: function(sources: {Source}): boolean Parameters: ParameterTypeDescriptionsources{Source}A table containing the Sources to play. Returns: Return TypeDescriptionbooleanWhether all specified Sources were successfully started. play Type: Function. Description: Starts playing all supplied Sources simultaneously. Signature: play: function(sources: Source...): boolean Parameters: ParameterTypeDescriptionsourcesSource...The Sources to play. Returns: Return TypeDescriptionbooleanWhether all specified Sources were successfully started. pause Type: Function. Description: Pauses all currently active Sources and returns them. Signature: pause: function(): {Source} Returns: Return TypeDescription{Source}Sources — A table containing a list of Sources that were paused by this call. pause Type: Function. Description: Pauses all Sources contained in a table. Signature: pause: function(sources: {Source}) Parameters: ParameterTypeDescriptionsources{Source}A table containing the Sources to pause. pause Type: Function. Description: Pauses all supplied Sources. Signature: pause: function(sources: Source...) Parameters: ParameterTypeDescriptionsourcesSource...The Sources to pause. stop Type: Function. Description: Stops all currently active Sources. Signature: stop: function() stop Type: Function. Description: Stops all Sources contained in a table. Signature: stop: function(sources: {Source}) Parameters: ParameterTypeDescriptionsources{Source}A table containing the Sources to stop. stop Type: Function. Description: Stops all supplied Sources simultaneously. Signature: stop: function(sources: Source...) Parameters: ParameterTypeDescriptionsourcesSource...The Sources to stop. getActiveSourceCount Type: Function. Description: Gets the current number of simultaneously playing sources. Signature: getActiveSourceCount: function(): integer getSourceCount: function(): integer Returns: Return TypeDescriptionintegerThe current number of simultaneously playing sources. setVolume Type: Function. Description: Sets the master volume. Signature: setVolume: function(volume: number) Parameters: ParameterTypeDescriptionvolumenumber1.0 is max and 0.0 is off. getVolume Type: Function. Description: Returns the master volume. Signature: getVolume: function(): number Returns: Return TypeDescriptionnumberThe current master volume setMixWithSystem Type: Function. Description: Sets whether the system should mix the audio with the system's audio. Signature: setMixWithSystem: function(mix: boolean): boolean Parameters: ParameterTypeDescriptionmixbooleanTrue to enable mixing, false to disable it. Returns: Return TypeDescriptionbooleanTrue if the change succeeded, false otherwise. setPosition Type: Function. Description: Sets the position of the listener, which determines how sounds play. Signature: setPosition: function(x: number, y: number, z?: number) Parameters: ParameterTypeDescriptionxnumberThe x position of the listener.ynumberThe y position of the listener.znumberThe z position of the listener. getPosition Type: Function. Description: Returns the position of the listener. Please note that positional audio only works for mono (i.e. non-stereo) sources. Signature: getPosition: function(): number, number, number Returns: Return TypeDescriptionnumberThe X position of the listener.numberThe Y position of the listener.numberThe Z position of the listener. setOrientation Type: Function. Description: Sets the orientation of the listener. Signature: setOrientation: function(forward_x: number, forward_y: number, forward_z: number, up_x: number, up_y: number, up_z: number) Parameters: ParameterTypeDescriptionforward_xnumberThe forward_x parameter.forward_ynumberThe forward_y parameter.forward_znumberThe forward_z parameter.up_xnumberThe up_x parameter.up_ynumberThe up_y parameter.up_znumberThe up_z parameter. getOrientation Type: Function. Description: Returns the orientation of the listener. Signature: getOrientation: function(): number, number, number, number, number, number Returns: Return TypeDescriptionnumberForward x of the listener orientation.numberForward y of the listener orientation.numberForward z of the listener orientation.numberUp x of the listener orientation.numberUp y of the listener orientation.numberUp z of the listener orientation. setVelocity Type: Function. Description: Sets the velocity of the listener. Signature: setVelocity: function(x: number, y: number, z?: number) Parameters: ParameterTypeDescriptionxnumberThe X velocity of the listener.ynumberThe Y velocity of the listener.znumberThe Z velocity of the listener. getVelocity Type: Function. Description: Returns the velocity of the listener. Signature: getVelocity: function(): number, number, number Returns: Return TypeDescriptionnumberThe X velocity of the listener.numberThe Y velocity of the listener.numberThe Z velocity of the listener. setDopplerScale Type: Function. Description: Sets a global scale factor for velocity-based doppler effects. The default scale value is 1. Signature: setDopplerScale: function(scale: number) Parameters: ParameterTypeDescriptionscalenumberThe new doppler scale factor. The scale must be greater than 0. getDopplerScale Type: Function. Description: Gets the current global scale factor for velocity-based doppler effects. Signature: getDopplerScale: function(): number Returns: Return TypeDescriptionnumberThe current doppler scale factor. setDistanceModel Type: Function. Description: Sets the distance attenuation model. Signature: setDistanceModel: function(model: string) Parameters: ParameterTypeDescriptionmodelstringThe new distance model. getDistanceModel Type: Function. Description: Returns the distance attenuation model. Signature: getDistanceModel: function(): string Returns: Return TypeDescriptionstringThe current distance model. The default is 'inverseclamped'. setEffect Type: Function. Description: Defines an effect that can be applied to a Source. Not all system supports audio effects. Use love.audio.isEffectsSupported to check. Signature: setEffect: function(name: string, settings?: AudioEffectSettings | boolean): boolean Parameters: ParameterTypeDescriptionnamestringThe name of the effect.settingsAudioEffectSettings or booleanThe settings to use for this effect, with the following fields: type: The type of effect to use. volume: The volume of the effect. ...: Effect-specific settings. See EffectType for available effects and their corresponding settings. Returns: Return TypeDescriptionbooleanWhether the effect was successfully created. Depending on the overload: Whether the effect was successfully disabled. getEffect Type: Function. Description: Gets the settings associated with an effect. Signature: getEffect: function(name: string, target?: AudioEffectSettings): AudioEffectSettings | nil Parameters: ParameterTypeDescriptionnamestringThe name of the effect.targetAudioEffectSettingsThe target parameter. Returns: Return TypeDescriptionAudioEffectSettings or nilThe settings associated with the effect. getActiveEffects Type: Function. Description: Gets a list of the names of the currently enabled effects. Signature: getActiveEffects: function(): {string} Returns: Return TypeDescription{string}The list of the names of the currently enabled effects. getMaxSceneEffects Type: Function. Description: Gets the maximum number of active effects supported by the system. Signature: getMaxSceneEffects: function(): integer Returns: Return TypeDescriptionintegerThe maximum number of active effects. getMaxSourceEffects Type: Function. Description: Gets the maximum number of active Effects in a single Source object, that the system can support. Overload details: This function return 0 for system that doesn't support audio effects. Signature: getMaxSourceEffects: function(): integer Returns: Return TypeDescriptionintegerThe maximum number of active Effects per Source. getRecordingDevices Type: Function. Description: Gets a list of RecordingDevices on the system. The first device in the list is the user's default recording device. The list may be empty if there are no microphones connected to the system. Audio recording is currently not supported on iOS. Overload details: Audio recording for Android is supported since 11.3. However, it's not supported when APK from Play Store is used. Signature: getRecordingDevices: function(): {RecordingDevice} Returns: Return TypeDescription{RecordingDevice}The list of connected recording devices. isEffectsSupported Type: Function. Description: Gets whether audio effects are supported in the system. Overload details: Older Linux distributions that ship with older OpenAL library may not support audio effects. Furthermore, iOS doesn't support audio effects at all. Signature: isEffectsSupported: function(): boolean Returns: Return TypeDescriptionbooleanTrue if effects are supported, false otherwise.