πŸŽ™ Create a Modern Python GUI Voice Recorder App – Record & Save Audio Easily!

Demo :


Click Video πŸ‘‡πŸ‘‡πŸ‘‡














πŸ“Œ Description:

πŸš€ Learn how to build a stylish and modern Python GUI Voice Recorder App using Tkinter and SoundDevice! 🎀 Save your voice like a pro and create an interactive audio recording application. Perfect for beginners and advanced coders!


πŸ”Ή Features of this App:
✅ Modern & Attractive GUI 🎨
✅ Record high-quality audio 🎀
✅ Save recordings in .wav format πŸ“
✅ Python & Tkinter-based GUI


Code :


πŸ”§ Install Required Libraries : cmd => pip install sounddevice scipy customtkinter


import sounddevice as sd
from scipy.io.wavfile import write
import numpy as np
import customtkinter as ctk
from tkinter import messagebox
import threading
import time

# App Settings
ctk.set_appearance_mode("dark")  
ctk.set_default_color_theme("blue")  

class VoiceRecorderApp(ctk.CTk):
    def __init__(self):
        super().__init__()
        self.title("🎀 Modern Voice Recorder")
        self.geometry("400x500")
        self.resizable(False, False)

        self.recording = False
        self.frames = []
        self.sample_rate = 44100

        # UI Components
        self.label_title = ctk.CTkLabel(self, text="πŸŽ™ Voice Recorder", font=("Arial", 24, "bold"))
        self.label_title.pack(pady=20)

        self.progress_label = ctk.CTkLabel(self, text="Press Start to Record", font=("Arial", 16))
        self.progress_label.pack(pady=10)

        self.start_button = ctk.CTkButton(self, text="▶ Start Recording", command=self.start_recording, fg_color="green")
        self.start_button.pack(pady=10)

        self.stop_button = ctk.CTkButton(self, text="⏹ Stop Recording", command=self.stop_recording, fg_color="red", state="disabled")
        self.stop_button.pack(pady=10)

        self.exit_button = ctk.CTkButton(self, text="❌ Exit", command=self.quit)
        self.exit_button.pack(pady=20)

    def record_audio(self):
        self.recording = True
        self.frames = []
        self.progress_label.configure(text="Recording... 🎀")
        
        with sd.InputStream(samplerate=self.sample_rate, channels=2, dtype="int16") as stream:
            while self.recording:
                frame, _ = stream.read(1024)
                self.frames.append(frame)

    def start_recording(self):
        self.start_button.configure(state="disabled")
        self.stop_button.configure(state="normal")

        threading.Thread(target=self.record_audio, daemon=True).start()

    def stop_recording(self):
        self.recording = False
        self.start_button.configure(state="normal")
        self.stop_button.configure(state="disabled")
        self.progress_label.configure(text="Recording Saved! 🎢")

        # Save file
        filename = "recorded_audio.wav"
        audio_data = np.concatenate(self.frames, axis=0)
        write(filename, self.sample_rate, audio_data)
        messagebox.showinfo("Recording Complete", f"Audio saved as {filename}")

# Run App
if __name__ == "__main__":
    app = VoiceRecorderApp()
    app.mainloop()

Comments

Popular posts from this blog

πŸš€ Simple Login & Registration System in Python Tkinter πŸ“±

πŸš€ Create a Python Screen Recorder with Audio (Complete Code)

Python IP Tracker App with GUI | Track IP Location Real-Time! (Working Project)