sonusai 1.0.3__py3-none-any.whl → 1.0.5__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.
@@ -130,6 +130,7 @@ def initialize_db(location: str, test: bool = False) -> None:
130
130
  snr_gain FLOAT NOT NULL,
131
131
  snr_random BOOLEAN NOT NULL,
132
132
  start INTEGER NOT NULL,
133
+ UNIQUE(effects, file_id, pre_tempo, repeat, snr, snr_gain, snr_random, start),
133
134
  FOREIGN KEY(file_id) REFERENCES source_file (id))
134
135
  """)
135
136
 
@@ -436,27 +437,7 @@ def populate_mixture_table(
436
437
 
437
438
  # Populate source table
438
439
  if logging:
439
- logger.info("Populating source table")
440
- sources: list[tuple[str, int, float, bool, float, float, bool, int]] = []
441
- for mixture in mixtures:
442
- for source in mixture.all_sources.values():
443
- entry = from_source(source)
444
- if entry not in sources:
445
- sources.append(entry)
446
- for source in track(sources, disable=not show_progress):
447
- con.execute(
448
- """
449
- INSERT INTO source (effects, file_id, pre_tempo, repeat, snr, snr_gain, snr_random, start)
450
- VALUES (?, ?, ?, ?, ?, ?, ?, ?)
451
- """,
452
- source,
453
- )
454
-
455
- con.commit()
456
-
457
- # Populate mixture table
458
- if logging:
459
- logger.info("Populating mixture table")
440
+ logger.info("Populating mixture and source tables")
460
441
  for mixture in track(mixtures, disable=not show_progress):
461
442
  m_id = int(mixture.name) + 1
462
443
  con.execute(
@@ -468,6 +449,14 @@ def populate_mixture_table(
468
449
  )
469
450
 
470
451
  for source in mixture.all_sources.values():
452
+ con.execute(
453
+ """
454
+ INSERT OR IGNORE INTO source (effects, file_id, pre_tempo, repeat, snr, snr_gain, snr_random, start)
455
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?)
456
+ """,
457
+ from_source(source),
458
+ )
459
+
471
460
  source_id = con.execute(
472
461
  """
473
462
  SELECT id
@@ -486,7 +475,7 @@ def populate_mixture_table(
486
475
  con.execute("INSERT INTO mixture_source (mixture_id, source_id) VALUES (?, ?)", (m_id, source_id))
487
476
 
488
477
  if logging:
489
- logger.info("Closing mixture table")
478
+ logger.info("Closing mixture and source tables")
490
479
  con.commit()
491
480
  con.close()
492
481
 
@@ -577,7 +566,7 @@ def _initialize_mixture_gains(mixdb: MixtureDatabase, mixture: Mixture, sources_
577
566
  # Special case for zeroing out noise data
578
567
  mixture.all_sources[category].snr_gain = 0
579
568
  elif category != "primary":
580
- if sources_energy["primary"] == 0:
569
+ if sources_energy["primary"] == 0 or sources_energy[category] == 0:
581
570
  # Avoid divide-by-zero
582
571
  mixture.all_sources[category].snr_gain = 1
583
572
  else:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: sonusai
3
- Version: 1.0.3
3
+ Version: 1.0.5
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
@@ -54,7 +54,7 @@ sonusai/mixture/data_io.py,sha256=DV48sFcP2Qp3NBzvcnlptQOXU3aUEcAeLuh3XOtC5jI,53
54
54
  sonusai/mixture/db_datatypes.py,sha256=VvNtbOgt5WSeSnBoVcNGC5gs_7hX_38pDUPjy5KRbG4,1471
55
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=j19nxSo8bbPS9BtZfWQnMTRtGxoNPFi_tClT3pdeCUM,32433
57
+ sonusai/mixture/generation.py,sha256=rsn2BO95UoXR_tX1IjcwCeYqVPzkohxQSTt5FsMKyhg,32179
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
@@ -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.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,,
135
+ sonusai-1.0.5.dist-info/METADATA,sha256=Q1nZTGYPe4eF4Zs8HEQWp5dKsINA8_CmHUQxfT57uJM,2652
136
+ sonusai-1.0.5.dist-info/WHEEL,sha256=RaoafKOydTQ7I_I3JTrPCg6kUmTgtm4BornzOqyEfJ8,88
137
+ sonusai-1.0.5.dist-info/entry_points.txt,sha256=zMNjEphEPO6B3cD1GNpit7z-yA9tUU5-j3W2v-UWstU,92
138
+ sonusai-1.0.5.dist-info/RECORD,,