Skip to content

Commit 03655a0

Browse files
Merge pull request #2181 from Atharvashirsh/voice-recorder
Added Voice recorder files
2 parents 93ed41f + 2ad9999 commit 03655a0

File tree

5 files changed

+117
-0
lines changed

5 files changed

+117
-0
lines changed

Voice_Recorder/Images/mic.png

1.23 KB
Loading

Voice_Recorder/Images/screen.gif

1.87 MB
Loading

Voice_Recorder/Images/voice.png

1.06 KB
Loading

Voice_Recorder/README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Voice Recorder
2+
3+
This is a voice recording website.
4+
5+
Modules used:
6+
7+
1. Sounddevice
8+
2. Scipy
9+
3. Tkinter
10+
11+
## Setup instructions
12+
13+
`Step 1` : Install all the modules
14+
15+
```bash
16+
pip install sounddevice
17+
pip install scipy
18+
```
19+
20+
`Step 2` : Run the main script file
21+
22+
```bash
23+
python main.py
24+
```
25+
26+
## Output
27+
28+
<img src="Images/screen.gif" width="250px">
29+
30+
## Contributor
31+
32+
#### This project was contributed by Atharvashirsh Tiwary.
33+
34+
👾 Follow me on Github : [@Atharvashirsh](https://github.com/Atharvashirsh)
35+
36+
🤖 Connect with me and say Hi on LinkedIn : [@atharvashirsh](https://www.linkedin.com/in/atharvashirsh)
37+
38+
🐦 Follow me on Twitter : [@atharva_tiwary](https://www.twitter.com/atharva_tiwary)

Voice_Recorder/main.py

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
import sounddevice
2+
from scipy.io.wavfile import write
3+
from tkinter import *
4+
from tkinter.messagebox import showinfo, showwarning
5+
from tkinter.filedialog import askdirectory
6+
7+
PRIMARY_FONT = ("Comic Sans MS", 18)
8+
SECONDARY_FONT = ("Comic Sans MS", 12)
9+
10+
11+
addr = ""
12+
13+
14+
def file_path():
15+
global addr
16+
addr = askdirectory()
17+
l4["text"] = "Path : \n" + addr
18+
# print(addr)
19+
20+
21+
def savefile():
22+
global addr
23+
global filename
24+
try:
25+
time = int(sec.get())
26+
add = addr + "/" + str(filename.get()) + ".wav"
27+
showinfo(title="Start", message="Recording started")
28+
rece = sounddevice.rec(frames=time * 44100, samplerate=44100, channels=2)
29+
sounddevice.wait()
30+
write(add, rate=44100, data=rece)
31+
showinfo(title="End", message="Recording stopped")
32+
33+
except:
34+
showwarning(title="Wrong Time", message="Wrong format of time!!!")
35+
36+
37+
def main_window():
38+
global sec, filename, l4
39+
win = Tk()
40+
win.geometry("500x600")
41+
win.resizable(False, False)
42+
win.title("Voice Recorder")
43+
win.config(bg="Lightblue")
44+
45+
img1 = PhotoImage(file="Images/voice.png")
46+
l1 = Label(win, image=img1, bg="Lightblue")
47+
l1.place(x=186, y=20, height=128, width=128)
48+
49+
l2 = Label(win, text="Time in Sec", font=PRIMARY_FONT, bg="Lightblue")
50+
l2.place(x=0, y=180, height=50, width=200)
51+
52+
sec = Entry(win, font=(20))
53+
sec.place(x=180, y=180, height=50, width=200)
54+
55+
b = Button(win, text="Select Path", font=SECONDARY_FONT, command=file_path)
56+
b.place(x=150, y=280, height=50, width=200)
57+
58+
l4 = Label(
59+
win, text="Path : Path name here..." + addr, font=SECONDARY_FONT, bg="Lightblue"
60+
)
61+
l4.place(x=10, y=330, height=50, width=500)
62+
63+
img2 = PhotoImage(file="Images/mic.png")
64+
65+
l3 = Label(text="File name : ", font=PRIMARY_FONT, bg="Gray")
66+
l3.place(x=60, y=400, height=50, width=150)
67+
68+
filename = Entry(win, font=(20))
69+
filename.place(x=210, y=400, height=50, width=250)
70+
filename.insert(0, "file1")
71+
72+
start = Button(win, image=img2, bg="Darkgray", command=savefile)
73+
start.place(x=220, y=480, height=60, width=60)
74+
75+
win.mainloop()
76+
77+
78+
# savefile(5)
79+
main_window()

0 commit comments

Comments
 (0)