Upload of all solutions and assigment 1
This commit is contained in:
parent
bf91256310
commit
b5ae8eb7a5
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"python.pythonPath": "/home/oyvind/miniconda3/bin/python"
|
||||||
|
}
|
BIN
assignments/01/assignment 1.pdf
Normal file
BIN
assignments/01/assignment 1.pdf
Normal file
Binary file not shown.
33
assignments/01/samplingFreq.py
Normal file
33
assignments/01/samplingFreq.py
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
import numpy as np
|
||||||
|
import sounddevice as sd
|
||||||
|
|
||||||
|
# Physical freq to "sample", must be integer
|
||||||
|
F_1 = 1000
|
||||||
|
# Volume must be between 0 and 100, may be float
|
||||||
|
volume = 20
|
||||||
|
# Sampling freq, must be integer
|
||||||
|
F_s = 6000
|
||||||
|
# Time how long a sample should last, must be integer
|
||||||
|
duration = 4
|
||||||
|
|
||||||
|
# Calculation of constants
|
||||||
|
volume = volume / 100
|
||||||
|
totalSamples = F_s * duration
|
||||||
|
|
||||||
|
# Comment out the last decleration if you want to use a fixed f1
|
||||||
|
f_1 = 0.3
|
||||||
|
#f_1 = F_1 / F_s
|
||||||
|
|
||||||
|
def GenSound(f1, noSamples, vol):
|
||||||
|
x = np.empty(noSamples)
|
||||||
|
for n in range(noSamples):
|
||||||
|
x[n] = np.cos(2*np.pi * f1 * n) * vol
|
||||||
|
return x
|
||||||
|
|
||||||
|
x = GenSound(f_1, totalSamples, volume)
|
||||||
|
|
||||||
|
print(x)
|
||||||
|
|
||||||
|
sd.play(x, F_s)
|
||||||
|
sd.wait()
|
||||||
|
sd.stop()
|
BIN
assignments/01/solution 1.pdf
Normal file
BIN
assignments/01/solution 1.pdf
Normal file
Binary file not shown.
BIN
assignments/solutions/Solution 11.pdf
Normal file
BIN
assignments/solutions/Solution 11.pdf
Normal file
Binary file not shown.
BIN
assignments/solutions/solution 10.pdf
Normal file
BIN
assignments/solutions/solution 10.pdf
Normal file
Binary file not shown.
BIN
assignments/solutions/solution 2.pdf
Normal file
BIN
assignments/solutions/solution 2.pdf
Normal file
Binary file not shown.
BIN
assignments/solutions/solution 3.pdf
Normal file
BIN
assignments/solutions/solution 3.pdf
Normal file
Binary file not shown.
BIN
assignments/solutions/solution 4.pdf
Normal file
BIN
assignments/solutions/solution 4.pdf
Normal file
Binary file not shown.
BIN
assignments/solutions/solution 5.pdf
Normal file
BIN
assignments/solutions/solution 5.pdf
Normal file
Binary file not shown.
BIN
assignments/solutions/solution 6.pdf
Normal file
BIN
assignments/solutions/solution 6.pdf
Normal file
Binary file not shown.
BIN
assignments/solutions/solution 7.pdf
Normal file
BIN
assignments/solutions/solution 7.pdf
Normal file
Binary file not shown.
BIN
assignments/solutions/solution 8.pdf
Normal file
BIN
assignments/solutions/solution 8.pdf
Normal file
Binary file not shown.
BIN
assignments/solutions/solution 9.pdf
Normal file
BIN
assignments/solutions/solution 9.pdf
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user