pvkoala 1.0.1__py3-none-any.whl → 2.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pvkoala/_koala.py +67 -6
- pvkoala/lib/common/koala_params.pv +0 -0
- pvkoala/lib/jetson/cortex-a57-aarch64/libpv_koala.so +0 -0
- pvkoala/lib/linux/x86_64/libpv_koala.so +0 -0
- pvkoala/lib/mac/arm64/libpv_koala.dylib +0 -0
- pvkoala/lib/mac/x86_64/libpv_koala.dylib +0 -0
- pvkoala/lib/raspberry-pi/cortex-a53/libpv_koala.so +0 -0
- pvkoala/lib/raspberry-pi/cortex-a53-aarch64/libpv_koala.so +0 -0
- pvkoala/lib/raspberry-pi/cortex-a72/libpv_koala.so +0 -0
- pvkoala/lib/raspberry-pi/cortex-a72-aarch64/libpv_koala.so +0 -0
- pvkoala/lib/windows/amd64/libpv_koala.dll +0 -0
- {pvkoala-1.0.1.dist-info → pvkoala-2.0.0.dist-info}/METADATA +1 -1
- pvkoala-2.0.0.dist-info/RECORD +19 -0
- {pvkoala-1.0.1.dist-info → pvkoala-2.0.0.dist-info}/WHEEL +1 -1
- pvkoala-1.0.1.dist-info/RECORD +0 -19
- {pvkoala-1.0.1.dist-info → pvkoala-2.0.0.dist-info}/top_level.txt +0 -0
    
        pvkoala/_koala.py
    CHANGED
    
    | @@ -16,7 +16,27 @@ from typing import Sequence | |
| 16 16 |  | 
| 17 17 |  | 
| 18 18 | 
             
            class KoalaError(Exception):
         | 
| 19 | 
            -
                 | 
| 19 | 
            +
                def __init__(self, message: str = '', message_stack: Sequence[str] = None):
         | 
| 20 | 
            +
                    super().__init__(message)
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                    self._message = message
         | 
| 23 | 
            +
                    self._message_stack = list() if message_stack is None else message_stack
         | 
| 24 | 
            +
             | 
| 25 | 
            +
                def __str__(self):
         | 
| 26 | 
            +
                    message = self._message
         | 
| 27 | 
            +
                    if len(self._message_stack) > 0:
         | 
| 28 | 
            +
                        message += ':'
         | 
| 29 | 
            +
                        for i in range(len(self._message_stack)):
         | 
| 30 | 
            +
                            message += '\n  [%d] %s' % (i, self._message_stack[i])
         | 
| 31 | 
            +
                    return message
         | 
| 32 | 
            +
             | 
| 33 | 
            +
                @property
         | 
| 34 | 
            +
                def message(self) -> str:
         | 
| 35 | 
            +
                    return self._message
         | 
| 36 | 
            +
             | 
| 37 | 
            +
                @property
         | 
| 38 | 
            +
                def message_stack(self) -> Sequence[str]:
         | 
| 39 | 
            +
                    return self._message_stack
         | 
| 20 40 |  | 
| 21 41 |  | 
| 22 42 | 
             
            class KoalaMemoryError(KoalaError):
         | 
| @@ -123,15 +143,34 @@ class Koala(object): | |
| 123 143 |  | 
| 124 144 | 
             
                    library = cdll.LoadLibrary(library_path)
         | 
| 125 145 |  | 
| 146 | 
            +
                    set_sdk_func = library.pv_set_sdk
         | 
| 147 | 
            +
                    set_sdk_func.argtypes = [c_char_p]
         | 
| 148 | 
            +
                    set_sdk_func.restype = None
         | 
| 149 | 
            +
             | 
| 150 | 
            +
                    set_sdk_func('python'.encode('utf-8'))
         | 
| 151 | 
            +
             | 
| 152 | 
            +
                    self._get_error_stack_func = library.pv_get_error_stack
         | 
| 153 | 
            +
                    self._get_error_stack_func.argtypes = [POINTER(POINTER(c_char_p)), POINTER(c_int)]
         | 
| 154 | 
            +
                    self._get_error_stack_func.restype = self.PicovoiceStatuses
         | 
| 155 | 
            +
             | 
| 156 | 
            +
                    self._free_error_stack_func = library.pv_free_error_stack
         | 
| 157 | 
            +
                    self._free_error_stack_func.argtypes = [POINTER(c_char_p)]
         | 
| 158 | 
            +
                    self._free_error_stack_func.restype = None
         | 
| 159 | 
            +
             | 
