pveagle 0.1.0__py3-none-any.whl → 0.2.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.
- pveagle/_eagle.py +106 -10
- pveagle/lib/common/eagle_params.pv +0 -0
- pveagle/lib/jetson/cortex-a57-aarch64/libpv_eagle.so +0 -0
- pveagle/lib/linux/x86_64/libpv_eagle.so +0 -0
- pveagle/lib/mac/arm64/libpv_eagle.dylib +0 -0
- pveagle/lib/mac/x86_64/libpv_eagle.dylib +0 -0
- pveagle/lib/raspberry-pi/cortex-a53/libpv_eagle.so +0 -0
- pveagle/lib/raspberry-pi/cortex-a53-aarch64/libpv_eagle.so +0 -0
- pveagle/lib/raspberry-pi/cortex-a72/libpv_eagle.so +0 -0
- pveagle/lib/raspberry-pi/cortex-a72-aarch64/libpv_eagle.so +0 -0
- pveagle/lib/windows/amd64/libpv_eagle.dll +0 -0
- {pveagle-0.1.0.dist-info → pveagle-0.2.0.dist-info}/METADATA +5 -3
- pveagle-0.2.0.dist-info/RECORD +19 -0
- {pveagle-0.1.0.dist-info → pveagle-0.2.0.dist-info}/WHEEL +1 -1
- pveagle-0.1.0.dist-info/RECORD +0 -19
- {pveagle-0.1.0.dist-info → pveagle-0.2.0.dist-info}/top_level.txt +0 -0
pveagle/_eagle.py
CHANGED
@@ -16,7 +16,27 @@ from typing import Sequence, Tuple
|
|
16
16
|
|
17
17
|
|
18
18
|
class EagleError(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 EagleMemoryError(EagleError):
|
@@ -183,6 +203,20 @@ class EagleProfiler(object):
|
|
183
203
|
|
184
204
|
library = cdll.LoadLibrary(library_path)
|
185
205
|
|
206
|
+
set_sdk_func = library.pv_set_sdk
|
207
|
+
set_sdk_func.argtypes = [c_char_p]
|
208
|
+
set_sdk_func.restype = None
|
209
|
+
|
210
|
+
set_sdk_func('python'.encode('utf-8'))
|
211
|
+
|
212
|
+
self._get_error_stack_func = library.pv_get_error_stack
|
213
|
+
self._get_error_stack_func.argtypes = [POINTER(POINTER(c_char_p)), POINTER(c_int)]
|
214
|
+
self._get_error_stack_func.restype = PicovoiceStatuses
|
215
|
+
|
216
|
+
self._free_error_stack_func = library.pv_free_error_stack
|
217
|
+
self._free_error_stack_func.argtypes = [POINTER(c_char_p)]
|
218
|
+
self._free_error_stack_func.restype = None
|
219
|
+
|
186
220
|
# noinspection PyArgumentList
|
187
221
|
self._eagle_profiler = POINTER(self.CEagleProfiler)()
|
188
222
|
|
@@ -198,7 +232,9 @@ class EagleProfiler(object):
|
|
198
232
|
model_path.encode('utf-8'),
|
199
233
|
byref(self._eagle_profiler))
|
200
234
|
if status is not PicovoiceStatuses.SUCCESS:
|
201
|
-
raise _PICOVOICE_STATUS_TO_EXCEPTION[status](
|
235
|
+
raise _PICOVOICE_STATUS_TO_EXCEPTION[status](
|
236
|
+
message='Profile initialization failed',
|
237
|
+
message_stack=self._get_error_stack())
|
202
238
|
|
203
239
|
speaker_profile_size_func = library.pv_eagle_profiler_export_size
|
204
240
|
speaker_profile_size_func.argtypes = [
|
@@ -209,7 +245,9 @@ class EagleProfiler(object):
|
|
209
245
|
profile_size = c_int32()
|
210
246
|
status = speaker_profile_size_func(self._eagle_profiler, byref(profile_size))
|
211
247
|
if status is not PicovoiceStatuses.SUCCESS:
|
212
|
-
raise _PICOVOICE_STATUS_TO_EXCEPTION[status](
|
248
|
+
raise _PICOVOICE_STATUS_TO_EXCEPTION[status](
|
249
|
+
message='Failed to get profile size',
|
250
|
+
message_stack=self._get_error_stack())
|
213
251
|
self._profile_size = profile_size.value
|
214
252
|
|
215
253
|
enroll_min_audio_length_sample_func = \
|
@@ -224,7 +262,9 @@ class EagleProfiler(object):
|
|
224
262
|
self._eagle_profiler,
|
225
263
|
byref(min_enroll_samples))
|
226
264
|
if status is not PicovoiceStatuses.SUCCESS:
|
227
|
-
raise _PICOVOICE_STATUS_TO_EXCEPTION[status](
|
265
|
+
raise _PICOVOICE_STATUS_TO_EXCEPTION[status](
|
266
|
+
message='Failed to get min audio length sample',
|
267
|
+
message_stack=self._get_error_stack())
|
228
268
|
self._min_enroll_samples = min_enroll_samples.value
|
229
269
|
|
230
270
|
self._delete_func = library.pv_eagle_profiler_delete
|
@@ -298,7 +338,9 @@ class EagleProfiler(object):
|
|
298
338
|
byref(percentage))
|
299
339
|
feedback = EagleProfilerEnrollFeedback(feedback_code.value)
|
300
340
|
if status is not PicovoiceStatuses.SUCCESS:
|
301
|
-
raise _PICOVOICE_STATUS_TO_EXCEPTION[status](
|
341
|
+
raise _PICOVOICE_STATUS_TO_EXCEPTION[status](
|
342
|
+
message='Enrollment failed',
|
343
|
+
message_stack=self._get_error_stack())
|
302
344
|
|
303
345
|
return percentage.value, feedback
|
304
346
|
|
@@ -316,7 +358,9 @@ class EagleProfiler(object):
|
|
316
358
|
byref(profile)
|
317
359
|
)
|
318
360
|
if status is not PicovoiceStatuses.SUCCESS:
|
319
|
-
raise _PICOVOICE_STATUS_TO_EXCEPTION[status](
|
361
|
+
raise _PICOVOICE_STATUS_TO_EXCEPTION[status](
|
362
|
+
message='Export failed',
|
363
|
+
message_stack=self._get_error_stack())
|
320
364
|
|
321
365
|
return EagleProfile(cast(profile, c_void_p), self._profile_size)
|
322
366
|
|
@@ -328,7 +372,9 @@ class EagleProfiler(object):
|
|
328
372
|
|
329
373
|
status = self._reset_func(self._eagle_profiler)
|
330
374
|
if status is not PicovoiceStatuses.SUCCESS:
|
331
|
-
raise _PICOVOICE_STATUS_TO_EXCEPTION[status](
|
375
|
+
raise _PICOVOICE_STATUS_TO_EXCEPTION[status](
|
376
|
+
message='Profile reset failed',
|
377
|
+
message_stack=self._get_error_stack())
|
332
378
|
|
333
379
|
def delete(self) -> None:
|
334
380
|
"""
|
@@ -361,6 +407,21 @@ class EagleProfiler(object):
|
|
361
407
|
|
362
408
|
return self._version
|
363
409
|
|
410
|
+
def _get_error_stack(self) -> Sequence[str]:
|
411
|
+
message_stack_ref = POINTER(c_char_p)()
|
412
|
+
message_stack_depth = c_int()
|
413
|
+
status = self._get_error_stack_func(byref(message_stack_ref), byref(message_stack_depth))
|
414
|
+
if status is not PicovoiceStatuses.SUCCESS:
|
415
|
+
raise _PICOVOICE_STATUS_TO_EXCEPTION[status](message='Unable to get Eagle error state')
|
416
|
+
|
417
|
+
message_stack = list()
|
418
|
+
for i in range(message_stack_depth.value):
|
419
|
+
message_stack.append(message_stack_ref[i].decode('utf-8'))
|
420
|
+
|
421
|
+
self._free_error_stack_func(message_stack_ref)
|
422
|
+
|
423
|
+
return message_stack
|
424
|
+
|
364
425
|
|
365
426
|
class Eagle(object):
|
366
427
|
"""
|
@@ -400,6 +461,20 @@ class Eagle(object):
|
|
400
461
|
|
401
462
|
library = cdll.LoadLibrary(library_path)
|
402
463
|
|
464
|
+
set_sdk_func = library.pv_set_sdk
|
465
|
+
set_sdk_func.argtypes = [c_char_p]
|
466
|
+
set_sdk_func.restype = None
|
467
|
+
|
468
|
+
set_sdk_func('python'.encode('utf-8'))
|
469
|
+
|
470
|
+
self._get_error_stack_func = library.pv_get_error_stack
|
471
|
+
self._get_error_stack_func.argtypes = [POINTER(POINTER(c_char_p)), POINTER(c_int)]
|
472
|
+
self._get_error_stack_func.restype = PicovoiceStatuses
|
473
|
+
|
474
|
+
self._free_error_stack_func = library.pv_free_error_stack
|
475
|
+
self._free_error_stack_func.argtypes = [POINTER(c_char_p)]
|
476
|
+
self._free_error_stack_func.restype = None
|
477
|
+
|
403
478
|
# noinspection PyArgumentList
|
404
479
|
self._eagle = POINTER(self.CEagle)()
|
405
480
|
|
@@ -423,7 +498,9 @@ class Eagle(object):
|
|
423
498
|
profile_bytes,
|
424
499
|
byref(self._eagle))
|
425
500
|
if status is not PicovoiceStatuses.SUCCESS:
|
426
|
-
raise _PICOVOICE_STATUS_TO_EXCEPTION[status](
|
501
|
+
raise _PICOVOICE_STATUS_TO_EXCEPTION[status](
|
502
|
+
message='Initialization failed',
|
503
|
+
message_stack=self._get_error_stack())
|
427
504
|
|
428
505
|
self._delete_func = library.pv_eagle_delete
|
429
506
|
self._delete_func.argtypes = [POINTER(self.CEagle)]
|
@@ -471,7 +548,9 @@ class Eagle(object):
|
|
471
548
|
|
472
549
|
status = self._process_func(self._eagle, pcm, self._scores)
|
473
550
|
if status is not PicovoiceStatuses.SUCCESS:
|
474
|
-
raise _PICOVOICE_STATUS_TO_EXCEPTION[status](
|
551
|
+
raise _PICOVOICE_STATUS_TO_EXCEPTION[status](
|
552
|
+
message='Process failed',
|
553
|
+
message_stack=self._get_error_stack())
|
475
554
|
|
476
555
|
# noinspection PyTypeChecker
|
477
556
|
return [float(score) for score in self._scores]
|
@@ -485,7 +564,9 @@ class Eagle(object):
|
|
485
564
|
|
486
565
|
status = self._reset_func(self._eagle)
|
487
566
|
if status is not PicovoiceStatuses.SUCCESS:
|
488
|
-
raise _PICOVOICE_STATUS_TO_EXCEPTION[status](
|
567
|
+
raise _PICOVOICE_STATUS_TO_EXCEPTION[status](
|
568
|
+
message='Reset failed',
|
569
|
+
message_stack=self._get_error_stack())
|
489
570
|
|
490
571
|
def delete(self) -> None:
|
491
572
|
"""
|
@@ -518,6 +599,21 @@ class Eagle(object):
|
|
518
599
|
|
519
600
|
return self._version
|
520
601
|
|
602
|
+
def _get_error_stack(self) -> Sequence[str]:
|
603
|
+
message_stack_ref = POINTER(c_char_p)()
|
604
|
+
message_stack_depth = c_int()
|
605
|
+
status = self._get_error_stack_func(byref(message_stack_ref), byref(message_stack_depth))
|
606
|
+
if status is not PicovoiceStatuses.SUCCESS:
|
607
|
+
raise _PICOVOICE_STATUS_TO_EXCEPTION[status](message='Unable to get Eagle error state')
|
608
|
+
|
609
|
+
message_stack = list()
|
610
|
+
for i in range(message_stack_depth.value):
|
611
|
+
message_stack.append(message_stack_ref[i].decode('utf-8'))
|
612
|
+
|
613
|
+
self._free_error_stack_func(message_stack_ref)
|
614
|
+
|
615
|
+
return message_stack
|
616
|
+
|
521
617
|
|
522
618
|
__all__ = [
|
523
619
|
'Eagle',
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,11 +1,13 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: pveagle
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.2.0
|
4
4
|
Summary: Eagle Speaker Recognition Engine
|
5
5
|
Home-page: https://github.com/Picovoice/eagle
|
6
6
|
Author: Picovoice
|
7
7
|
Author-email: hello@picovoice.ai
|
8
|
+
License: UNKNOWN
|
8
9
|
Keywords: Speaker Recognition,Speaker Identification,Voice Recognition,Voice Identification
|
10
|
+
Platform: UNKNOWN
|
9
11
|
Classifier: Development Status :: 4 - Beta
|
10
12
|
Classifier: Intended Audience :: Developers
|
11
13
|
Classifier: License :: OSI Approved :: Apache Software License
|
@@ -139,7 +141,7 @@ eagle.delete()
|
|
139
141
|
```
|
140
142
|
|
141
143
|
## Demos
|
142
|
-
<!-- markdown-link-check-disable -->
|
143
144
|
[pveagledemo](https://pypi.org/project/pveagledemo/) provides command-line utilities for processing real-time
|
144
145
|
audio (i.e. microphone) and files using Eagle.
|
145
|
-
|
146
|
+
|
147
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
pveagle/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
2
|
+
pveagle/__init__.py,sha256=5RRV_Nak7RhTLHEGAaLW35_j-R35suDmolZAtXPOu2g,570
|
3
|
+
pveagle/_eagle.py,sha256=ftCdcNI3t054yQwcYx7SrxvGbINLf9pCAViyS1le1lQ,21705
|
4
|
+
pveagle/_factory.py,sha256=VDMTJUGolPJ9PqRifp719ik3y5jqGFu4Ba4uc3EXUWA,3011
|
5
|
+
pveagle/_util.py,sha256=5NtVephqCG_RWiNAZ2C_eHjwrdn6fxMiEcmnwWzkOrc,3150
|
6
|
+
pveagle/lib/common/eagle_params.pv,sha256=k9WBjUOgN0lqGdfTz7kCwISCTMCRTTo53cSlFt4xwGw,7156210
|
7
|
+
pveagle/lib/jetson/cortex-a57-aarch64/libpv_eagle.so,sha256=rEzMxGx42bIKztp9U11KIbxHnnGyCaIA8Z0SShn8CXY,233080
|
8
|
+
pveagle/lib/linux/x86_64/libpv_eagle.so,sha256=kIVJRg2WamXWHftxI2HXadXyUi2_fR1Y_wmhToMg570,254048
|
9
|
+
pveagle/lib/mac/arm64/libpv_eagle.dylib,sha256=p_nCDKqQ3l_hNrb8Yc9wD3gB5C9S5xEGeKU2bmauvT0,304526
|
10
|
+
pveagle/lib/mac/x86_64/libpv_eagle.dylib,sha256=v0t66n6PRR0YaQcHHFbd5laYbpLOczLBQWsSClPC1Y4,318504
|
11
|
+
pveagle/lib/raspberry-pi/cortex-a53/libpv_eagle.so,sha256=II6quUJXYqv74sqvPb02bkDwJiS9ON9Jkl6HxJCSl9Q,219464
|
12
|
+
pveagle/lib/raspberry-pi/cortex-a53-aarch64/libpv_eagle.so,sha256=yX73X5eNykH0g2D_VeGMmEK-68WxooijSWoFemz0BNQ,233080
|
13
|
+
pveagle/lib/raspberry-pi/cortex-a72/libpv_eagle.so,sha256=k_xCGIbKk93q0yxDUMq4d9uXRGIWW_nbWvBMoGZEE8E,223560
|
14
|
+
pveagle/lib/raspberry-pi/cortex-a72-aarch64/libpv_eagle.so,sha256=O-0buzY4pb7NjOeDkR6V0hXES5U1YeIhwmCc4StdHEk,233080
|
15
|
+
pveagle/lib/windows/amd64/libpv_eagle.dll,sha256=WeUyHhLBnoei4dSmo0YXyF2AIxeKQ7jBkAuZ3d0r3BQ,372736
|
16
|
+
pveagle-0.2.0.dist-info/METADATA,sha256=dy6UNP5Em_aL-cJPvREi20dQfnemHfMN6L42BWoYAho,5480
|
17
|
+
pveagle-0.2.0.dist-info/WHEEL,sha256=g4nMs7d-Xl9-xC9XovUrsDHGXt-FT0E17Yqo92DEfvY,92
|
18
|
+
pveagle-0.2.0.dist-info/top_level.txt,sha256=k2VZ1fNHirMrHCEeAoC3xi1ddfhyKl9qwhSSL_YlTIU,8
|
19
|
+
pveagle-0.2.0.dist-info/RECORD,,
|
pveagle-0.1.0.dist-info/RECORD
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
pveagle/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
2
|
-
pveagle/__init__.py,sha256=5RRV_Nak7RhTLHEGAaLW35_j-R35suDmolZAtXPOu2g,570
|
3
|
-
pveagle/_eagle.py,sha256=i8LjjdH_UNyI7hAjZKzAM1buO4RuEk-WC6CleANFD7Y,17717
|
4
|
-
pveagle/_factory.py,sha256=VDMTJUGolPJ9PqRifp719ik3y5jqGFu4Ba4uc3EXUWA,3011
|
5
|
-
pveagle/_util.py,sha256=5NtVephqCG_RWiNAZ2C_eHjwrdn6fxMiEcmnwWzkOrc,3150
|
6
|
-
pveagle/lib/common/eagle_params.pv,sha256=aeZ1ucZg9WB1C3HXoixpGyNiqH1utriLol0ZVf1A8UI,7156210
|
7
|
-
pveagle/lib/jetson/cortex-a57-aarch64/libpv_eagle.so,sha256=da02y_NYoQ_xrHnn2fYgpKzwPla5uwsnBChC_Lg-fqU,232080
|
8
|
-
pveagle/lib/linux/x86_64/libpv_eagle.so,sha256=_JreaDI40fGJFM1Ak6qWIpeKNCVH61RYClZspKTPtPY,248864
|
9
|
-
pveagle/lib/mac/arm64/libpv_eagle.dylib,sha256=cCfw-NebqNH-oX0NYYmQ_aSA7TWYKbsc6BdCjQcp8uw,304398
|
10
|
-
pveagle/lib/mac/x86_64/libpv_eagle.dylib,sha256=uYk2WcqFlgPwMAWNEwur1mY_fK9iSfBIwSDEj31ErI4,318376
|
11
|
-
pveagle/lib/raspberry-pi/cortex-a53/libpv_eagle.so,sha256=AG6LvhHetjgAJNj1Z72FFCOWG70a1HU4XcJWGmFUzDk,214932
|
12
|
-
pveagle/lib/raspberry-pi/cortex-a53-aarch64/libpv_eagle.so,sha256=Cp3gcdgnmiaeOAqZV_G_jjdzhjGVwZX_hRsG9FObCJk,232168
|
13
|
-
pveagle/lib/raspberry-pi/cortex-a72/libpv_eagle.so,sha256=Kjn-W6WxQN0ob6QI7d7z_ZjUOm0efcd6Vv04qwG_ra8,219028
|
14
|
-
pveagle/lib/raspberry-pi/cortex-a72-aarch64/libpv_eagle.so,sha256=wKBTqO1iu9zOXP11WAy4qni1mxQcNrCPeuBDGyrJkck,232168
|
15
|
-
pveagle/lib/windows/amd64/libpv_eagle.dll,sha256=4xtRy7_1dhiJn0Z61hwj_rimY5C83SGrsDAXSQDWOQc,376832
|
16
|
-
pveagle-0.1.0.dist-info/METADATA,sha256=NctY4hUYDQCvuZJQuM_Kb3J70_v98v8-arJ625jiCT4,5516
|
17
|
-
pveagle-0.1.0.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
|
18
|
-
pveagle-0.1.0.dist-info/top_level.txt,sha256=k2VZ1fNHirMrHCEeAoC3xi1ddfhyKl9qwhSSL_YlTIU,8
|
19
|
-
pveagle-0.1.0.dist-info/RECORD,,
|
File without changes
|