Closed Dustin-Jiang closed 3 years ago
This might be an issue with your soundcard's name. What is the soundcard called on your machine?
Facing the exact solution, with the code below :
import soundcard as sc
import numpy
speakers = sc.all_speakers()
default_speaker = sc.default_speaker()
# mics = sc.all_microphones(include_loopback=True)
mics = sc.all_microphones()
default_mic = sc.default_microphone()
print(speakers)
print(default_speaker)
print(mics)
print(default_mic)
with the error :
Traceback (most recent call last):
File "c:\arduino_led\audio_led_wasapi.py", line 13, in <module>
print(speakers)
File "C:\Users\yeonwoo328\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\soundcard\mediafoundation.py", line 428, in __repr__
return '<Speaker {} ({} channels)>'.format(self.name,self.channels)
File "C:\Users\yeonwoo328\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\soundcard\mediafoundation.py", line 372, in name
devicename = ''.join(chr(c) for c in data[0:idx])
File "C:\Users\yeonwoo328\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\soundcard\mediafoundation.py", line 372, in <genexpr>
devicename = ''.join(chr(c) for c in data[0:idx])
ValueError: chr() arg not in range(0x110000)
The same error comes out whatever I try to print between speakers, default_speaker, mics, and default_mic. Is it can be something related to the language I'm using?
self solution :
It was due to language setting. Checked the "data" in mediafoundation.py/ _Device class / name function and overflow was occuring. I temporarily solved it by simply dropping the overflown values, which are under 0 I believe.
Should be fixed in #120. Sorry about that.
When I installed SoundCard and ran the example code on Windows Server via remote desktop, there was an error,
I don't know what was wrong so could you please tell me how to deal with it? The server environment is
Thanks a lot