Site icon TechVidvan

Python Voice Recorder Project with Source Code

Have you ever tried recording audio? There are times when we feel the need to record something important. Let us create a voice recorder project using Python which will help us record audio.

About Voice Recorder

A Voice Recorder is an application to record audio. The recording is saved and can be shared and seen afterward. We are going to have a start button and a stop button as well.

Python Voice Recorder Project Details

The objective of this project is to create a Voice Recorder which will have a start button to start recording and a stop button to stop the recording and save it as well. We will use two Modules to create this project –

Project Prerequisites

Install the following libraries as we are going to use them in our project. The commands to install are the following:

Download Python Voice Recorder Project Code

Before proceeding ahead, please download the source code of python voice recorder project from the following link: Voice Recorder Project

Steps to Build the Voice Recorder Project

Let us look at the steps to build Python Voice Recorder Project –

1. Import the Required Libraries:

#importing libraries
import tkinter as tk
from tkinter import *
import recorder

2. Creating GUI Window:

window = Tk()#creating window
window.geometry('700x300')#geometry of window
window.title('TechVidvan')#title to window
Label(window,text="Click on Start To Start Recording",font=('bold',20)).pack()#label
Button(window,text='Start',bg='green',command=start,font=('bold',20)).pack()#create a button
Button(window,text='Stop',bg='green',command=stop,font=('bold',20)).pack()#create a button

3. Start Button Functionality:

 
def start():
    global running
 
    if running is not None:
        print('already running')
    else:
        running = rec.open('untitled.flac', 'wb')
        running.start_recording()
    Label(window,text='Recording has started').pack()

4. Stop Button Functionality:

def stop():
    global running
 
    if running is not None:
        running.stop_recording()
        running.close()
        running = None
        Label(window,text='Recording has stopped').pack()
    else:
        print('not running')

Hurray! We have completed the Voice Recorder Project. Let’s have a look at the output.

Python Voice Recorder Output

After you record audio, you can see that a recording appears.

Summary

In this article, we have learned how to use Python PyAudio Module and Tkinter Module and create the python voice recorder project. Now we can use this project to record audio and save it.

Exit mobile version