Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
HearingTest
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ed Rogers
HearingTest
Commits
2f5a090f
Commit
2f5a090f
authored
Feb 7, 2018
by
Edward Rogers
Browse files
Options
Downloads
Patches
Plain Diff
Simple code to play a sound of a given frequency
parent
b08bbdec
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
.idea/HearingTest.iml
+1
-1
1 addition, 1 deletion
.idea/HearingTest.iml
.idea/misc.xml
+1
-1
1 addition, 1 deletion
.idea/misc.xml
HearingTest.py
+19
-9
19 additions, 9 deletions
HearingTest.py
with
21 additions
and
11 deletions
.idea/HearingTest.iml
+
1
−
1
View file @
2f5a090f
...
...
@@ -2,7 +2,7 @@
<module
type=
"PYTHON_MODULE"
version=
"4"
>
<component
name=
"NewModuleRootManager"
>
<content
url=
"file://$MODULE_DIR$"
/>
<orderEntry
type=
"jdk"
jdkName=
"Python 3.
5 (pyGUI
)"
jdkType=
"Python SDK"
/>
<orderEntry
type=
"jdk"
jdkName=
"Python 3.
6 GUI (QT
)"
jdkType=
"Python SDK"
/>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
</component>
</module>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
.idea/misc.xml
+
1
−
1
View file @
2f5a090f
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"ProjectRootManager"
version=
"2"
project-jdk-name=
"Python 3.
5 (pyGUI
)"
project-jdk-type=
"Python SDK"
/>
<component
name=
"ProjectRootManager"
version=
"2"
project-jdk-name=
"Python 3.
6 GUI (QT
)"
project-jdk-type=
"Python SDK"
/>
</project>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
HearingTest.py
+
19
−
9
View file @
2f5a090f
...
...
@@ -22,16 +22,26 @@ Display agregated scores in second window
import
sounddevice
as
sd
import
numpy
as
np
import
matplotlib.pyplot
as
plt
import
soundfile
as
sf
import
time
if
__name__
==
'
__main__
'
:
fs
=
48000
print
(
sd
.
default
.
device
[
'
output
'
])
device
=
sd
.
query_devices
(
sd
.
default
.
device
[
'
output
'
])
fs
=
device
[
'
default_samplerate
'
]
length
=
0.5
f
=
1
00
norm
=
32000
f
=
50
00
# sound = np.zeros(int(length*fs))
#
# sound = np.sin(f*t)*norm
# sound, fs = sf.read('C:\Windows\media\Windows Background.wav', dtype='float32')
# t = np.arange(0, sound.shape[0]) * (1 / fs)
# plt.plot(t, sound)
# plt.show()
# print(device)
# sd.play(sound, fs, blocking=False)
# time.sleep(1)
t
=
np
.
arange
(
0
,
length
,
1
/
fs
)
sound
=
np
.
sin
(
f
*
t
)
*
norm
plt
.
plot
(
t
,
sound
)
plt
.
show
()
print
(
sd
.
query_devices
())
sd
.
play
(
sound
,
fs
,
device
=
1
,
blocking
=
True
)
sound2
=
np
.
sin
(
f
*
t
)
sd
.
play
(
sound2
,
fs
,
blocking
=
True
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment