Spaces:
Sleeping
Sleeping
Yann Bouteiller
commited on
Commit
·
5c3b17f
1
Parent(s):
da5fc70
small modifs + fixed boot files for sound
Browse files- boot/boot.scr +0 -0
- boot/linux-image-4.14.98-imx_12-4_arm64.deb +2 -2
- boot/portiloop.dtbo +0 -0
- boot/portiloop.dts +10 -8
- portiloop/capture.py +12 -7
- portiloop/notebooks/tests.ipynb +15 -2
boot/boot.scr
ADDED
Binary file (2.12 kB). View file
|
|
boot/linux-image-4.14.98-imx_12-4_arm64.deb
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:573a0f42c1f5aafd34c588369f35abc225be73fd7c79ac8f45a757b260d606dc
|
3 |
+
size 11096552
|
boot/portiloop.dtbo
ADDED
Binary file (3.12 kB). View file
|
|
boot/portiloop.dts
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
/dts-v1/;
|
2 |
/plugin/;
|
3 |
|
4 |
-
///include/ "fsl-imx8mq-phanbell.
|
5 |
|
6 |
/ {
|
7 |
compatible = "fsl,imx8mq-phanbell", "fsl,imx8mq";
|
@@ -78,13 +78,15 @@
|
|
78 |
#sound-dai-cells = <0>;
|
79 |
compatible = "fsl,sgtl5000";
|
80 |
reg = <0x0a>;
|
81 |
-
|
82 |
-
clocks = <&clk
|
83 |
-
assigned-
|
84 |
-
assigned-clock-parents = <&clk IMX8MQ_AUDIO_PLL1_OUT>;
|
85 |
assigned-clock-rates = <24576000>;
|
86 |
|
87 |
status = "okay";
|
|
|
|
|
|
|
88 |
};
|
89 |
};
|
90 |
};
|
@@ -106,8 +108,8 @@
|
|
106 |
simple-audio-card,name = "sgtl5000";
|
107 |
simple-audio-card,format = "i2s";
|
108 |
simple-audio-card,widgets = "Headphone", "Headphones";
|
109 |
-
simple-audio-card,routing = "Headphones", "
|
110 |
-
"Headphones", "
|
111 |
|
112 |
status = "okay";
|
113 |
|
@@ -117,7 +119,7 @@
|
|
117 |
|
118 |
audio_codec: simple-audio-card,codec {
|
119 |
sound-dai = <&sgtl5000>;
|
120 |
-
clocks = <&clk
|
121 |
frame-master;
|
122 |
bitclock-master;
|
123 |
};
|
|
|
1 |
/dts-v1/;
|
2 |
/plugin/;
|
3 |
|
4 |
+
///include/ "fsl-imx8mq-phanbell.dts";
|
5 |
|
6 |
/ {
|
7 |
compatible = "fsl,imx8mq-phanbell", "fsl,imx8mq";
|
|
|
78 |
#sound-dai-cells = <0>;
|
79 |
compatible = "fsl,sgtl5000";
|
80 |
reg = <0x0a>;
|
81 |
+
clocks = <&clk 211>;
|
82 |
+
assigned-clocks = <&clk 129>;
|
83 |
+
assigned-clock-parents = <&clk 27>;
|
|
|
84 |
assigned-clock-rates = <24576000>;
|
85 |
|
86 |
status = "okay";
|
87 |
+
|
88 |
+
VDDA-supply = <®_apex>;
|
89 |
+
VDDIO-supply = <®_apex>;
|
90 |
};
|
91 |
};
|
92 |
};
|
|
|
108 |
simple-audio-card,name = "sgtl5000";
|
109 |
simple-audio-card,format = "i2s";
|
110 |
simple-audio-card,widgets = "Headphone", "Headphones";
|
111 |
+
simple-audio-card,routing = "Headphones", "HP_OUT",
|
112 |
+
"Headphones", "HP_OUT";
|
113 |
|
114 |
status = "okay";
|
115 |
|
|
|
119 |
|
120 |
audio_codec: simple-audio-card,codec {
|
121 |
sound-dai = <&sgtl5000>;
|
122 |
+
clocks = <&clk 211>;
|
123 |
frame-master;
|
124 |
bitclock-master;
|
125 |
};
|
portiloop/capture.py
CHANGED
@@ -445,15 +445,20 @@ class Capture:
|
|
445 |
self._test_stimulus_lock = Lock()
|
446 |
self._test_stimulus = False
|
447 |
|
448 |
-
|
449 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
450 |
warnings.warn(f"No ALSA mixer found.")
|
451 |
self.mixer = DummyAlsaMixer()
|
452 |
-
|
453 |
-
self.mixer = alsaaudio.Mixer(control='PCM')
|
454 |
-
else:
|
455 |
-
warnings.warn(f"Could not find mixer PCM, using {mixers[0]} instead.")
|
456 |
-
self.mixer = alsaaudio.Mixer(control=mixers[0])
|
457 |
self.volume = self.mixer.getvolume()[0] # we will set the same volume on all channels
|
458 |
|
459 |
|
|
|
445 |
self._test_stimulus_lock = Lock()
|
446 |
self._test_stimulus = False
|
447 |
|
448 |
+
try:
|
449 |
+
mixers = alsaaudio.mixers()
|
450 |
+
if len(mixers) <= 0:
|
451 |
+
warnings.warn(f"No ALSA mixer found.")
|
452 |
+
self.mixer = DummyAlsaMixer()
|
453 |
+
elif 'PCM' in mixers:
|
454 |
+
self.mixer = alsaaudio.Mixer(control='PCM')
|
455 |
+
else:
|
456 |
+
warnings.warn(f"Could not find mixer PCM, using {mixers[0]} instead.")
|
457 |
+
self.mixer = alsaaudio.Mixer(control=mixers[0])
|
458 |
+
except ALSAAudioError as e:
|
459 |
warnings.warn(f"No ALSA mixer found.")
|
460 |
self.mixer = DummyAlsaMixer()
|
461 |
+
|
|
|
|
|
|
|
|
|
462 |
self.volume = self.mixer.getvolume()[0] # we will set the same volume on all channels
|
463 |
|
464 |
|
portiloop/notebooks/tests.ipynb
CHANGED
@@ -2,12 +2,25 @@
|
|
2 |
"cells": [
|
3 |
{
|
4 |
"cell_type": "code",
|
5 |
-
"execution_count":
|
6 |
"id": "16651843",
|
7 |
"metadata": {
|
8 |
"scrolled": false
|
9 |
},
|
10 |
-
"outputs": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
"source": [
|
12 |
"from portiloop.capture import Capture\n",
|
13 |
"from portiloop.detection import SleepSpindleRealTimeDetector\n",
|
|
|
2 |
"cells": [
|
3 |
{
|
4 |
"cell_type": "code",
|
5 |
+
"execution_count": 1,
|
6 |
"id": "16651843",
|
7 |
"metadata": {
|
8 |
"scrolled": false
|
9 |
},
|
10 |
+
"outputs": [
|
11 |
+
{
|
12 |
+
"ename": "ALSAAudioError",
|
13 |
+
"evalue": "No such file or directory [default]",
|
14 |
+
"output_type": "error",
|
15 |
+
"traceback": [
|
16 |
+
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
17 |
+
"\u001b[0;31mALSAAudioError\u001b[0m Traceback (most recent call last)",
|
18 |
+
"\u001b[0;32m<ipython-input-1-c2044ba37313>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 6\u001b[0m \u001b[0mmy_stimulator_class\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mSleepSpindleRealTimeStimulator\u001b[0m \u001b[0;31m# you may also want to implement yours\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 7\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 8\u001b[0;31m \u001b[0mcap\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mCapture\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdetector_cls\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mmy_detector_class\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstimulator_cls\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mmy_stimulator_class\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
|
19 |
+
"\u001b[0;32m~/portiloop-software/portiloop/capture.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, detector_cls, stimulator_cls)\u001b[0m\n\u001b[1;32m 446\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_test_stimulus\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mFalse\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 447\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 448\u001b[0;31m \u001b[0mmixers\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0malsaaudio\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmixers\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 449\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmixers\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m<=\u001b[0m \u001b[0;36m0\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 450\u001b[0m \u001b[0mwarnings\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mwarn\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34mf\"No ALSA mixer found.\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
|
20 |
+
"\u001b[0;31mALSAAudioError\u001b[0m: No such file or directory [default]"
|
21 |
+
]
|
22 |
+
}
|
23 |
+
],
|
24 |
"source": [
|
25 |
"from portiloop.capture import Capture\n",
|
26 |
"from portiloop.detection import SleepSpindleRealTimeDetector\n",
|