rewrite my code using pyaudio intead of pygame for audio playback: import random
import multiprocessing as mp
import PySimpleGUI as sg
import vlc
import pygame
from sys import platform as PLATFORM
from nsfw_detector import predict
import time
class Metronome:
    def __init__(self, shared_dict):
        self.shared_dict = shared_dict
        self.bpm = None
        self.interval = None
        self.pause_flag = mp.Event()
    def play_metronome(self):
        pygame.init()
        pygame.mixer.init()
        time_since_last_bpm_change = time.perf_counter()
        self.shared_dict['bpm'] = random.randint(int(15 + self.shared_dict['progress']), int(80 + self.shared_dict['progress']))
        interval = 60 / self.shared_dict['bpm']
        pygame.mixer.music.load("I:/metronome.mp3")
        while True:
            if not self.pause_flag.is_set():
                pygame.mixer.music.play(0)
                pygame.time.delay(int(interval * 1000))
                elapsed_time = time.perf_counter() - time_since_last_bpm_change
                if elapsed_time > 6:
                    pygame.mixer.music.stop()
                    position = self.shared_dict['player']
                    self.shared_dict['bpm'] = random.randint(int(15 + self.shared_dict['progress']), int(80 + self.shared_dict['progress']))
                    interval = 60 / self.shared_dict['bpm']
                    self.shared_dict['increase'] = 6 * position
                    time_since_last_bpm_change = time.perf_counter()
    def pause(self):
        self.pause_flag.set()
    def resume(self):
        self.pause_flag.clear()
    @staticmethod
    async def hardcore_detector():
        model = predict.load_model('C:\\Users\\usuario\\Downloads\\mobilenet_v2_140_224\\saved_model.h5')
        result = predict.classify(model, 'screenshot.png')
        if result['screenshot.png']['porn'] > 0.5:
            print('The screenshot contains porn content.')
            safe = False
        elif result['screenshot.png']['sexy'] > 0.5:
            print('The screenshot contains sexy content.')
            safe = False
        elif result['screenshot.png']['hentai'] > 0.5:
            print('The screenshot contains hentai content.')
            safe = False
        elif result['screenshot.png']['drawings'] > 0.5:
            print('The screenshot contains drawings content.')
            safe = True
        elif result['screenshot.png']['neutral'] > 0.5:
            print('The screenshot contains neutral content.')
            safe = True
        else:
            p