Pass audio file as microphone input with python

Viewed 933

I want to make a soundboard program for my friends and myself with a few meme sounds we find funny. I already have a working base with one button, that plays the desired sound. Now I just need to figure out a way how to make the audio play through my microphone (simulate microphone input). I already searched the internet and didn't find the exact solution I was looking for.

Here is the code I already have:

import tkinter as tk
import pygame

root = tk.Tk()
root.title("Soundboard");
root.geometry("720x480");

pygame.mixer.init()

def play():
    pygame.mixer.music.load("sound.mp3")
    pygame.mixer.music.play(loops=0)

play = tk.Button(root, text="Play", font=("Arial", 18), command=play)
play.pack(pady=20)

root.mainloop();

0 Answers
Related