natiny.audio.set_master_volume

Lua
natiny.audio.set_master_volume(volume)

Sets the final gain applied to the complete audio mix.

Parameters

Name Type Description
volume number Linear gain; 1.0 is unchanged and 0.0 is silent

Example

Lua
natiny.audio.set_master_volume(0.5)

Notes

  • The initial master volume is 1.0. Negative values are clamped to 0.0; values above 1.0 are allowed.
  • The final output is clipped to -1.0 .. 1.0, so high gain can distort.