mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-06-28 01:52:06 +08:00
fix micd input device (#27160)
* try no device * unused * move sounddevice import old-commit-hash: feba2f3fe566114325f8c9119540fb19cf401a4a
This commit is contained in:
+4
-5
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
import sounddevice as sd
|
||||
import numpy as np
|
||||
|
||||
from cereal import messaging
|
||||
@@ -84,11 +83,11 @@ class Mic:
|
||||
|
||||
self.measurements = self.measurements[FFT_SAMPLES:]
|
||||
|
||||
def micd_thread(self, device=None):
|
||||
if device is None:
|
||||
device = "sysdefault"
|
||||
def micd_thread(self):
|
||||
# sounddevice must be imported after forking processes
|
||||
import sounddevice as sd # pylint: disable=import-outside-toplevel
|
||||
|
||||
with sd.InputStream(device=device, channels=1, samplerate=SAMPLE_RATE, callback=self.callback) as stream:
|
||||
with sd.InputStream(channels=1, samplerate=SAMPLE_RATE, callback=self.callback) as stream:
|
||||
cloudlog.info(f"micd stream started: {stream.samplerate=} {stream.channels=} {stream.dtype=} {stream.device=}")
|
||||
while True:
|
||||
self.update()
|
||||
|
||||
Reference in New Issue
Block a user