Skip to content

Commit 8b4698c

Browse files
authored
Allows selection of device ID 0 (#9)
1 parent 07704b3 commit 8b4698c

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

edge_impulse_linux/audio.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,15 @@ def __init__(self, rate, chunk_size, device_id = None, channels = 1):
2222
self.device_id = device_id
2323
self.zero_counter = 0
2424

25-
while not self.device_id or not self.checkDeviceModelCompatibility(self.device_id):
25+
while self.device_id == None or not self.checkDeviceModelCompatibility(self.device_id):
2626
input_devices = self.listAvailableDevices()
2727
input_device_id = int(input("Type the id of the audio device you want to use: \n"))
2828
for device in input_devices:
2929
if device[0] == input_device_id:
3030
if self.checkDeviceModelCompatibility(input_device_id):
3131
self.device_id = input_device_id
32+
else:
33+
print('That device is not compatible')
3234

3335
print('selected Audio device: %i'% self.device_id)
3436

0 commit comments

Comments
 (0)