This code stream play audio that are shushing and buzzing, with no voice, fix it : def _play_chunk(self, chunk):
        """
        Plays a chunk of audio data.

        Args:
            chunk: Chunk of audio data to be played.
        """

        # handle mpeg
        if self.audio_stream.config.format == pyaudio.paCustomFormat:

            # convert to pcm using pydub
            segment = AudioSegment.from_file(io.BytesIO(chunk), format="mp3")
            chunk = segment.raw_data

        sub_chunk_size = 1024
        
        for i in range(0, len(chunk), sub_chunk_size):
            sub_chunk = chunk[i:i + sub_chunk_size]

            if not self.muted:
                self.audio_stream.stream.write(sub_chunk)

            if self.on_audio_chunk:
                self.on_audio_chunk(sub_chunk)

            if not self.first_chunk_played and self.on_playback_start:
                self.on_playback_start()
                self.first_chunk_played = True            

            # Pause playback if the event is set
            while self.pause_event.is_set():
                time.sleep(0.01)

            if self.immediate_stop.is_set():
                break

Here's my other code for context :

import asyncio
import pyaudio
from audio_player import AudioConfiguration, StreamPlayer
import edge_tts
import logging

from io import BytesIO
from pydub import AudioSegment
import queue
import threading
# Other utility imports (e.g., time, io) may be required depending on your environment

def format_pitch(pitch):
    return f"{pitch:+.0f}Hz"

def format_percent(percent):
    return f"{percent:+.0f}%"

async def generate_and_fill_buffer(text, voice, speed=0, pitch=0, volume=0, audio_buffer=None):
    communicate = edge_tts.Communicate(text, voice, rate=format_percent(speed), 
                                       pitch=format_pitch(pitch), volume=format_percent(volume))
    try:
        async for chunk in communicate.stream():
            if chunk["type"] == "audio":
                audio_buffer.put(chunk["data"])
                
                if chunk.get('end', False):
                    # Signal end of transmission
                    audio_buffer.put(None)
                    break

    except Exception as e:
        print("Error processing audio chunk:", e)
        # Signal end of transmission on error
        audio_buffer.put(None)

async def main():
    # Initialize the audio_buffer for communication between TTS generation and StreamPlayer
    audio_buffer = queue.Queue()

    # Define the TTS parameters
    tts_settings = ("Hello World! How are you today? I'm super good!"*15, "en-GB-SoniaNeural", 15, 0, 0)

    # Define the audio configuration with a correct sample rate for Edge TTS service (e.g., 24000 or 16000)
    audio_config = AudioConfiguration(rate=24000)  # You may want to adjust this based on actual TTS sample rates

    # Create a StreamPlayer instance with the audio buffer and audio configuration
    stream_player = StreamPlayer(audio_buffer=audio_buffer, config=audio_config)

    # Start audio streaming in a separate thread
    stream_player.start()

    # Run TTS and fill buffer
    await generate_and_fill_buffer(*tts_settings, audio_buffer=audio_buffer)
    
    # Wait for all audio to be played out
    while not audio_buffer.empty():
        await asyncio.sleep(0.1)

    # Stop the StreamPlayer once all audio has been played
    stream_player.stop(immediate=True)

if __name__ == "__main__":
    asyncio.run(main())