简体   繁体   中英

MSYS - PyAudio Greek letters

MSYS PyAudio module:

counter = 1
for i in range (0,self.numdevices):
    if self.p.get_device_info_by_host_api_device_index(0,i).get('maxOutputChannels')>0:
        self.output_devices.append([counter,i,str(self.p.get_device_info_by_host_api_device_index(0,i).get('name'))])
        counter += 1

If greek letters are in path there aren't displayed correctly.

在此处输入图像描述

Code:

Χρήστος@Chris-pc MINGW64 /c/python/scripts/Papinhio player/src/main/python_files
$ python
Python 3.8.9 (default, Apr 13 2021, 15:54:59)  [GCC 10.2.0 64 bit (AMD64)] on wi
n32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyaudio
>>> p = pyaudio.PyAudio()
>>> info = p.get_host_api_info_by_index(0)
>>> numdevices = info.get('deviceCount')
>>> for i in range(0,numdevices):
...     print(p.get_device_info_by_host_api_device_index(0,i).get('name'))
...
Microsoft Sound Mapper - Input
Ìéêñüöùíï (FHD Webcam)
Microsoft Sound Mapper - Output
Ç÷åßá / ÁêïõóôéêÜ (Realtek High
>>> for i in range(0,numdevices):                                      '))
...     print(p.get_device_info_by_host_api_device_index(0,i))       )))))
...
{'index': 0, 'structVersion': 2, 'name': 'Microsoft Sound Mapper - Input', 'host
Api': 0, 'maxInputChannels': 2, 'maxOutputChannels': 0, 'defaultLowInputLatency'
: 0.09, 'defaultLowOutputLatency': 0.09, 'defaultHighInputLatency': 0.18, 'defau
ltHighOutputLatency': 0.18, 'defaultSampleRate': 44100.0}
{'index': 1, 'structVersion': 2, 'name': 'Ìéêñüöùíï (FHD Webcam)', 'hostApi': 0,
 'maxInputChannels': 2, 'maxOutputChannels': 0, 'defaultLowInputLatency': 0.09,
'defaultLowOutputLatency': 0.09, 'defaultHighInputLatency': 0.18, 'defaultHighOu
tputLatency': 0.18, 'defaultSampleRate': 44100.0}
{'index': 2, 'structVersion': 2, 'name': 'Microsoft Sound Mapper - Output', 'hos
tApi': 0, 'maxInputChannels': 0, 'maxOutputChannels': 2, 'defaultLowInputLatency
': 0.09, 'defaultLowOutputLatency': 0.09, 'defaultHighInputLatency': 0.18, 'defa
ultHighOutputLatency': 0.18, 'defaultSampleRate': 44100.0}
{'index': 3, 'structVersion': 2, 'name': 'Ç÷åßá / ÁêïõóôéêÜ (Realtek High', 'hos
tApi': 0, 'maxInputChannels': 0, 'maxOutputChannels': 2, 'defaultLowInputLatency
': 0.09, 'defaultLowOutputLatency': 0.09, 'defaultHighInputLatency': 0.18, 'defa
ultHighOutputLatency': 0.18, 'defaultSampleRate': 44100.0}

I change line 994 of C:\msys64\mingw64\lib\python3.8\site-packages\PyAudio-0.2.11-py3.8-mingw.egg\pyaudio.py

from

for codec in ["utf-8", "cp1252"]:

to be:

for codec in ["cp1253", "cp1252", "utf-8"]:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM