Anchor-annotator 0.1.0__py3-none-any.whl → 0.2.1__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.
- {Anchor_annotator-0.1.0.dist-info → Anchor_annotator-0.2.1.dist-info}/METADATA +1 -1
- Anchor_annotator-0.2.1.dist-info/RECORD +21 -0
- anchor/_version.py +2 -2
- anchor/main.py +44 -22
- anchor/models.py +826 -481
- anchor/plot.py +428 -399
- anchor/undo.py +103 -134
- anchor/widgets.py +36 -45
- anchor/workers.py +43 -17
- Anchor_annotator-0.1.0.dist-info/RECORD +0 -21
- {Anchor_annotator-0.1.0.dist-info → Anchor_annotator-0.2.1.dist-info}/LICENSE +0 -0
- {Anchor_annotator-0.1.0.dist-info → Anchor_annotator-0.2.1.dist-info}/WHEEL +0 -0
- {Anchor_annotator-0.1.0.dist-info → Anchor_annotator-0.2.1.dist-info}/top_level.txt +0 -0
anchor/workers.py
CHANGED
@@ -19,7 +19,8 @@ import dataclassy
|
|
19
19
|
import librosa
|
20
20
|
import numpy as np
|
21
21
|
import psycopg2.errors
|
22
|
-
import
|
22
|
+
import scipy
|
23
|
+
import scipy.signal
|
23
24
|
import soundfile
|
24
25
|
import sqlalchemy
|
25
26
|
import tqdm
|
@@ -28,6 +29,7 @@ from _kalpy.feat import compute_pitch
|
|
28
29
|
from _kalpy.ivector import Plda, ivector_normalize_length
|
29
30
|
from _kalpy.matrix import DoubleVector, FloatVector
|
30
31
|
from kalpy.feat.pitch import PitchComputer
|
32
|
+
from line_profiler_pycharm import profile
|
31
33
|
from montreal_forced_aligner import config
|
32
34
|
from montreal_forced_aligner.alignment import PretrainedAligner
|
33
35
|
from montreal_forced_aligner.config import IVECTOR_DIMENSION, XVECTOR_DIMENSION
|
@@ -3081,6 +3083,7 @@ class SpeakerTierWorker(FunctionWorker): # pragma: no cover
|
|
3081
3083
|
super().__init__("Generating speaker tier", *args)
|
3082
3084
|
self.query_alignment = False
|
3083
3085
|
self.session = None
|
3086
|
+
self.file_id = None
|
3084
3087
|
|
3085
3088
|
def set_params(self, file_id):
|
3086
3089
|
with self.lock:
|
@@ -3090,21 +3093,31 @@ class SpeakerTierWorker(FunctionWorker): # pragma: no cover
|
|
3090
3093
|
if self.session is None:
|
3091
3094
|
return
|
3092
3095
|
self.stopped.clear()
|
3093
|
-
with self.lock:
|
3094
|
-
|
3095
|
-
|
3096
|
+
with self.lock, self.session() as session:
|
3097
|
+
show_phones = (
|
3098
|
+
self.settings.value(self.settings.TIER_ALIGNED_PHONES_VISIBLE)
|
3099
|
+
or self.settings.value(self.settings.TIER_TRANSCRIBED_PHONES_VISIBLE)
|
3100
|
+
or self.settings.value(self.settings.TIER_REFERENCE_PHONES_VISIBLE)
|
3096
3101
|
)
|
3102
|
+
show_words = self.settings.value(
|
3103
|
+
self.settings.TIER_ALIGNED_WORDS_VISIBLE
|
3104
|
+
) or self.settings.value(self.settings.TIER_TRANSCRIBED_WORDS_VISIBLE)
|
3105
|
+
utterances = session.query(Utterance)
|
3097
3106
|
if self.query_alignment:
|
3098
|
-
|
3099
|
-
|
3100
|
-
|
3101
|
-
|
3102
|
-
|
3103
|
-
|
3104
|
-
|
3105
|
-
|
3106
|
-
|
3107
|
-
|
3107
|
+
if show_phones:
|
3108
|
+
utterances = utterances.options(
|
3109
|
+
selectinload(Utterance.phone_intervals).options(
|
3110
|
+
joinedload(PhoneInterval.phone, innerjoin=True),
|
3111
|
+
joinedload(PhoneInterval.workflow, innerjoin=True),
|
3112
|
+
)
|
3113
|
+
)
|
3114
|
+
if show_words:
|
3115
|
+
utterances = utterances.options(
|
3116
|
+
selectinload(Utterance.word_intervals).options(
|
3117
|
+
joinedload(WordInterval.word, innerjoin=True),
|
3118
|
+
joinedload(WordInterval.workflow, innerjoin=True),
|
3119
|
+
),
|
3120
|
+
)
|
3108
3121
|
utterances = utterances.filter(Utterance.file_id == self.file_id).order_by(
|
3109
3122
|
Utterance.begin
|
3110
3123
|
)
|
@@ -3138,6 +3151,7 @@ class SpectrogramWorker(FunctionWorker): # pragma: no cover
|
|
3138
3151
|
self.end = end
|
3139
3152
|
self.channel = channel
|
3140
3153
|
|
3154
|
+
@profile
|
3141
3155
|
def run(self):
|
3142
3156
|
self.stopped.clear()
|
3143
3157
|
dynamic_range = self.settings.value(self.settings.SPEC_DYNAMIC_RANGE)
|
@@ -3146,12 +3160,18 @@ class SpectrogramWorker(FunctionWorker): # pragma: no cover
|
|
3146
3160
|
window_size = self.settings.value(self.settings.SPEC_WINDOW_SIZE)
|
3147
3161
|
pre_emph_coeff = self.settings.value(self.settings.SPEC_PREEMPH)
|
3148
3162
|
max_freq = self.settings.value(self.settings.SPEC_MAX_FREQ)
|
3163
|
+
if self.y.shape[0] == 0:
|
3164
|
+
return
|
3165
|
+
duration = self.y.shape[0] / self.sample_rate
|
3166
|
+
if duration > 30:
|
3167
|
+
return
|
3149
3168
|
with self.lock:
|
3150
|
-
if self.y.shape[0] == 0:
|
3151
|
-
return
|
3152
3169
|
max_sr = 2 * max_freq
|
3153
3170
|
if self.sample_rate > max_sr:
|
3154
|
-
self.y =
|
3171
|
+
self.y = scipy.signal.resample(
|
3172
|
+
self.y, int(self.y.shape[0] * max_sr / self.sample_rate)
|
3173
|
+
)
|
3174
|
+
# self.y = resampy.resample(self.y, self.sample_rate, max_sr, filter='kaiser_fast')
|
3155
3175
|
self.sample_rate = max_sr
|
3156
3176
|
self.y = librosa.effects.preemphasis(self.y, coef=pre_emph_coeff)
|
3157
3177
|
if self.stopped.is_set():
|
@@ -3225,6 +3245,10 @@ class PitchWorker(FunctionWorker): # pragma: no cover
|
|
3225
3245
|
max_f0=self.max_f0,
|
3226
3246
|
penalty_factor=self.penalty_factor,
|
3227
3247
|
delta_pitch=self.delta_pitch,
|
3248
|
+
add_pov_feature=True,
|
3249
|
+
add_normalized_log_pitch=False,
|
3250
|
+
add_delta_pitch=False,
|
3251
|
+
add_raw_log_pitch=True,
|
3228
3252
|
)
|
3229
3253
|
|
3230
3254
|
def run(self):
|
@@ -3232,6 +3256,8 @@ class PitchWorker(FunctionWorker): # pragma: no cover
|
|
3232
3256
|
with self.lock:
|
3233
3257
|
if self.y.shape[0] == 0:
|
3234
3258
|
return
|
3259
|
+
if self.end - self.begin < 0.1:
|
3260
|
+
return
|
3235
3261
|
pitch_track = compute_pitch(
|
3236
3262
|
self.y, self.pitch_computer.extraction_opts, self.pitch_computer.process_opts
|
3237
3263
|
).numpy()
|
@@ -1,21 +0,0 @@
|
|
1
|
-
anchor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
anchor/__main__.py,sha256=5ufG8lcx2x1am-04xI991AG7saJd24dxPw5JzjmB878,45
|
3
|
-
anchor/_version.py,sha256=IMl2Pr_Sy4LVRKy_Sm4CdwUl1Gryous6ncL96EMYsnM,411
|
4
|
-
anchor/command_line.py,sha256=xvuCWaPWNVZTg5Ic28qbOYsOLaFbodhBsoZHKJSBazs,482
|
5
|
-
anchor/db.py,sha256=ef4lO6HtCKoxC9CorIc0ZbPxKpjHa576a0ZIBOWNU9E,4956
|
6
|
-
anchor/main.py,sha256=GOol2yC_57qrJ-uTtvISGAlrZ5cMojcMq9puUVohojc,113324
|
7
|
-
anchor/models.py,sha256=lWXlKzH9xGhdNbFgob7XZy2CGYZXAPoiIIP8Dmhqt-o,75130
|
8
|
-
anchor/plot.py,sha256=CUAcUsPpX9Ja4PINTQN08gfuT_x27bK2kIkkAyH69-A,106870
|
9
|
-
anchor/resources_rc.py,sha256=sQ6GvAK3NTVR5bvgR9jCWDeepSYOhEph2mg1ECxnMOs,3560262
|
10
|
-
anchor/settings.py,sha256=SJ9-5xjThJp3-zl99OBLWLSXZmsyUU1JNsgGWHlkJS8,46649
|
11
|
-
anchor/ui_error_dialog.py,sha256=c_QS0s1VaJEV9AhcrQZQyWHHpUPudWjJY1NI7Ytipio,3832
|
12
|
-
anchor/ui_main_window.py,sha256=aEABdKi1Eb1c2MKUsbCbufEp1lKSLFNsC9TPX244UPI,64618
|
13
|
-
anchor/ui_preferences.py,sha256=uer2Xzyq26j-5wwbIKKcK8YEe2w7OFJPXfWSkKcPWhI,40146
|
14
|
-
anchor/undo.py,sha256=rVus-7HC9wPIiab3dUxIeNGK7jWOMSVmDvCFEwU-408,33163
|
15
|
-
anchor/widgets.py,sha256=CkFsF1Iuck79lQSnszouLNt_MOPMp35zpL0dzQR2l1o,135702
|
16
|
-
anchor/workers.py,sha256=0kytaQYryib3hm0qDFuZpnLIfLC-HeaZY6zV6PYTxr4,169699
|
17
|
-
Anchor_annotator-0.1.0.dist-info/LICENSE,sha256=C0oIsblENEgWQ7XMNdYoXyXsIA5wa3YF0I9lK3H7A1s,1076
|
18
|
-
Anchor_annotator-0.1.0.dist-info/METADATA,sha256=zS_ndUVMaJxv4bBGpZgHQcwTjQSTqLh1KYYWag9h5Ds,1500
|
19
|
-
Anchor_annotator-0.1.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
20
|
-
Anchor_annotator-0.1.0.dist-info/top_level.txt,sha256=wX6ZKxImGRZKFQjs3f6XYw_TfbAp6Xs3SmbLfLbFAJ0,7
|
21
|
-
Anchor_annotator-0.1.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|