sonusai 1.0.1__py3-none-any.whl → 1.0.3__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.
- sonusai/audiofe.py +1 -1
- sonusai/genmetrics.py +2 -0
- sonusai/genmixdb.py +6 -0
- sonusai/mixture/__init__.py +0 -1
- sonusai/mixture/effects.py +1 -1
- sonusai/mixture/generation.py +22 -45
- sonusai/mixture/mixdb.py +44 -125
- {sonusai-1.0.1.dist-info → sonusai-1.0.3.dist-info}/METADATA +2 -1
- {sonusai-1.0.1.dist-info → sonusai-1.0.3.dist-info}/RECORD +11 -11
- {sonusai-1.0.1.dist-info → sonusai-1.0.3.dist-info}/WHEEL +0 -0
- {sonusai-1.0.1.dist-info → sonusai-1.0.3.dist-info}/entry_points.txt +0 -0
sonusai/audiofe.py
CHANGED
sonusai/genmetrics.py
CHANGED
@@ -51,10 +51,12 @@ Generate all available metrics except for mxcovl
|
|
51
51
|
def _process_mixture(mixid: int, location: str, metrics: list[str], update: bool = False) -> set[str]:
|
52
52
|
from sonusai.mixture import MixtureDatabase
|
53
53
|
from sonusai.mixture import write_cached_data
|
54
|
+
from sonusai.mixture import write_mixture_metadata
|
54
55
|
|
55
56
|
mixdb = MixtureDatabase(location)
|
56
57
|
results = mixdb.mixture_metrics(m_id=mixid, metrics=metrics, force=not update)
|
57
58
|
write_cached_data(mixdb.location, "mixture", mixdb.mixture(mixid).name, results)
|
59
|
+
write_mixture_metadata(mixdb, mixture=mixdb.mixture(mixid))
|
58
60
|
|
59
61
|
return set(results.keys())
|
60
62
|
|
sonusai/genmixdb.py
CHANGED
@@ -91,6 +91,9 @@ def genmixdb(
|
|
91
91
|
if len([file for file in source_files if file.category == "primary"]) == 0:
|
92
92
|
raise RuntimeError("Canceled due to no primary sources")
|
93
93
|
|
94
|
+
if logging:
|
95
|
+
logger.info("Populating source file table")
|
96
|
+
|
94
97
|
populate_source_file_table(location, source_files, test)
|
95
98
|
|
96
99
|
if logging:
|
@@ -123,6 +126,9 @@ def genmixdb(
|
|
123
126
|
ir_files = get_ir_files(config, show_progress=show_progress)
|
124
127
|
logger.info("")
|
125
128
|
|
129
|
+
if logging:
|
130
|
+
logger.info("Populating impulse response file table")
|
131
|
+
|
126
132
|
populate_impulse_response_file_table(location, ir_files, test)
|
127
133
|
|
128
134
|
if logging:
|
sonusai/mixture/__init__.py
CHANGED
sonusai/mixture/effects.py
CHANGED
@@ -308,7 +308,7 @@ def evaluate_sai_random_ir(mixdb: MixtureDatabase, text: str) -> str:
|
|
308
308
|
return m.group(1)
|
309
309
|
|
310
310
|
if re.match(rand_pattern, text):
|
311
|
-
return f"ir {randint(0, mixdb.num_ir_files)}" # noqa: S311
|
311
|
+
return f"ir {randint(0, mixdb.num_ir_files - 1)}" # noqa: S311
|
312
312
|
|
313
313
|
if re.match(rand_range_pattern, text):
|
314
314
|
try:
|
sonusai/mixture/generation.py
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
# ruff: noqa: S608
|
2
|
-
from .mixdb import MixtureDatabase
|
3
2
|
from ..datatypes import AudioT
|
4
3
|
from ..datatypes import Effects
|
5
4
|
from ..datatypes import GenMixData
|
@@ -9,6 +8,7 @@ from ..datatypes import Source
|
|
9
8
|
from ..datatypes import SourceFile
|
10
9
|
from ..datatypes import SourcesAudioT
|
11
10
|
from ..datatypes import UniversalSNRGenerator
|
11
|
+
from .mixdb import MixtureDatabase
|
12
12
|
|
13
13
|
|
14
14
|
def config_file(location: str) -> str:
|
@@ -304,10 +304,7 @@ def populate_source_file_table(location: str, files: list[SourceFile], test: boo
|
|
304
304
|
truth_config_ids.append(cur.fetchone()[0])
|
305
305
|
|
306
306
|
# Get speaker_id for source file
|
307
|
-
cur.execute(
|
308
|
-
"SELECT speaker.id FROM speaker WHERE ? = speaker.parent",
|
309
|
-
(Path(file.name).parent.as_posix(),),
|
310
|
-
)
|
307
|
+
cur.execute("SELECT speaker.id FROM speaker WHERE ? = speaker.parent", (Path(file.name).parent.as_posix(),))
|
311
308
|
result = cur.fetchone()
|
312
309
|
speaker_id = None
|
313
310
|
if result is not None:
|
@@ -337,8 +334,7 @@ def populate_source_file_table(location: str, files: list[SourceFile], test: boo
|
|
337
334
|
|
338
335
|
# Update textgrid_metadata_tiers in the top table
|
339
336
|
con.execute(
|
340
|
-
"UPDATE top SET textgrid_metadata_tiers=? WHERE ? =
|
341
|
-
(json.dumps(sorted(textgrid_metadata_tiers)), 1),
|
337
|
+
"UPDATE top SET textgrid_metadata_tiers=? WHERE ? = id", (json.dumps(sorted(textgrid_metadata_tiers)), 1)
|
342
338
|
)
|
343
339
|
|
344
340
|
con.commit()
|
@@ -358,26 +354,14 @@ def populate_impulse_response_file_table(location: str, files: list[ImpulseRespo
|
|
358
354
|
# Get tags for file
|
359
355
|
tag_ids: list[int] = []
|
360
356
|
for tag in file.tags:
|
361
|
-
cur.execute(
|
362
|
-
"SELECT ir_tag.id FROM ir_tag WHERE ? = ir_tag.tag",
|
363
|
-
(tag,),
|
364
|
-
)
|
357
|
+
cur.execute("SELECT id FROM ir_tag WHERE ? = tag", (tag,))
|
365
358
|
tag_ids.append(cur.fetchone()[0])
|
366
359
|
|
367
|
-
cur.execute(
|
368
|
-
"INSERT INTO ir_file (delay, name) VALUES (?, ?)",
|
369
|
-
(
|
370
|
-
file.delay,
|
371
|
-
file.name,
|
372
|
-
),
|
373
|
-
)
|
360
|
+
cur.execute("INSERT INTO ir_file (delay, name) VALUES (?, ?)", (file.delay, file.name))
|
374
361
|
|
375
362
|
file_id = cur.lastrowid
|
376
363
|
for tag_id in tag_ids:
|
377
|
-
cur.execute(
|
378
|
-
"INSERT INTO ir_file_ir_tag (file_id, tag_id) VALUES (?, ?)",
|
379
|
-
(file_id, tag_id),
|
380
|
-
)
|
364
|
+
cur.execute("INSERT INTO ir_file_ir_tag (file_id, tag_id) VALUES (?, ?)", (file_id, tag_id))
|
381
365
|
|
382
366
|
con.commit()
|
383
367
|
con.close()
|
@@ -389,10 +373,7 @@ def update_mixid_width(location: str, num_mixtures: int, test: bool = False) ->
|
|
389
373
|
from .mixdb import db_connection
|
390
374
|
|
391
375
|
con = db_connection(location=location, readonly=False, test=test)
|
392
|
-
con.execute(
|
393
|
-
"UPDATE top SET mixid_width=? WHERE ? = top.id",
|
394
|
-
(max_text_width(num_mixtures), 1),
|
395
|
-
)
|
376
|
+
con.execute("UPDATE top SET mixid_width=? WHERE ? = id", (max_text_width(num_mixtures), 1))
|
396
377
|
con.commit()
|
397
378
|
con.close()
|
398
379
|
|
@@ -477,36 +458,35 @@ def populate_mixture_table(
|
|
477
458
|
if logging:
|
478
459
|
logger.info("Populating mixture table")
|
479
460
|
for mixture in track(mixtures, disable=not show_progress):
|
480
|
-
m_id = int(mixture.name)
|
461
|
+
m_id = int(mixture.name) + 1
|
481
462
|
con.execute(
|
482
463
|
"""
|
483
464
|
INSERT INTO mixture (id, name, samples, spectral_mask_id, spectral_mask_seed)
|
484
465
|
VALUES (?, ?, ?, ?, ?)
|
485
466
|
""",
|
486
|
-
(m_id
|
467
|
+
(m_id, *from_mixture(mixture)),
|
487
468
|
)
|
488
469
|
|
489
470
|
for source in mixture.all_sources.values():
|
490
471
|
source_id = con.execute(
|
491
472
|
"""
|
492
|
-
SELECT
|
473
|
+
SELECT id
|
493
474
|
FROM source
|
494
|
-
WHERE ? =
|
495
|
-
AND ? =
|
496
|
-
AND ? =
|
497
|
-
AND ? =
|
498
|
-
AND ? =
|
499
|
-
AND ? =
|
500
|
-
AND ? =
|
501
|
-
AND ? =
|
475
|
+
WHERE ? = effects
|
476
|
+
AND ? = file_id
|
477
|
+
AND ? = pre_tempo
|
478
|
+
AND ? = repeat
|
479
|
+
AND ? = snr
|
480
|
+
AND ? = snr_gain
|
481
|
+
AND ? = snr_random
|
482
|
+
AND ? = start
|
502
483
|
""",
|
503
484
|
from_source(source),
|
504
485
|
).fetchone()[0]
|
505
|
-
con.execute(
|
506
|
-
"INSERT INTO mixture_source (mixture_id, source_id) VALUES (?, ?)",
|
507
|
-
(m_id + 1, source_id),
|
508
|
-
)
|
486
|
+
con.execute("INSERT INTO mixture_source (mixture_id, source_id) VALUES (?, ?)", (m_id, source_id))
|
509
487
|
|
488
|
+
if logging:
|
489
|
+
logger.info("Closing mixture table")
|
510
490
|
con.commit()
|
511
491
|
con.close()
|
512
492
|
|
@@ -924,10 +904,7 @@ def _populate_speaker_table(location: str, source_files: list[SourceFile], test:
|
|
924
904
|
for description in con.execute("SELECT * FROM speaker").description
|
925
905
|
if description[0] not in ("id", "parent")
|
926
906
|
]
|
927
|
-
con.execute(
|
928
|
-
"UPDATE top SET speaker_metadata_tiers=? WHERE ? = top.id",
|
929
|
-
(json.dumps(tiers), 1),
|
930
|
-
)
|
907
|
+
con.execute("UPDATE top SET speaker_metadata_tiers=? WHERE ? = id", (json.dumps(tiers), 1))
|
931
908
|
|
932
909
|
if "speaker_id" in tiers:
|
933
910
|
con.execute("CREATE INDEX speaker_speaker_id_idx ON source_file (speaker_id)")
|
sonusai/mixture/mixdb.py
CHANGED
@@ -110,7 +110,7 @@ class MixtureDatabase:
|
|
110
110
|
config = load_config(self.location)
|
111
111
|
new_asr_configs = json.dumps(config["asr_configs"])
|
112
112
|
with self.db() as c:
|
113
|
-
old_asr_configs = c.execute("SELECT
|
113
|
+
old_asr_configs = c.execute("SELECT asr_configs FROM top").fetchone()
|
114
114
|
|
115
115
|
if old_asr_configs is not None and new_asr_configs != old_asr_configs[0]:
|
116
116
|
con = db_connection(location=self.location, readonly=False, test=self.test)
|
@@ -172,14 +172,14 @@ class MixtureDatabase:
|
|
172
172
|
@cached_property
|
173
173
|
def num_classes(self) -> int:
|
174
174
|
with self.db() as c:
|
175
|
-
return int(c.execute("SELECT
|
175
|
+
return int(c.execute("SELECT num_classes FROM top").fetchone()[0])
|
176
176
|
|
177
177
|
@cached_property
|
178
178
|
def asr_configs(self) -> ASRConfigs:
|
179
179
|
import json
|
180
180
|
|
181
181
|
with self.db() as c:
|
182
|
-
return json.loads(c.execute("SELECT
|
182
|
+
return json.loads(c.execute("SELECT asr_configs FROM top").fetchone()[0])
|
183
183
|
|
184
184
|
@cached_property
|
185
185
|
def supported_metrics(self) -> MetricDocs:
|
@@ -362,12 +362,12 @@ class MixtureDatabase:
|
|
362
362
|
@cached_property
|
363
363
|
def class_balancing(self) -> bool:
|
364
364
|
with self.db() as c:
|
365
|
-
return bool(c.execute("SELECT
|
365
|
+
return bool(c.execute("SELECT class_balancing FROM top").fetchone()[0])
|
366
366
|
|
367
367
|
@cached_property
|
368
368
|
def feature(self) -> str:
|
369
369
|
with self.db() as c:
|
370
|
-
return str(c.execute("SELECT
|
370
|
+
return str(c.execute("SELECT feature FROM top").fetchone()[0])
|
371
371
|
|
372
372
|
@cached_property
|
373
373
|
def fg_decimation(self) -> int:
|
@@ -455,10 +455,7 @@ class MixtureDatabase:
|
|
455
455
|
:return: Class labels
|
456
456
|
"""
|
457
457
|
with self.db() as c:
|
458
|
-
return [
|
459
|
-
str(item[0])
|
460
|
-
for item in c.execute("SELECT class_label.label FROM class_label ORDER BY class_label.id").fetchall()
|
461
|
-
]
|
458
|
+
return [str(item[0]) for item in c.execute("SELECT label FROM class_label ORDER BY id").fetchall()]
|
462
459
|
|
463
460
|
@cached_property
|
464
461
|
def class_weights_thresholds(self) -> list[float]:
|
@@ -467,12 +464,7 @@ class MixtureDatabase:
|
|
467
464
|
:return: Class weights thresholds
|
468
465
|
"""
|
469
466
|
with self.db() as c:
|
470
|
-
return [
|
471
|
-
float(item[0])
|
472
|
-
for item in c.execute(
|
473
|
-
"SELECT class_weights_threshold.threshold FROM class_weights_threshold"
|
474
|
-
).fetchall()
|
475
|
-
]
|
467
|
+
return [float(item[0]) for item in c.execute("SELECT threshold FROM class_weights_threshold").fetchall()]
|
476
468
|
|
477
469
|
def category_truth_configs(self, category: str) -> dict[str, str]:
|
478
470
|
return _category_truth_configs(self.db, category, self.use_cache)
|
@@ -568,14 +560,7 @@ class MixtureDatabase:
|
|
568
560
|
source_files[category[0]] = []
|
569
561
|
source_file_records = [
|
570
562
|
SourceFileRecord(*result)
|
571
|
-
for result in c.execute(
|
572
|
-
"""
|
573
|
-
SELECT *
|
574
|
-
FROM source_file
|
575
|
-
WHERE ? = source_file.category
|
576
|
-
""",
|
577
|
-
(category[0],),
|
578
|
-
).fetchall()
|
563
|
+
for result in c.execute("SELECT * FROM source_file WHERE ? = category", (category[0],)).fetchall()
|
579
564
|
]
|
580
565
|
for source_file_record in source_file_records:
|
581
566
|
truth_configs: TruthConfigs = {}
|
@@ -618,25 +603,9 @@ class MixtureDatabase:
|
|
618
603
|
source_file_ids: dict[str, list[int]] = {}
|
619
604
|
categories = c.execute("SELECT DISTINCT category FROM source_file").fetchall()
|
620
605
|
for category in categories:
|
621
|
-
# items = c.execute(
|
622
|
-
# """
|
623
|
-
# SELECT source_file.id
|
624
|
-
# FROM source_file
|
625
|
-
# WHERE ? = source_file.category
|
626
|
-
# """,
|
627
|
-
# (category[0],),
|
628
|
-
# ).fetchall()
|
629
|
-
# source_file_ids[category[0]] = [int(item[0]) for item in items]
|
630
606
|
source_file_ids[category[0]] = [
|
631
607
|
int(item[0])
|
632
|
-
for item in c.execute(
|
633
|
-
"""
|
634
|
-
SELECT source_file.id
|
635
|
-
FROM source_file
|
636
|
-
WHERE ? = source_file.category
|
637
|
-
""",
|
638
|
-
(category[0],),
|
639
|
-
).fetchall()
|
608
|
+
for item in c.execute("SELECT id FROM source_file WHERE ? = category", (category[0],)).fetchall()
|
640
609
|
]
|
641
610
|
return source_file_ids
|
642
611
|
|
@@ -700,7 +669,7 @@ class MixtureDatabase:
|
|
700
669
|
:return: List of impulse response file IDs
|
701
670
|
"""
|
702
671
|
with self.db() as c:
|
703
|
-
return [int(item[0]) for item in c.execute("SELECT
|
672
|
+
return [int(item[0]) for item in c.execute("SELECT id FROM ir_file").fetchall()]
|
704
673
|
|
705
674
|
def ir_file_ids_for_tag(self, tag: str) -> list[int]:
|
706
675
|
"""Get impulse response file IDs for given tag from db
|
@@ -708,20 +677,13 @@ class MixtureDatabase:
|
|
708
677
|
:return: List of impulse response file IDs for given tag
|
709
678
|
"""
|
710
679
|
with self.db() as c:
|
711
|
-
tag_id = c.execute("SELECT
|
680
|
+
tag_id = c.execute("SELECT id FROM ir_tag WHERE ? = tag", (tag,)).fetchone()
|
712
681
|
if not tag_id:
|
713
682
|
return []
|
714
683
|
|
715
684
|
return [
|
716
685
|
int(item[0] - 1)
|
717
|
-
for item in c.execute(
|
718
|
-
"""
|
719
|
-
SELECT ir_file_ir_tag.file_id
|
720
|
-
FROM ir_file_ir_tag
|
721
|
-
WHERE ? = ir_file_ir_tag.tag_id
|
722
|
-
""",
|
723
|
-
(tag_id[0],),
|
724
|
-
).fetchall()
|
686
|
+
for item in c.execute("SELECT file_id FROM ir_file_ir_tag WHERE ? = tag_id", (tag_id[0],)).fetchall()
|
725
687
|
]
|
726
688
|
|
727
689
|
def ir_file(self, ir_id: int) -> str:
|
@@ -747,7 +709,7 @@ class MixtureDatabase:
|
|
747
709
|
:return: Number of impulse response files
|
748
710
|
"""
|
749
711
|
with self.db() as c:
|
750
|
-
return int(c.execute("SELECT count(
|
712
|
+
return int(c.execute("SELECT count(id) FROM ir_file").fetchone()[0])
|
751
713
|
|
752
714
|
@cached_property
|
753
715
|
def ir_tags(self) -> list[str]:
|
@@ -756,7 +718,7 @@ class MixtureDatabase:
|
|
756
718
|
:return: Tags of impulse response files
|
757
719
|
"""
|
758
720
|
with self.db() as c:
|
759
|
-
return [tag[0] for tag in c.execute("SELECT
|
721
|
+
return [tag[0] for tag in c.execute("SELECT tag FROM ir_tag").fetchall()]
|
760
722
|
|
761
723
|
@property
|
762
724
|
def mixtures(self) -> list[Mixture]:
|
@@ -799,7 +761,7 @@ class MixtureDatabase:
|
|
799
761
|
:return: List of zero-based mixture IDs
|
800
762
|
"""
|
801
763
|
with self.db() as c:
|
802
|
-
return [int(item[0]) - 1 for item in c.execute("SELECT
|
764
|
+
return [int(item[0]) - 1 for item in c.execute("SELECT id FROM mixture").fetchall()]
|
803
765
|
|
804
766
|
def mixture(self, m_id: int) -> Mixture:
|
805
767
|
"""Get mixture record with ID from db
|
@@ -812,7 +774,7 @@ class MixtureDatabase:
|
|
812
774
|
@cached_property
|
813
775
|
def mixid_width(self) -> int:
|
814
776
|
with self.db() as c:
|
815
|
-
return int(c.execute("SELECT
|
777
|
+
return int(c.execute("SELECT mixid_width FROM top").fetchone()[0])
|
816
778
|
|
817
779
|
def mixture_location(self, m_id: int) -> str:
|
818
780
|
"""Get the file location for the give mixture ID
|
@@ -831,7 +793,7 @@ class MixtureDatabase:
|
|
831
793
|
:return: Number of mixtures
|
832
794
|
"""
|
833
795
|
with self.db() as c:
|
834
|
-
return int(c.execute("SELECT count(
|
796
|
+
return int(c.execute("SELECT count(id) FROM mixture").fetchone()[0])
|
835
797
|
|
836
798
|
def read_mixture_data(self, m_id: int, items: list[str] | str) -> dict[str, Any]:
|
837
799
|
"""Read mixture data
|
@@ -1598,7 +1560,7 @@ class MixtureDatabase:
|
|
1598
1560
|
tier: str | None = None,
|
1599
1561
|
value: str | None = None,
|
1600
1562
|
where: str | None = None,
|
1601
|
-
) -> list[int]:
|
1563
|
+
) -> dict[str, list[int]]:
|
1602
1564
|
"""Get a list of mixture IDs for the given speech metadata tier.
|
1603
1565
|
|
1604
1566
|
If 'where' is None, then include mixture IDs whose tier values are equal to the given 'value'.
|
@@ -1632,14 +1594,27 @@ class MixtureDatabase:
|
|
1632
1594
|
results = c.execute(f"SELECT id FROM speaker WHERE {where}").fetchall()
|
1633
1595
|
speaker_ids = ",".join(map(str, [i[0] for i in results]))
|
1634
1596
|
|
1635
|
-
results = c.execute(f"SELECT id FROM
|
1636
|
-
|
1597
|
+
results = c.execute(f"SELECT id, category FROM source_file WHERE speaker_id IN ({speaker_ids})").fetchall()
|
1598
|
+
source_file_ids: dict[str, list[int]] = {}
|
1599
|
+
for result in results:
|
1600
|
+
source_file_id, category = result
|
1601
|
+
if category not in source_file_ids:
|
1602
|
+
source_file_ids[category] = [source_file_id]
|
1603
|
+
else:
|
1604
|
+
source_file_ids[category].append(source_file_id)
|
1605
|
+
|
1606
|
+
mixids: dict[str, list[int]] = {}
|
1607
|
+
for category in source_file_ids:
|
1608
|
+
id_str = ",".join(map(str, source_file_ids[category]))
|
1609
|
+
results = c.execute(f"SELECT id FROM source WHERE file_id IN ({id_str})").fetchall()
|
1610
|
+
source_ids = ",".join(map(str, [i[0] for i in results]))
|
1637
1611
|
|
1638
|
-
|
1639
|
-
|
1640
|
-
|
1612
|
+
results = c.execute(
|
1613
|
+
f"SELECT mixture_id FROM mixture_source WHERE source_id IN ({source_ids})"
|
1614
|
+
).fetchall()
|
1615
|
+
mixids[category] = [mixture_id[0] - 1 for mixture_id in results]
|
1641
1616
|
|
1642
|
-
return
|
1617
|
+
return mixids
|
1643
1618
|
|
1644
1619
|
def mixture_all_speech_metadata(self, m_id: int) -> dict[str, dict[str, SpeechMetadata]]:
|
1645
1620
|
from .helpers import mixture_all_speech_metadata
|
@@ -2226,16 +2201,7 @@ def __spectral_mask(db: partial, sm_id: int) -> SpectralMask:
|
|
2226
2201
|
from .db_datatypes import SpectralMaskRecord
|
2227
2202
|
|
2228
2203
|
with db() as c:
|
2229
|
-
spectral_mask = SpectralMaskRecord(
|
2230
|
-
*c.execute(
|
2231
|
-
"""
|
2232
|
-
SELECT *
|
2233
|
-
FROM spectral_mask
|
2234
|
-
WHERE ? = spectral_mask.id
|
2235
|
-
""",
|
2236
|
-
(sm_id,),
|
2237
|
-
).fetchone()
|
2238
|
-
)
|
2204
|
+
spectral_mask = SpectralMaskRecord(*c.execute("SELECT * FROM spectral_mask WHERE ? = id", (sm_id,)).fetchone())
|
2239
2205
|
return SpectralMask(
|
2240
2206
|
f_max_width=spectral_mask.f_max_width,
|
2241
2207
|
f_num=spectral_mask.f_num,
|
@@ -2267,11 +2233,7 @@ def __num_source_files(db: partial, category: str) -> int:
|
|
2267
2233
|
:return: Number of source files
|
2268
2234
|
"""
|
2269
2235
|
with db() as c:
|
2270
|
-
return int(
|
2271
|
-
c.execute(
|
2272
|
-
"SELECT count(source_file.id) FROM source_file WHERE ? = source_file.category", (category,)
|
2273
|
-
).fetchone()[0]
|
2274
|
-
)
|
2236
|
+
return int(c.execute("SELECT count(id) FROM source_file WHERE ? = category", (category,)).fetchone()[0])
|
2275
2237
|
|
2276
2238
|
|
2277
2239
|
def _source_file(db: partial, s_id: int, use_cache: bool = True) -> SourceFile:
|
@@ -2301,16 +2263,7 @@ def __source_file(db: partial, s_id: int, use_cache: bool = True) -> SourceFile:
|
|
2301
2263
|
from .db_datatypes import SourceFileRecord
|
2302
2264
|
|
2303
2265
|
with db() as c:
|
2304
|
-
source_file = SourceFileRecord(
|
2305
|
-
*c.execute(
|
2306
|
-
"""
|
2307
|
-
SELECT *
|
2308
|
-
FROM source_file
|
2309
|
-
WHERE ? = source_file.id
|
2310
|
-
""",
|
2311
|
-
(s_id,),
|
2312
|
-
).fetchone()
|
2313
|
-
)
|
2266
|
+
source_file = SourceFileRecord(*c.execute("SELECT * FROM source_file WHERE ? = id", (s_id,)).fetchone())
|
2314
2267
|
|
2315
2268
|
return SourceFile(
|
2316
2269
|
category=source_file.category,
|
@@ -2339,16 +2292,7 @@ def _ir_file(db: partial, ir_id: int, use_cache: bool = True) -> str:
|
|
2339
2292
|
@lru_cache
|
2340
2293
|
def __ir_file(db: partial, ir_id: int) -> str:
|
2341
2294
|
with db() as c:
|
2342
|
-
return str(
|
2343
|
-
c.execute(
|
2344
|
-
"""
|
2345
|
-
SELECT ir_file.name
|
2346
|
-
FROM ir_file
|
2347
|
-
WHERE ? = ir_file.id
|
2348
|
-
""",
|
2349
|
-
(ir_id + 1,),
|
2350
|
-
).fetchone()[0]
|
2351
|
-
)
|
2295
|
+
return str(c.execute("SELECT name FROM ir_file WHERE ? = id ", (ir_id + 1,)).fetchone()[0])
|
2352
2296
|
|
2353
2297
|
|
2354
2298
|
def _ir_delay(db: partial, ir_id: int, use_cache: bool = True) -> int:
|
@@ -2367,16 +2311,7 @@ def _ir_delay(db: partial, ir_id: int, use_cache: bool = True) -> int:
|
|
2367
2311
|
@lru_cache
|
2368
2312
|
def __ir_delay(db: partial, ir_id: int) -> int:
|
2369
2313
|
with db() as c:
|
2370
|
-
return int(
|
2371
|
-
c.execute(
|
2372
|
-
"""
|
2373
|
-
SELECT ir_file.delay
|
2374
|
-
FROM ir_file
|
2375
|
-
WHERE ? = ir_file.id
|
2376
|
-
""",
|
2377
|
-
(ir_id + 1,),
|
2378
|
-
).fetchone()[0]
|
2379
|
-
)
|
2314
|
+
return int(c.execute("SELECT delay FROM ir_file WHERE ? = id", (ir_id + 1,)).fetchone()[0])
|
2380
2315
|
|
2381
2316
|
|
2382
2317
|
def _mixture(db: partial, m_id: int, use_cache: bool = True) -> Mixture:
|
@@ -2400,16 +2335,7 @@ def __mixture(db: partial, m_id: int) -> Mixture:
|
|
2400
2335
|
from .helpers import to_source
|
2401
2336
|
|
2402
2337
|
with db() as c:
|
2403
|
-
mixture = MixtureRecord(
|
2404
|
-
*c.execute(
|
2405
|
-
"""
|
2406
|
-
SELECT *
|
2407
|
-
FROM mixture
|
2408
|
-
WHERE ? = mixture.id
|
2409
|
-
""",
|
2410
|
-
(m_id + 1,),
|
2411
|
-
).fetchone()
|
2412
|
-
)
|
2338
|
+
mixture = MixtureRecord(*c.execute("SELECT * FROM mixture WHERE ? = id", (m_id + 1,)).fetchone())
|
2413
2339
|
|
2414
2340
|
sources: Sources = {}
|
2415
2341
|
for source in c.execute(
|
@@ -2459,14 +2385,7 @@ def __category_truth_configs(db: partial, category: str) -> dict[str, str]:
|
|
2459
2385
|
|
2460
2386
|
truth_configs: dict[str, str] = {}
|
2461
2387
|
with db() as c:
|
2462
|
-
s_ids = c.execute(
|
2463
|
-
"""
|
2464
|
-
SELECT id
|
2465
|
-
FROM source_file
|
2466
|
-
WHERE ? = category
|
2467
|
-
""",
|
2468
|
-
(category,),
|
2469
|
-
).fetchall()
|
2388
|
+
s_ids = c.execute("SELECT id FROM source_file WHERE ? = category", (category,)).fetchall()
|
2470
2389
|
|
2471
2390
|
for s_id in s_ids:
|
2472
2391
|
for truth_config_record in c.execute(
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: sonusai
|
3
|
-
Version: 1.0.
|
3
|
+
Version: 1.0.3
|
4
4
|
Summary: Framework for building deep neural network models for sound, speech, and voice AI
|
5
5
|
Home-page: https://aaware.com
|
6
6
|
License: GPL-3.0-only
|
@@ -36,6 +36,7 @@ Requires-Dist: pyyaml (>=6.0.2,<7.0.0)
|
|
36
36
|
Requires-Dist: requests (>=2.32.3,<3.0.0)
|
37
37
|
Requires-Dist: rich (>=13.9.4,<14.0.0)
|
38
38
|
Requires-Dist: samplerate (>=0.2.1,<0.3.0)
|
39
|
+
Requires-Dist: scikit-learn (>=1.6.1,<2.0.0)
|
39
40
|
Requires-Dist: sh (>=2.2.2,<3.0.0)
|
40
41
|
Requires-Dist: soundfile (>=0.12.1,<0.13.0)
|
41
42
|
Requires-Dist: sox (>=1.5.0,<2.0.0)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
sonusai/__init__.py,sha256=7kXYJuI8EPKezlFD7djImNolS1JMyyltgq_vqlDUCek,3261
|
2
2
|
sonusai/aawscd_probwrite.py,sha256=QZLMQrmPr3OjZ06buyYDwlnk9YPCpyr4KHkBjPsiqjU,3700
|
3
|
-
sonusai/audiofe.py,sha256=
|
3
|
+
sonusai/audiofe.py,sha256=0DNpntK0WpzNZeyHX8_wC-pDtrgvLkJZFPXz-PspdrY,19448
|
4
4
|
sonusai/calc_metric_spenh.py,sha256=0Md6hRFUH9lGnsvoydqne99O7Gi0ieG9vMU_1PnASBg,50019
|
5
5
|
sonusai/config/__init__.py,sha256=NeXdBQiuRKIm77pK9WHaxkdst9-jwhX1IDrHvpZecpI,52
|
6
6
|
sonusai/config/config.py,sha256=nM1W7dQXBWMdMLrgh3o7_cEItztFf1UTW-4faM0hIqY,1692
|
@@ -21,9 +21,9 @@ sonusai/doc/__init__.py,sha256=KyQ26Um0RM8A3GYsb_tbFH64RwpoAw6lja2f_moUWas,33
|
|
21
21
|
sonusai/doc/doc.py,sha256=vyEfiUNd--F14Eel-u1EY4mfvHUXJrGrV3xKKExUiC4,19272
|
22
22
|
sonusai/doc.py,sha256=ZgFSSI56oNDb-yC3xi-RHMClMjryR2VrgGyi3ggX8gM,1098
|
23
23
|
sonusai/genft.py,sha256=jGjtjQQEuPunROkoDOYZ7gdyZEa09EMCVhpHrkBZ7A0,5571
|
24
|
-
sonusai/genmetrics.py,sha256=
|
24
|
+
sonusai/genmetrics.py,sha256=sbcqbjI4YOJd5_Lzor4Re_TK6GUQ5zJuYbhDux8odI0,6184
|
25
25
|
sonusai/genmix.py,sha256=U62GPgejGfnDfRgXUosmnVVWvTV07sg46JQEIew0nPg,5744
|
26
|
-
sonusai/genmixdb.py,sha256
|
26
|
+
sonusai/genmixdb.py,sha256=_YPIwBn_yqbE6Nik0j_-3vT0lO35Jemq_xDsA7zoCi4,11132
|
27
27
|
sonusai/ir_metric.py,sha256=nxS_mARPSZG5Y0G3L8HysOnkPj4v-RGxAxAVBYe-gJI,19600
|
28
28
|
sonusai/lsdb.py,sha256=86t6PpsyardRa6VcSJ-KyU1NiTmlg59VUlcSTptJbn0,5078
|
29
29
|
sonusai/main.py,sha256=72feJv5XEVJE_CQatmNIL1VD9ca-Mo0QNDbXxLrHrbQ,2619
|
@@ -45,21 +45,21 @@ sonusai/metrics/confusion_matrix_summary.py,sha256=lhd8TyHVMC03khX85h_D75XElmawx
|
|
45
45
|
sonusai/metrics/one_hot.py,sha256=aKc-xYd4zWIjbmoQikIcQ6BJB1k-68XKTg8eJCacHTU,13906
|
46
46
|
sonusai/metrics/snr_summary.py,sha256=qKHctpmvGeu2cmjTG7iQPX1lvVUEtEnCIKwUGu6VrEQ,5773
|
47
47
|
sonusai/metrics_summary.py,sha256=qfQ_NAW4ilgyISRHxSuewTK-u_eo4bkjOjLNX-qd1z4,12197
|
48
|
-
sonusai/mixture/__init__.py,sha256=
|
48
|
+
sonusai/mixture/__init__.py,sha256=_vepE2uhAGKHIujPWxfGDeaWHP5yKLf5BjXkU9ZereA,1258
|
49
49
|
sonusai/mixture/audio.py,sha256=JyrVtVPLH3aTXFgyl446f5uVHxlFRa4aBaSPYaMdg80,5814
|
50
50
|
sonusai/mixture/class_balancing.py,sha256=lubicVCzxs4TMh2dZSsuIffkLkk1gmwjmwtrtQ27BVQ,3638
|
51
51
|
sonusai/mixture/config.py,sha256=2_hEndyRXxyBpGzyBFaDT9REYGoK9Q7HQy8vDqPozus,23320
|
52
52
|
sonusai/mixture/constants.py,sha256=Kklzhf5DL30yb3TpqRbvRUhcFrEXJ4s2S3D_nw4ARxM,1498
|
53
53
|
sonusai/mixture/data_io.py,sha256=DV48sFcP2Qp3NBzvcnlptQOXU3aUEcAeLuh3XOtC5jI,5341
|
54
54
|
sonusai/mixture/db_datatypes.py,sha256=VvNtbOgt5WSeSnBoVcNGC5gs_7hX_38pDUPjy5KRbG4,1471
|
55
|
-
sonusai/mixture/effects.py,sha256=
|
55
|
+
sonusai/mixture/effects.py,sha256=ghMO-WiSMQc1CvafD0wkt_DGsM2A6Hi_oZS6j-jeZh8,11784
|
56
56
|
sonusai/mixture/feature.py,sha256=7GJvFhfqeqerfjy9Vq9aKt-cecgYblK0IypNNo5hgwY,2285
|
57
|
-
sonusai/mixture/generation.py,sha256=
|
57
|
+
sonusai/mixture/generation.py,sha256=j19nxSo8bbPS9BtZfWQnMTRtGxoNPFi_tClT3pdeCUM,32433
|
58
58
|
sonusai/mixture/helpers.py,sha256=dmyHwf1C5dZjYOd11kVV16KI33CaM-dU_fyaxOrrKt8,11642
|
59
59
|
sonusai/mixture/ir_delay.py,sha256=aiC23HMWQ08-v5wORgMx1_DOJSdh4kunULqiQ-SGuMo,2026
|
60
60
|
sonusai/mixture/ir_effects.py,sha256=PqiqD4PS42-7kD6ESnsZi2a3tnKCFa4E0xqUujRBvGg,2152
|
61
61
|
sonusai/mixture/log_duration_and_sizes.py,sha256=3ekS27IMKlnxIkQAmprzmBnzHOpRjZh3d7maL2VqWQU,927
|
62
|
-
sonusai/mixture/mixdb.py,sha256=
|
62
|
+
sonusai/mixture/mixdb.py,sha256=77GjuedI8a2l6MvQCrz2gDBIZNvwduOQ0ERA-4dXK28,86099
|
63
63
|
sonusai/mixture/pad_audio.py,sha256=KNxVQAejA0hblLOnMJgLS6lFaeE0n3tWQ5rclaHBnIY,1015
|
64
64
|
sonusai/mixture/resample.py,sha256=jXqH6FrZ0mlhQ07XqPx88TT9elu3HHVLw7Q0a7Lh5M4,221
|
65
65
|
sonusai/mixture/sox_effects.py,sha256=tndS9qrh3eJOTUPrufyWHCt3UqjbPuh81I4Lo4MNmDg,5328
|
@@ -132,7 +132,7 @@ sonusai/utils/tokenized_shell_vars.py,sha256=EDrrAgz5lJ0RBAjLcTJt1MeyjhbNZiqXkym
|
|
132
132
|
sonusai/utils/write_audio.py,sha256=IHzrJoFtFcea_J6wo6QSiojRkgnNOzAEcg-z0rFV7nU,810
|
133
133
|
sonusai/utils/yes_or_no.py,sha256=0h1okjXmDNbJp7rZJFR2V-HFU1GJDm3YFTUVmYExkOU,263
|
134
134
|
sonusai/vars.py,sha256=m8pdgfR4A6A9TCGf_rok6jPAT5BgrEsYXTSISIh1nrI,1163
|
135
|
-
sonusai-1.0.
|
136
|
-
sonusai-1.0.
|
137
|
-
sonusai-1.0.
|
138
|
-
sonusai-1.0.
|
135
|
+
sonusai-1.0.3.dist-info/METADATA,sha256=LvPP2llUQlVVR4SGlYeM5LaGzbKQkg4U3KHPLcrEVLk,2652
|
136
|
+
sonusai-1.0.3.dist-info/WHEEL,sha256=RaoafKOydTQ7I_I3JTrPCg6kUmTgtm4BornzOqyEfJ8,88
|
137
|
+
sonusai-1.0.3.dist-info/entry_points.txt,sha256=zMNjEphEPO6B3cD1GNpit7z-yA9tUU5-j3W2v-UWstU,92
|
138
|
+
sonusai-1.0.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|