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
3a879725
Commit
3a879725
authored
4 years ago
by
LiniEisha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding a method to check background noise remove
parent
ae313a10
monitoring_student_behavior_IT17138000
IT17100908
QA_RELEASE
db_and_monitoring
2 merge requests
!39
It17100908
,
!28
It17100908
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
0 deletions
+50
-0
LectureSummarizingApp/noiseRemove.py
LectureSummarizingApp/noiseRemove.py
+50
-0
No files found.
LectureSummarizingApp/noiseRemove.py
0 → 100644
View file @
3a879725
import
numpy
as
np
import
scipy
as
sp
from
scipy.io.wavfile
import
read
from
scipy.io.wavfile
import
write
from
scipy
import
signal
import
matplotlib.pyplot
as
plt
#get_ipython().magic('matplotlib inline')
(
Frequency
,
array
)
=
read
(
'lectures/Lecture01.wav'
)
len
(
array
)
plt
.
plot
(
array
)
plt
.
title
(
'Original Signal Spectrum'
)
plt
.
xlabel
(
'Frequency(Hz)'
)
plt
.
ylabel
(
'Amplitude'
)
FourierTransformation
=
sp
.
fft
(
array
)
scale
=
sp
.
linspace
(
0
,
Frequency
,
len
(
array
))
plt
.
stem
(
scale
[
0
:
5000
],
np
.
abs
(
FourierTransformation
[
0
:
5000
]),
'r'
)
plt
.
title
(
'Signal spectrum after FFT'
)
plt
.
xlabel
(
'Frequency(Hz)'
)
plt
.
ylabel
(
'Amplitude'
)
GuassianNoise
=
np
.
random
.
rand
(
len
(
FourierTransformation
))
NewSound
=
GuassianNoise
+
array
write
(
"New-Sound-Added-With-Guassian-Noise.wav"
,
Frequency
,
NewSound
)
b
,
a
=
signal
.
butter
(
5
,
1000
/
(
Frequency
/
2
),
btype
=
'highpass'
)
filteredSignal
=
signal
.
lfilter
(
b
,
a
,
NewSound
)
plt
.
plot
(
filteredSignal
)
# plotting the signal.
plt
.
title
(
'Highpass Filter'
)
plt
.
xlabel
(
'Frequency(Hz)'
)
plt
.
ylabel
(
'Amplitude'
)
c
,
d
=
signal
.
butter
(
5
,
380
/
(
Frequency
/
2
),
btype
=
'lowpass'
)
# ButterWorth low-filter
newFilteredSignal
=
signal
.
lfilter
(
c
,
d
,
filteredSignal
)
# Applying the filter to the signal
plt
.
plot
(
newFilteredSignal
)
# plotting the signal.
plt
.
title
(
'Lowpass Filter'
)
plt
.
xlabel
(
'Frequency(Hz)'
)
plt
.
ylabel
(
'Amplitude'
)
write
(
"file.wav"
,
Frequency
,
np
.
int16
(
newFilteredSignal
/
np
.
max
(
np
.
abs
(
newFilteredSignal
))
*
32767
))
\ No newline at end of file
This diff is collapsed.
Click to expand it.
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