Constructor

new(options:HowlOptions)

Methods

duration(?id:Int):Int

Get the duration of this sound. Passing a sound id will return the sprite duration.

Parameters:

id

The sound id to check. If none is passed, return full source duration.

Returns:

Audio duration in seconds.

fade(from:Float, to:Float, len:Int, ?id:Int):Howl

Fade a currently playing sound between two volumes (if no id is passsed, all sounds will fade). @return

Parameters:

from

The value to fade from (0.0 to 1.0).

to

The volume to fade to (0.0 to 1.0).

len

Time in milliseconds to fade.

id

The sound id (omit to fade all sounds).

load():Howl

Load the audio file. @return

loop(?loop:Dynamic, ?id:Int):Dynamic

Get/set the loop parameter on a sound. This method can optionally take 0, 1 or 2 arguments.

loop() -> Returns the group's loop value.
loop(id) -> Returns the sound id's loop value.
loop(loop) -> Sets the loop value for all sounds in this Howl group.
loop(loop, id) -> Sets the loop value of passed sound id.

Returns:

Returns self or current loop value.

mute(muted:Bool, ?id:Int):Howl

Mute/unmute a single sound or all sounds in this Howl group. @return

Parameters:

muted

Set to true to mute and false to unmute.

id

The sound ID to update (omit to mute/unmute all).

off(event:String, fn:Function, ?id:Int):Howl

Remove a custom event. Call without parameters to remove all events. @return

Parameters:

event

Event name.

fn

Listener to remove. Leave empty to remove all.

id

(optional) Only remove events for this sound.

on(event:String, fn:Function, ?id:Int):Howl

Listen to a custom event. @return

Parameters:

event

Event name.

fn

Listener to call.

id

(optional) Only listen to events for this sound.

once(event:String, fn:Function, ?id:Int):Howl

Listen to a custom event and remove it once fired. @return

Parameters:

event

Event name.

fn

Listener to call.

id

(optional) Only listen to events for this sound.

pannerAttr(args:PannerAttr, ?id:Int):Howl

Get/set the panner node's attributes for a sound or group of sounds. This method can optionally take 0, 1 or 2 arguments. pannerAttr() -> Returns the group's values. pannerAttr(id) -> Returns the sound id's values. pannerAttr(o) -> Set's the values of all sounds in this Howl group. pannerAttr(o, id) -> Set's the values of passed sound id.

Attributes:

coneInnerAngle - (360 by default) A parameter for directional audio sources, this is an angle, in degrees,
                 inside of which there will be no volume reduction.
coneOuterAngle - (360 by default) A parameter for directional audio sources, this is an angle, in degrees,
                 outside of which the volume will be reduced to a constant value of coneOuterGain.
coneOuterGain - (0 by default) A parameter for directional audio sources, this is the gain outside of the
                coneOuterAngle. It is a linear value in the range [0, 1].
distanceModel - ('inverse' by default) Determines algorithm used to reduce volume as audio moves away from
                listener. Can be linear, inverse or `exponential.
maxDistance - (10000 by default) The maximum distance between source and listener, after which the volume
              will not be reduced any further.
refDistance - (1 by default) A reference distance for reducing volume as source moves further from the listener.
              This is simply a variable of the distance model and has a different effect depending on which model
              is used and the scale of your coordinates. Generally, volume will be equal to 1 at this distance.
rolloffFactor - (1 by default) How quickly the volume reduces as source moves from listener. This is simply a
                variable of the distance model and can be in the range of [0, 1] with linear and [0, ∞]
                with inverse and exponential.
panningModel - ('HRTF' by default) Determines which spatialization algorithm is used to position audio.
                Can be HRTF or equalpower.

Returns:

Returns self or current panner attributes.

pause(?id:Int):Howl

Pause playback and save current position. @return

Parameters:

id

The sound ID (empty to pause all in group).

play(?sprite:Dynamic):Int

Play a sound or resume previous playback.

Parameters:

sprite

Sprite name for sprite playback or sound id to continue previous.

Returns:

Sound ID.

playing(?id:Int):Bool

Check if a specific sound is currently playing or not (if id is provided), or check if at least one of the sounds in the group is playing or not.

Parameters:

id

The sound id to check. If none is passed, the whole sound group is checked.

Returns:

True if playing and false if not.

pos(?x:Float, ?y:Float, ?z:Float, ?id:Int):Dynamic

Get/set the 3D spatial position of the audio source for this sound or group relative to the global listener.

Parameters:

x

The x-position of the audio source.

y

The y-position of the audio source.

z

The z-position of the audio source.

id

The sound ID. If none is passed, all in group will be updated.

Returns:

Returns self or the current 3D spatial position: [x, y, z].

rate(?rate:Float, ?id:Int):Dynamic

Get/set the playback rate of a sound. This method can optionally take 0, 1 or 2 arguments.

rate() -> Returns the first sound node's current playback rate.
rate(id) -> Returns the sound id's current playback rate.
rate(rate) -> Sets the playback rate of all sounds in this Howl group.
rate(rate, id) -> Sets the playback rate of passed sound id.

Returns:

Returns self or the current playback rate.

seek(?seek:Float, ?id:Int):Dynamic

Get/set the seek position of a sound (in seconds). This method can optionally take 0, 1 or 2 arguments.

seek() -> Returns the first sound node's current seek position.
seek(id) -> Returns the sound id's current seek position.
seek(seek) -> Sets the seek position of the first sound node.
seek(seek, id) -> Sets the seek position of passed sound id.

Returns:

Returns self or the current seek position.

state():String

Returns the current loaded state of this Howl.

Returns:

'unloaded', 'loading', 'loaded'

stereo(?pan:Float, ?id:Int):Dynamic

Get/set the stereo panning of the audio source for this sound or all in the group.

Parameters:

pan

A value of -1.0 is all the way left and 1.0 is all the way right.

id

(optional) The sound ID. If none is passed, all in group will be updated.

Returns:

Returns self or the current stereo panning value.

stop(?id:Int):Howl

Stop playback and reset to start. @return

Parameters:

id

The sound ID (empty to stop all in group).

unload():Void

Unload and destroy the current Howl object. This will immediately stop all sound instances attached to this group.

volume(?vol:Float, ?id:Int):Dynamic

Get/set the volume of this sound or of the Howl group. This method can optionally take 0, 1 or 2 arguments.

volume() -> Returns the group's volume value.
volume(id) -> Returns the sound id's current volume.
volume(vol) -> Sets the volume of all sounds in this Howl group.
volume(vol, id) -> Sets the volume of passed sound id.

Returns:

Returns self or current volume.