Oh Snap!

Please turnoff your ad blocking mode for viewing your site content

Hit enter after type your search item

Python Tkinter Voice Recorder GUI to Record Audio From Microphone and Save it as .flac File Using SoundFile Library Desktop App Full Project For Beginners

/
/
/
22 Views

 

Welcome folks today in this blog post we will be recording audio from microphone using soundfile library in tkinter using python. All the full source code of the application is shown below.

 

 

Get Started

 

 

In order to get started you need to install the following library using the pip command as shown below

 

pip install soundfile

 

pip install sounddevice

 

After installing this library make an app.py file and copy paste the following code

 

app.py

 

 

import sounddevice as sd 
import soundfile as sf 
from tkinter import *
  
  
def Voice_rec(): 
    fs = 48000
      
    # seconds 
    duration = 5
    myrecording = sd.rec(int(duration * fs),  
                         samplerate=fs, channels=2) 
    sd.wait() 
      
    # Save as FLAC file at correct sampling rate 
    return sf.write('my_Audio_file.flac', myrecording, fs) 
  
  
master = Tk() 
  
Label(master, text=" Voice Recoder : "
     ).grid(row=0, sticky=W, rowspan=5) 
  
  
b = Button(master, text="Start", command=Voice_rec) 
b.grid(row=0, column=2, columnspan=2, rowspan=2, 
       padx=5, pady=5) 
  
mainloop()

 

READ  Python Tkinter (GTTS) GUI Script to Convert Speech to Text Audio Mp3 Using Google Text to Speech API Full Project For Beginners

 

Now if you execute the script by typing the command as shown below

 

python app.py

 

 

 

 

As you can see that audio file is saved on the root directory

Leave a Comment

Your email address will not be published. Required fields are marked *

This div height required for enabling the sticky sidebar
Coding Shiksha 2020. All Rights Reserved.
Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views :