Audio volume attribute

Definition and usage

volume The volume attribute sets or returns the volume of the audio, ranging from 0.0 (mute) to 1.0 (maximum volume).

Example

Set the volume to 30%:

document.getElementById("myAudio").volume = 0.3;

Try it yourself

Syntax

Return the volume attribute:

audioObject.volume

Set the volume attribute:

audioObject.volume= number

Attribute Value

Value Description
number

Specifies the volume of the audio. It must be a number between 0.0 and 1.0.

Example Value:

  • 1.0 is the highest volume (100%, default value)
  • 0.5 is half volume (50%)
  • 0.0 is silent (the same as mute)

Technical Details

Return Value: A number representing the volume of the audio.
Default Value: 1.0

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support