sounds

Sound and music management for the game.

This module handles the loading, mixing, and playback of all audio assets, including background music tracks, block-specific interaction sounds (mining, placing, walking), and UI sound effects.

class sounds.Sounds(app)[source]

Bases: object

Manages all audio assets, sound effects, and background music.

Handles loading sounds, randomizing playback for variety, and mapping specific blocks to their respective material sound effects.

Parameters:

app (Any) – The main application context.

set_sfx_volume(value)[source]

Updates the volume for all loaded sound effects.

Parameters:

value (float)

Return type:

None

play_walk(voxel_id)[source]

Plays a walking footstep sound based on the material of the block the player is standing on. Automatically cycles through the available footstep variations.

Parameters:

voxel_id (int)

Return type:

None

play_break(voxel_id)[source]

Plays a hard breaking sound when a block is fully destroyed.

Parameters:

voxel_id (int)

Return type:

None

play_place(voxel_id)[source]

Plays a block placement sound when adding a new block to the world.

Parameters:

voxel_id (int)

Return type:

None

play_jump(voxel_id)[source]

Plays a jump sound when the player jumps.

Parameters:

voxel_id (int)

Return type:

None

play_breaking(voxel_id, mining_time, mining_duration)[source]

Plays a continuous sequence of hitting sounds mapped to the progress of mining a block.

Parameters:
Return type:

None

play_place_block()[source]

Plays a pop sound effect when a dropped item entity is collected and added to the player’s inventory.

Return type:

None