| 126 160 | 
             
                    init_func = library.pv_koala_init
         | 
| 127 161 | 
             
                    init_func.argtypes = [c_char_p, c_char_p, POINTER(POINTER(self.CKoala))]
         | 
| 128 162 | 
             
                    init_func.restype = self.PicovoiceStatuses
         | 
| 129 163 |  | 
| 130 164 | 
             
                    self._handle = POINTER(self.CKoala)()
         | 
| 131 165 |  | 
| 132 | 
            -
                    status = init_func( | 
| 166 | 
            +
                    status = init_func(
         | 
| 167 | 
            +
                        access_key.encode(),
         | 
| 168 | 
            +
                        model_path.encode(),
         | 
| 169 | 
            +
                        byref(self._handle))
         | 
| 133 170 | 
             
                    if status is not self.PicovoiceStatuses.SUCCESS:
         | 
| 134 | 
            -
                        raise self._PICOVOICE_STATUS_TO_EXCEPTION[status]( | 
| 171 | 
            +
                        raise self._PICOVOICE_STATUS_TO_EXCEPTION[status](
         | 
| 172 | 
            +
                            message='Initialization failed',
         | 
| 173 | 
            +
                            message_stack=self._get_error_stack())
         | 
| 135 174 |  | 
| 136 175 | 
             
                    self._delete_func = library.pv_koala_delete
         | 
| 137 176 | 
             
                    self._delete_func.argtypes = [POINTER(self.CKoala)]
         | 
| @@ -144,7 +183,10 @@ class Koala(object): | |
| 144 183 | 
             
                    status = delay_sample_func(self._handle, delay_sample)
         | 
| 145 184 | 
             
                    if status is not self.PicovoiceStatuses.SUCCESS:
         | 
| 146 185 | 
             
                        self.delete()
         | 
| 147 | 
            -
                        raise self._PICOVOICE_STATUS_TO_EXCEPTION[status]( | 
| 186 | 
            +
                        raise self._PICOVOICE_STATUS_TO_EXCEPTION[status](
         | 
| 187 | 
            +
                            message='Failed to get delay samples',
         | 
| 188 | 
            +
                            message_stack=self._get_error_stack())
         | 
| 189 | 
            +
             | 
| 148 190 | 
             
                    self._delay_sample = delay_sample.value
         | 
| 149 191 |  | 
| 150 192 | 
             
                    self._process_func = library.pv_koala_process
         | 
| @@ -193,7 +235,9 @@ class Koala(object): | |
| 193 235 |  | 
| 194 236 | 
             
                    status = self._process_func(self._handle, pcm, enhanced_pcm)
         | 
| 195 237 | 
             
                    if status is not self.PicovoiceStatuses.SUCCESS:
         | 
| 196 | 
            -
                        raise self._PICOVOICE_STATUS_TO_EXCEPTION[status]( | 
| 238 | 
            +
                        raise self._PICOVOICE_STATUS_TO_EXCEPTION[status](
         | 
| 239 | 
            +
                            message='Processing failed',
         | 
| 240 | 
            +
                            message_stack=self._get_error_stack())
         | 
| 197 241 |  | 
| 198 242 | 
             
                    # noinspection PyTypeChecker
         | 
| 199 243 | 
             
                    return list(enhanced_pcm)
         | 
| @@ -206,7 +250,9 @@ class Koala(object): | |
| 206 250 |  | 
| 207 251 | 
             
                    status = self._reset_func(self._handle)
         | 
| 208 252 | 
             
                    if status is not self.PicovoiceStatuses.SUCCESS:
         | 
| 209 | 
            -
                        raise self._PICOVOICE_STATUS_TO_EXCEPTION[status]( | 
| 253 | 
            +
                        raise self._PICOVOICE_STATUS_TO_EXCEPTION[status](
         | 
| 254 | 
            +
                            message='Reset failed',
         | 
| 255 | 
            +
                            message_stack=self._get_error_stack())
         | 
| 210 256 |  | 
| 211 257 | 
             
                def delete(self) -> None:
         | 
| 212 258 | 
             
                    """Releases resources acquired by Koala."""
         | 
| @@ -239,6 +285,21 @@ class Koala(object): | |
| 239 285 |  | 
| 240 286 | 
             
                    return self._version
         | 
| 241 287 |  | 
| 288 | 
            +
                def _get_error_stack(self) -> Sequence[str]:
         | 
| 289 | 
            +
                    message_stack_ref = POINTER(c_char_p)()
         | 
| 290 | 
            +
                    message_stack_depth = c_int()
         | 
| 291 | 
            +
                    status = self._get_error_stack_func(byref(message_stack_ref), byref(message_stack_depth))
         | 
| 292 | 
            +
                    if status is not self.PicovoiceStatuses.SUCCESS:
         | 
| 293 | 
            +
                        raise self._PICOVOICE_STATUS_TO_EXCEPTION[status](message='Unable to get Koala error state')
         | 
| 294 | 
            +
             | 
| 295 | 
            +
                    message_stack = list()
         | 
| 296 | 
            +
                    for i in range(message_stack_depth.value):
         | 
| 297 | 
            +
                        message_stack.append(message_stack_ref[i].decode('utf-8'))
         | 
| 298 | 
            +
             | 
| 299 | 
            +
                    self._free_error_stack_func(message_stack_ref)
         | 
| 300 | 
            +
             | 
| 301 | 
            +
                    return message_stack
         | 
| 302 | 
            +
             | 
| 242 303 |  | 
| 243 304 | 
             
            __all__ = [
         | 
| 244 305 | 
             
                'Koala',
         | 
| Binary file | 
| Binary file | 
| Binary file | 
| Binary file | 
| Binary file | 
| Binary file | 
| Binary file | 
| Binary file | 
| Binary file | 
| Binary file | 
| @@ -0,0 +1,19 @@ | |
| 1 | 
            +
            pvkoala/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
         | 
| 2 | 
            +
            pvkoala/__init__.py,sha256=46DQVzd7KMWWHnksLGV0vT6VPuZQe9Ivvdf2VQjLRhY,570
         | 
| 3 | 
            +
            pvkoala/_factory.py,sha256=iZqM5lgr130Z_BjDgSi3maA-4dGO4J9abwUlNsX84Vo,1458
         | 
| 4 | 
            +
            pvkoala/_koala.py,sha256=2NwR_XwjcllPA8FHTE4Q-ofp3X78YaCBGuEZNiafPdo,10689
         | 
| 5 | 
            +
            pvkoala/_util.py,sha256=wU3RwME0llwlBkMCmVRmfKHGsrQJrGZwxbtxkfvjSCo,3135
         | 
| 6 | 
            +
            pvkoala/lib/common/koala_params.pv,sha256=A_92Jxj36MvGe3oboq70wFubecCELhAkNZvTEJk6vfQ,4007743
         | 
| 7 | 
            +
            pvkoala/lib/jetson/cortex-a57-aarch64/libpv_koala.so,sha256=R6ylMuZDy3GNJTpI_i4S2qesQk1_3GulWnl3ZhhKuKg,142656
         | 
| 8 | 
            +
            pvkoala/lib/linux/x86_64/libpv_koala.so,sha256=9sE-zswQZEt6i2S1kFYgc9ypkWTFFTpWN6xkjJ7XMAk,163504
         | 
| 9 | 
            +
            pvkoala/lib/mac/arm64/libpv_koala.dylib,sha256=5bswF2_yIr4dA6z9Ff8IIyQnVBFwX8eBD3Ioon2_VvU,203502
         | 
| 10 | 
            +
            pvkoala/lib/mac/x86_64/libpv_koala.dylib,sha256=rg65W2omZecWDu6uFOe-iOyrCsMiGjOwNINBNAAFGAE,218256
         | 
| 11 | 
            +
            pvkoala/lib/raspberry-pi/cortex-a53/libpv_koala.so,sha256=5IwELivbaznf4mn-uGO9FUJUkx3Kwn_s3avPLa46Vz8,129188
         | 
| 12 | 
            +
            pvkoala/lib/raspberry-pi/cortex-a53-aarch64/libpv_koala.so,sha256=7PyFuqYL1XcvumWb0VDYzjLSUtrb2RlM0fcXXdrxrKw,142656
         | 
| 13 | 
            +
            pvkoala/lib/raspberry-pi/cortex-a72/libpv_koala.so,sha256=0HpQr4t6IXiu_o-GS3mV5QczmgvrdYEVZ8zUM0bp-kA,133284
         | 
| 14 | 
            +
            pvkoala/lib/raspberry-pi/cortex-a72-aarch64/libpv_koala.so,sha256=LjFS24G2TIaJtcpZoELC5-tvaw7QAAdOyM2UZJMHZrY,142656
         | 
| 15 | 
            +
            pvkoala/lib/windows/amd64/libpv_koala.dll,sha256=h586bu40qiAw2FG06e9Eg1EX4cBZvS2jHodwvaEsNkI,282112
         | 
| 16 | 
            +
            pvkoala-2.0.0.dist-info/METADATA,sha256=cHRGEixxK3jMCC41V3TIxueiHx729hB8-6Mu9vDC3pU,2785
         | 
| 17 | 
            +
            pvkoala-2.0.0.dist-info/WHEEL,sha256=g4nMs7d-Xl9-xC9XovUrsDHGXt-FT0E17Yqo92DEfvY,92
         | 
| 18 | 
            +
            pvkoala-2.0.0.dist-info/top_level.txt,sha256=Gb-hF6eAZIh7Bm1LfLuwsCQ_0y7FWSIuYSQX0p3T6No,8
         | 
| 19 | 
            +
            pvkoala-2.0.0.dist-info/RECORD,,
         | 
    
        pvkoala-1.0.1.dist-info/RECORD
    DELETED
    
    | @@ -1,19 +0,0 @@ | |
| 1 | 
            -
            pvkoala/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
         | 
| 2 | 
            -
            pvkoala/__init__.py,sha256=46DQVzd7KMWWHnksLGV0vT6VPuZQe9Ivvdf2VQjLRhY,570
         | 
| 3 | 
            -
            pvkoala/_factory.py,sha256=iZqM5lgr130Z_BjDgSi3maA-4dGO4J9abwUlNsX84Vo,1458
         | 
| 4 | 
            -
            pvkoala/_koala.py,sha256=KWZlVNRFV0nmrNy2KaNOZU6uMZlXVHFxheEVgpVHsBo,8370
         | 
| 5 | 
            -
            pvkoala/_util.py,sha256=wU3RwME0llwlBkMCmVRmfKHGsrQJrGZwxbtxkfvjSCo,3135
         | 
| 6 | 
            -
            pvkoala/lib/common/koala_params.pv,sha256=3lDAuNhemokD-BmhHS1jJzvb3x3F_7u0AA_msQGc61o,4007735
         | 
| 7 | 
            -
            pvkoala/lib/jetson/cortex-a57-aarch64/libpv_koala.so,sha256=O84bKNt2ccsaWcfKmwekTYw7uUG0eUdVu5SNku5l6Kg,133600
         | 
| 8 | 
            -
            pvkoala/lib/linux/x86_64/libpv_koala.so,sha256=ZK--RIMsHSv_AUEC6KiuuLJW4EpVT4klk9d5Yr-YAqg,150352
         | 
| 9 | 
            -
            pvkoala/lib/mac/arm64/libpv_koala.dylib,sha256=xor3S9k-rgk85h03je-mhAo_ZEn4lPnDCl-uK70CFxU,203166
         | 
| 10 | 
            -
            pvkoala/lib/mac/x86_64/libpv_koala.dylib,sha256=tbfpxLQnxT4vLOLu2tkQNa2FoKjmLmlSa4uzwl29mrs,217912
         | 
| 11 | 
            -
            pvkoala/lib/raspberry-pi/cortex-a53/libpv_koala.so,sha256=QTVgoqL49iOSDXycT_nAOc7On-txbXcztlFX4tFwi8Y,120620
         | 
| 12 | 
            -
            pvkoala/lib/raspberry-pi/cortex-a53-aarch64/libpv_koala.so,sha256=WTRuKpSNUsm6so1FaQUwP_boTE2Xs_n-VGQGrSj_W4U,133688
         | 
| 13 | 
            -
            pvkoala/lib/raspberry-pi/cortex-a72/libpv_koala.so,sha256=fQe4_Td1tWfC5GVvqY-5sk0s7sFmYH1G41WaupHyoGI,124716
         | 
| 14 | 
            -
            pvkoala/lib/raspberry-pi/cortex-a72-aarch64/libpv_koala.so,sha256=7Udm5LN-kqD9ICs20AveKw81ZFE6RuD3mmH6UzfZIDA,133688
         | 
| 15 | 
            -
            pvkoala/lib/windows/amd64/libpv_koala.dll,sha256=uWdtDcuYFpUe-0w2OHy8RRfQwrd0IKHpMGXZk2XFGs0,303104
         | 
| 16 | 
            -
            pvkoala-1.0.1.dist-info/METADATA,sha256=WXc6hhx1_yxkiL2AGcaUzd2zLCGrVHWy0gkxF6cGh6E,2785
         | 
| 17 | 
            -
            pvkoala-1.0.1.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
         | 
| 18 | 
            -
            pvkoala-1.0.1.dist-info/top_level.txt,sha256=Gb-hF6eAZIh7Bm1LfLuwsCQ_0y7FWSIuYSQX0p3T6No,8
         | 
| 19 | 
            -
            pvkoala-1.0.1.dist-info/RECORD,,
         | 
| 
            File without changes
         |