anti glitchin voice effect shit of asses power up!

fukurou

the supreme coder
ADMIN
prev ver:
Python:
class DiVoiceEffects(Skill):
    # Ensure that you have a "voices" directory in the same location as this script.
    # Place your .mp3 files inside this folder. The filenames should be sanitized
    # (lowercase, spaces replaced with underscores) for smooth playback.
    def __init__(self):
        super().__init__()
        self.set_skill_lobe(2)  # hardware lobe (because its an output)
        self.voices_folder = "voices"
        self._valid_voices = {  # Pre-sanitized filenames (e.g., "hello_world")
            os.path.splitext(f)[0].lower().replace(" ", "_")
            for f in os.listdir(self.voices_folder)
            if f.endswith('.mp3')
        }
        mixer.init()

    def input(self, ear: str, skin: str, eye: str):
        # Fast exit for empty input (no isinstance() check!)
        if not ear.strip():
            return

        # O(1) lookup in pre-cached set
        voice_key = ear.strip().lower().replace(" ", "_")
        if voice_key in self._valid_voices:
            self.setSimpleAlg("")
            mixer.music.load(f"{self.voices_folder}/{voice_key}.mp3")
            mixer.music.play()
 

fukurou

the supreme coder
ADMIN
Python:
class DiVoiceEffects(Skill):
    # Ensure that you have a "voices" directory in the same location as this script.
    # Place your .mp3 files inside this folder. The filenames should be sanitized
    # (lowercase, spaces replaced with underscores) for smooth playback.
    def __init__(self):
        super().__init__()
        self.set_skill_lobe(2)  # hardware lobe (output)

        # Get absolute path to the voices folder next to this skill file
        skill_dir = os.path.dirname(__file__)
        self.voices_folder = os.path.join(skill_dir, 'voices')

        # Create the voices folder if it doesn't exist
        if not os.path.exists(self.voices_folder):
            os.makedirs(self.voices_folder)
            print(f"📁 Created 'voices' directory at: {self.voices_folder}")

        # Load valid voice keys from the voices folder
        self._valid_voices = {
            os.path.splitext(f)[0].lower().replace(" ", "_")
            for f in os.listdir(self.voices_folder)
            if f.endswith('.mp3')
        }

    def input(self, ear: str, skin: str, eye: str):
        # Fast exit for empty input (no isinstance() check!)
        if not ear.strip():
            return

        # O(1) lookup in pre-cached set
        voice_key = ear.strip().lower().replace(" ", "_")
        if voice_key in self._valid_voices:
            self.setSimpleAlg("")
            RndMp3Player.play_specific_mp3("voices",voice_key)
 
Top