pvkoala 1.0.0__tar.gz → 2.0.0__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {pvkoala-1.0.0 → pvkoala-2.0.0}/MANIFEST.in +1 -1
- {pvkoala-1.0.0 → pvkoala-2.0.0}/PKG-INFO +1 -1
- {pvkoala-1.0.0 → pvkoala-2.0.0}/pvkoala/_koala.py +67 -6
- {pvkoala-1.0.0 → pvkoala-2.0.0}/pvkoala/_util.py +6 -4
- pvkoala-2.0.0/pvkoala/lib/common/koala_params.pv +0 -0
- pvkoala-2.0.0/pvkoala/lib/jetson/cortex-a57-aarch64/libpv_koala.so +0 -0
- pvkoala-2.0.0/pvkoala/lib/linux/x86_64/libpv_koala.so +0 -0
- {pvkoala-1.0.0 → pvkoala-2.0.0}/pvkoala/lib/mac/arm64/libpv_koala.dylib +0 -0
- {pvkoala-1.0.0 → pvkoala-2.0.0}/pvkoala/lib/mac/x86_64/libpv_koala.dylib +0 -0
- pvkoala-2.0.0/pvkoala/lib/raspberry-pi/cortex-a53/libpv_koala.so +0 -0
- pvkoala-2.0.0/pvkoala/lib/raspberry-pi/cortex-a53-aarch64/libpv_koala.so +0 -0
- pvkoala-2.0.0/pvkoala/lib/raspberry-pi/cortex-a72/libpv_koala.so +0 -0
- pvkoala-2.0.0/pvkoala/lib/raspberry-pi/cortex-a72-aarch64/libpv_koala.so +0 -0
- pvkoala-2.0.0/pvkoala/lib/windows/amd64/libpv_koala.dll +0 -0
- {pvkoala-1.0.0 → pvkoala-2.0.0}/pvkoala.egg-info/PKG-INFO +1 -1
- {pvkoala-1.0.0 → pvkoala-2.0.0}/setup.py +2 -2
- pvkoala-1.0.0/pvkoala/lib/common/koala_params.pv +0 -0
- pvkoala-1.0.0/pvkoala/lib/jetson/cortex-a57-aarch64/libpv_koala.so +0 -0
- pvkoala-1.0.0/pvkoala/lib/linux/x86_64/libpv_koala.so +0 -0
- pvkoala-1.0.0/pvkoala/lib/raspberry-pi/cortex-a53/libpv_koala.so +0 -0
- pvkoala-1.0.0/pvkoala/lib/raspberry-pi/cortex-a53-aarch64/libpv_koala.so +0 -0
- pvkoala-1.0.0/pvkoala/lib/raspberry-pi/cortex-a72/libpv_koala.so +0 -0
- pvkoala-1.0.0/pvkoala/lib/raspberry-pi/cortex-a72-aarch64/libpv_koala.so +0 -0
- pvkoala-1.0.0/pvkoala/lib/windows/amd64/libpv_koala.dll +0 -0
- {pvkoala-1.0.0 → pvkoala-2.0.0}/README.md +0 -0
- {pvkoala-1.0.0 → pvkoala-2.0.0}/pvkoala/LICENSE +0 -0
- {pvkoala-1.0.0 → pvkoala-2.0.0}/pvkoala/__init__.py +0 -0
- {pvkoala-1.0.0 → pvkoala-2.0.0}/pvkoala/_factory.py +0 -0
- {pvkoala-1.0.0 → pvkoala-2.0.0}/pvkoala.egg-info/SOURCES.txt +0 -0
- {pvkoala-1.0.0 → pvkoala-2.0.0}/pvkoala.egg-info/dependency_links.txt +0 -0
- {pvkoala-1.0.0 → pvkoala-2.0.0}/pvkoala.egg-info/top_level.txt +0 -0
- {pvkoala-1.0.0 → pvkoala-2.0.0}/setup.cfg +0 -0
@@ -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',
|
@@ -14,14 +14,16 @@ import platform
|
|
14
14
|
import subprocess
|
15
15
|
|
16
16
|
|
17
|
+
def _is_64bit():
|
18
|
+
return '64bit' in platform.architecture()[0]
|
19
|
+
|
20
|
+
|
17
21
|
def _linux_machine() -> str:
|
18
22
|
machine = platform.machine()
|
19
23
|
if machine == 'x86_64':
|
20
24
|
return machine
|
21
|
-
elif machine
|
22
|
-
arch_info = '-' + machine
|
23
|
-
elif machine == 'armv7l':
|
24
|
-
arch_info = ''
|
25
|
+
elif machine in ['aarch64', 'armv7l']:
|
26
|
+
arch_info = ('-' + machine) if _is_64bit() else ''
|
25
27
|
else:
|
26
28
|
raise NotImplementedError("Unsupported CPU architecture: `%s`" % machine)
|
27
29
|
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -32,7 +32,7 @@ for platform in INCLUDE_LIBS:
|
|
32
32
|
shutil.copytree(
|
33
33
|
os.path.join(os.path.dirname(__file__), '../../lib', platform),
|
34
34
|
os.path.join(package_folder, 'lib', platform))
|
35
|
-
manifest_in += "recursive-include pvkoala/lib
|
35
|
+
manifest_in += "recursive-include pvkoala/lib *\n"
|
36
36
|
|
37
37
|
with open(os.path.join(os.path.dirname(__file__), 'MANIFEST.in'), 'w') as f:
|
38
38
|
f.write(manifest_in)
|
@@ -42,7 +42,7 @@ with open(os.path.join(os.path.dirname(__file__), 'README.md'), 'r') as f:
|
|
42
42
|
|
43
43
|
setuptools.setup(
|
44
44
|
name="pvkoala",
|
45
|
-
version="
|
45
|
+
version="2.0.0",
|
46
46
|
author="Picovoice",
|
47
47
|
author_email="hello@picovoice.ai",
|
48
48
|
description="Koala Noise Suppression Engine.",
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|