diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..4ccbd18 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "python.pythonPath": "/home/oyvind/miniconda3/bin/python" +} \ No newline at end of file diff --git a/assignments/01/assignment 1.pdf b/assignments/01/assignment 1.pdf new file mode 100644 index 0000000..81298d8 Binary files /dev/null and b/assignments/01/assignment 1.pdf differ diff --git a/assignments/01/samplingFreq.py b/assignments/01/samplingFreq.py new file mode 100644 index 0000000..6a9dc96 --- /dev/null +++ b/assignments/01/samplingFreq.py @@ -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() \ No newline at end of file diff --git a/assignments/01/solution 1.pdf b/assignments/01/solution 1.pdf new file mode 100644 index 0000000..f0f71c9 Binary files /dev/null and b/assignments/01/solution 1.pdf differ diff --git a/assignments/solutions/Solution 11.pdf b/assignments/solutions/Solution 11.pdf new file mode 100644 index 0000000..be69846 Binary files /dev/null and b/assignments/solutions/Solution 11.pdf differ diff --git a/assignments/solutions/solution 10.pdf b/assignments/solutions/solution 10.pdf new file mode 100644 index 0000000..55b5314 Binary files /dev/null and b/assignments/solutions/solution 10.pdf differ diff --git a/assignments/solutions/solution 2.pdf b/assignments/solutions/solution 2.pdf new file mode 100644 index 0000000..f99d983 Binary files /dev/null and b/assignments/solutions/solution 2.pdf differ diff --git a/assignments/solutions/solution 3.pdf b/assignments/solutions/solution 3.pdf new file mode 100644 index 0000000..294d194 Binary files /dev/null and b/assignments/solutions/solution 3.pdf differ diff --git a/assignments/solutions/solution 4.pdf b/assignments/solutions/solution 4.pdf new file mode 100644 index 0000000..110f7c5 Binary files /dev/null and b/assignments/solutions/solution 4.pdf differ diff --git a/assignments/solutions/solution 5.pdf b/assignments/solutions/solution 5.pdf new file mode 100644 index 0000000..a6f7ad7 Binary files /dev/null and b/assignments/solutions/solution 5.pdf differ diff --git a/assignments/solutions/solution 6.pdf b/assignments/solutions/solution 6.pdf new file mode 100644 index 0000000..76cc04b Binary files /dev/null and b/assignments/solutions/solution 6.pdf differ diff --git a/assignments/solutions/solution 7.pdf b/assignments/solutions/solution 7.pdf new file mode 100644 index 0000000..76858b7 Binary files /dev/null and b/assignments/solutions/solution 7.pdf differ diff --git a/assignments/solutions/solution 8.pdf b/assignments/solutions/solution 8.pdf new file mode 100644 index 0000000..609e8e7 Binary files /dev/null and b/assignments/solutions/solution 8.pdf differ diff --git a/assignments/solutions/solution 9.pdf b/assignments/solutions/solution 9.pdf new file mode 100644 index 0000000..f0eb206 Binary files /dev/null and b/assignments/solutions/solution 9.pdf differ