Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2020-101
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Sachith Fernando
2020-101
Commits
3820451b
Commit
3820451b
authored
Jan 08, 2021
by
LiniEisha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Integrate
parent
adb48fef
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
15 deletions
+26
-15
LectureSummarizingApp/Voice Recorder.py
LectureSummarizingApp/Voice Recorder.py
+26
-15
No files found.
LectureSummarizingApp/Voice Recorder.py
View file @
3820451b
import
sounddevice
as
sd
from
scipy.io.wavfile
import
write
import
wavio
as
wv
import
os
# Sampling frequency
freq
=
44100
def
AudioRecorder
(
audio
):
# Recording duration
duration
=
10
BASE_DIR
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
# Start recorder with the given values of
# duration and sample frequency
recording
=
sd
.
rec
(
int
(
duration
*
freq
),
samplerate
=
freq
,
channels
=
2
)
#for the array
DESTINATION_DIR
=
os
.
path
.
join
(
BASE_DIR
,
"audioArray
\\
{}"
.
format
(
audio
))
# Record audio for the given number of seconds
sd
.
wait
(
)
#for the audio
LECTURE_AUDIO_DIR
=
os
.
path
.
join
(
BASE_DIR
,
"lectures
\\
{}"
.
format
(
audio
)
)
# This will convert the NumPy array to an audio
# file with the given sampling frequency
write
(
"recording0.wav"
,
freq
,
recording
)
# Sampling frequency
freq
=
44100
# Recording duration
duration
=
20
# Start recorder with the given values of
# duration and sample frequency
recording
=
sd
.
rec
(
int
(
duration
*
freq
),
samplerate
=
freq
,
channels
=
2
)
# Record audio for the given number of seconds
sd
.
wait
()
# This will convert the NumPy array to an audio
# file with the given sampling frequency
write
(
"recording0.wav"
,
freq
,
recording
)
#Convert the NumPy array to audio file
wv
.
write
(
"recording1.wav"
,
recording
,
freq
,
sampwidth
=
2
)
\ No newline at end of file
wv
.
write
(
"recording1.wav"
,
recording
,
freq
,
sampwidth
=
2
)
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment