๐Ÿ”Š stewbeet.plugins.resource_pack.sounds

๐Ÿ“„ Source Code: stewbeet/plugins/resource_pack/sounds/__init__.py ๐Ÿ”—
๐Ÿ“„ Source Code: stewbeet/core/utils/sounds.py ๐Ÿ”—

๐Ÿ”— Dependencies

  • โœ… Required: sounds_folder configuration in meta.stewbeet
  • ๐Ÿ“ Position: Should be able to run anywhere in the pipeline
    (see basic/beet.yml for an example)
  • ๐Ÿ“‚ Assets: Requires a sounds folder with audio files

๐Ÿ“‹ Overview

The sounds plugin automatically processes sound files and generates the sounds.json configuration for Minecraft resource packs.
It intelligently groups numbered sound variants and handles multithreading for optimal performance.
(This plugin requires the sounds_folder configuration to be set in meta.stewbeet.)

Features Showcase

Example of a sounds folder with .ogg files:

Files are copied to resource pack and sounds.json is created:

๐ŸŽฏ Purpose

  • ๐ŸŽต Processes sound files from a designated sounds folder
  • ๐Ÿ”ข Groups numbered sound variants (e.g., sound_01.ogg, sound_02.ogg)
  • ๐Ÿ“„ Generates sounds.json configuration automatically
  • โšก Utilizes multithreading for efficient file handling
  • ๐Ÿท๏ธ Creates appropriate subtitles for sound identification

โš™๏ธ Configuration

๐ŸŽฏ Basic Example Configuration

pipeline: - ... - stewbeet.plugins.resource_pack.sounds - ... meta: stewbeet: sounds_folder: "assets/sounds" # Path to sounds directory

๐Ÿ“‹ Configuration Options

OptionTypeDefaultDescription
sounds_folderstringRequiredPath to the directory containing sound files. Must be set in meta.stewbeet.sounds_folder

โœจ Features

๐ŸŽต Sound File Processing

  • ๐Ÿ“ Recursively scans the sounds folder for audio files
  • โœ… Only supports .ogg file format for now
  • ๐Ÿงน Sanitizes filenames (removes spaces, converts to lowercase)
  • ๐Ÿ“ Creates Sound objects with proper source paths and subtitles

๐Ÿ”ข Numbered Variant Grouping

Automatically groups sound variants with numbered suffixes:

  • dirt_bullet_impact_01.ogg ๐ŸŽฏ
  • dirt_bullet_impact_02.ogg ๐ŸŽฏ
  • dirt_bullet_impact_03.ogg ๐ŸŽฏ

These become variants of the sound dirt_bullet_impact in sounds.json.

Supported numbering patterns:

  • name_01, name_02, etc. (with underscore)
  • name1, name2, etc. (without underscore)

๐Ÿ“„ Sounds.json Generation

  • ๐Ÿ”ง Automatically creates or updates sounds.json thanks to the add_sound function in stewbeet.core.utils.sounds
  • ๐Ÿท๏ธ Generates subtitles based on sound names
  • ๐ŸŽ›๏ธ Preserves sound properties (volume, pitch, weight, etc.)
  • ๐Ÿ“ Uses project namespace for sound references

โšก Multithreading Processing

  • ๐Ÿš€ Processes multiple sound files simultaneously
  • ๐Ÿ”ง Automatically optimizes worker count based on file quantity (max 32)
  • โฑ๏ธ Includes execution time measurement for performance monitoring