-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
query_devices() name decoding problem (MME, DirectSound) #72
Comments
Can you please provide a screenshot of the output of Does the same error happen if you run the following in a terminal?
I don't have a Windows system myself, so you'll have to help me out a bit. |
>>>sounddevice.__version__
'0.3.6'
>>>sounddevice.get_portaudio_version()
(1246720, u'PortAudio V19.6.0-devel, revision 396fe4b6699ae929d3a685b3ef8a7e97396139a4') I cannot find a it at the moment, but I once saw a commit in the portaudio sources that switched the device name encoding to UTF8 also for WMME and DSOUND. |
Would it make sense to |
No, decoding UTF8 encoded data with MBCS does not raise an exception if MBCS is e.g. >>> u"Gerät".encode('utf8').decode('mbcs')
u'Ger\xc3\xa4t'
>>> u"Gerät".encode('mbcs').decode('utf8')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\encodings\utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xe4 in position 3: unexpected end of data |
I have found a discussion about devicenames in portaudio (ticket #224). The change to convert them to UTF-8 was made at 2014-04-11, but only applies if the portaudio library is compiled with _UNICODE or UNICODE defined. |
@mgeier I tried what @raecke did with some Japanese characters. I can make it fail both ways. I think it really depends whether the encoded bit pattern happens to be a legal pattern in another encoding. Example 1: Failed both ways.
Example 2. With lucky string, I can do utf-8 to mbcs without exception although the decoded
|
@taktot Thanks for testing, that's good news! We only have a problem if I made a PR that relies on this behavior: #73. @raecke Thanks for finding the relevant PortAudio changes! Do we know (from inside of the |
What are the Gohlke DLLSs? I know the website with all the WHL files, but where are portaudio DLLS? |
@raecke AFAIK the DLLs are not individually available for download, but you can simply unzip the WHL files to get at the respective DLLs. |
The portaudio_x86.dll found in sounddevice-0.3.6-cp27-cp27m-win32.whl is compiled with UNICODE. The bundled DLL is not compild with UNICODE. I think there is no officially way to check if the DLL was compiled with UNICODE. |
The branch |
The "try-first-utf8-then-mbcs" branch works fine also in my environment (Win10, 64bit, Python3.5). |
I am not sure if you should use UNICODE for the bundled DLLs.
|
@raecke Thanks for the information! I'll keep the DLLs unchanged for now. |
query_devices() crashes:
Changing the
"mbcs"
at line 710 to"utf-8"
fixed the problem in my environment.OS: Windows 7 SP1 and Windows 10 (Japanese)
Python 3.5
sounddevice
ver 0.3.6 (wheel from http://www.lfd.uci.edu/~gohlke/pythonlibs/)The text was updated successfully, but these errors were encountered: