flamo 0.2.9__py3-none-any.whl → 0.2.10__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.
flamo/processor/dsp.py CHANGED
@@ -3520,3 +3520,80 @@ class GainDelay(DSP):
3520
3520
  delay_samples = delay_samples.to(gain.real.dtype)
3521
3521
  phase = torch.einsum("fo, omn -> fmn", self.omega, delay_samples.unsqueeze(0))
3522
3522
  return gain.unsqueeze(0) * (self.gamma ** delay_samples) * torch.exp(-1j * phase)
3523
+
3524
+
3525
+ class parallelGainDelay(GainDelay):
3526
+ """
3527
+ Parallel counterpart of the :class:`GainDelay` class.
3528
+ For information about **attributes** and **methods** see :class:`GainDelay`.
3529
+
3530
+ Shape:
3531
+ - input: :math:`(B, M, N, ...)`
3532
+ - param: :math:`(2, N)`
3533
+ - output: :math:`(B, M, N, ...)`
3534
+
3535
+ where :math:`B` is the batch size, :math:`M` is the number of frequency bins,
3536
+ and :math:`N` is the number of input channels.
3537
+ Ellipsis :math:`(...)` represents additional dimensions.
3538
+ """
3539
+
3540
+ def __init__(
3541
+ self,
3542
+ size: tuple = (1,),
3543
+ max_len: int = 2000,
3544
+ isint: bool = False,
3545
+ unit: int = 100,
3546
+ nfft: int = 2**11,
3547
+ fs: int = 48000,
3548
+ map_gain: Optional[callable] = None,
3549
+ map_delay: Optional[callable] = None,
3550
+ requires_grad: bool = False,
3551
+ alias_decay_db: float = 0.0,
3552
+ device: Optional[str] = None,
3553
+ dtype: torch.dtype = torch.float32,
3554
+ ):
3555
+ super().__init__(
3556
+ size=size,
3557
+ max_len=max_len,
3558
+ isint=isint,
3559
+ unit=unit,
3560
+ nfft=nfft,
3561
+ fs=fs,
3562
+ map_gain=map_gain,
3563
+ map_delay=map_delay,
3564
+ requires_grad=requires_grad,
3565
+ alias_decay_db=alias_decay_db,
3566
+ device=device,
3567
+ dtype=dtype,
3568
+ )
3569
+
3570
+ def check_param_shape(self):
3571
+ """
3572
+ Checks if the shape of the gain-delay parameters is valid.
3573
+ """
3574
+ assert (
3575
+ len(self.size) == 2 and self.size[0] == 2
3576
+ ), "parallelGainDelay parameters must have shape (2, N), for MIMO use GainDelay module."
3577
+
3578
+ def get_freq_convolve(self):
3579
+ """
3580
+ Computes the frequency convolution function for parallel gain-delay processing.
3581
+ """
3582
+ self.freq_convolve = lambda x, param: torch.einsum(
3583
+ "fn,bfn...->bfn...", self.freq_response(param), x
3584
+ )
3585
+
3586
+ def get_io(self):
3587
+ """
3588
+ Computes the number of input and output channels based on the size parameter.
3589
+ """
3590
+ self.input_channels = self.size[-1]
3591
+ self.output_channels = self.size[-1]
3592
+
3593
+ def _combine_gain_delay(self, gain: torch.Tensor, delay_samples: torch.Tensor):
3594
+ """
3595
+ Combines gain and delay for parallel processing (element-wise).
3596
+ """
3597
+ delay_samples = delay_samples.to(gain.real.dtype)
3598
+ phase = torch.einsum("fo, on -> fn", self.omega, delay_samples.unsqueeze(0))
3599
+ return gain.unsqueeze(0) * (self.gamma ** delay_samples) * torch.exp(-1j * phase)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flamo
3
- Version: 0.2.9
3
+ Version: 0.2.10
4
4
  Summary: An Open-Source Library for Frequency-Domain Differentiable Audio Processing
5
5
  Project-URL: Homepage, https://github.com/gdalsanto/flamo
6
6
  Project-URL: Issues, https://github.com/gdalsanto/flamo/issues
@@ -50,7 +50,7 @@ Description-Content-Type: text/markdown
50
50
 
51
51
  Open-source library for frequency-domain differentiable audio processing.
52
52
 
53
- It contains differentiable implementation of common LTI audio systems modules with learnable parameters.
53
+ It contains differentiable implementation of common LTI audio system modules with learnable parameters.
54
54
 
55
55
  ---
56
56
 
@@ -58,7 +58,7 @@ It contains differentiable implementation of common LTI audio systems modules wi
58
58
 
59
59
  Available differentiable audio signal processors - in `flamo.processor.dsp`:
60
60
  - **Gains** : Gains, Matrices, Householder Matrices
61
- - **Filters** : Biquads, State Variable Filters (SVF), Graphic Equalizers (GEQ), Parametric Equiliers (PEQ - not released yet)
61
+ - **Filters** : Biquads, State Variable Filters (SVF), Graphic Equalizers (GEQ), Parametric Equalizers (PEQ - not released yet)
62
62
  - **Delays** : Integer Delays, Fractional Delays
63
63
 
64
64
  Transforms - in `flamo.processor.dsp`:
@@ -77,7 +77,7 @@ Optimization - in `flamo.optimize`:
77
77
  ---
78
78
 
79
79
  ### 🛠️ Installation
80
- To install it via pip, on a new python virtual environment `flamo-env`
80
+ To install it via pip, on a new Python virtual environment `flamo-env`
81
81
  ```shell
82
82
  python3.10 -m venv .flamo-env
83
83
  source .flamo-env/bin/activate
@@ -91,7 +91,7 @@ pip install flamo
91
91
  conda install -c conda-forge libsndfile
92
92
  ```
93
93
 
94
- For local installation: clone and install dependencies on a new pyton virtual environment `flamo-env`
94
+ For local installation: clone and install dependencies on a new Python virtual environment `flamo-env`
95
95
  ```shell
96
96
  git clone https://github.com/gdalsanto/flamo
97
97
  cd flamo
@@ -160,7 +160,7 @@ model = system.Shell(core=filt, input_layer=input_layer, output_layer=output_lay
160
160
  estimation_init = model.get_freq_response()
161
161
  ````
162
162
 
163
- Set up optimization framework and launch it. The `Trainer` class is used to contain the model, training parameters, and training/valid steps in one class.
163
+ Set up the optimization framework and launch it. The `Trainer` class is used to contain the model, training parameters, and training/valid steps in one class.
164
164
 
165
165
  ```python
166
166
  input = signal_gallery(1, n_samples=nfft, n=in_ch, signal_type='impulse', fs=fs)
@@ -16,9 +16,9 @@ flamo/optimize/surface.py,sha256=sWy1ImwxUh_QLoY6S68LXBa82_HdWJGplFg2ObtpNGc,266
16
16
  flamo/optimize/trainer.py,sha256=LITPVS87mI6bnq4J6GIXqGb4wW7TKWVXeCu4UQ-csxM,12155
17
17
  flamo/optimize/utils.py,sha256=R5-KoZagRho3eykY88pC3UB2mc5SsE4Yv9X-ogskXdA,1610
18
18
  flamo/processor/__init__.py,sha256=paGdxGVZgA2VAs0tBwRd0bobzGxeyK79DS7ZGO8drkI,41
19
- flamo/processor/dsp.py,sha256=Znp_9qjHRb7V0DBaqPWxa9oOlU84CVTjy6h3DcAh-TU,144811
19
+ flamo/processor/dsp.py,sha256=N9IZNO7taV9zwx67g1rVoQEedF4EVHXqGp23Z0BqohA,147358
20
20
  flamo/processor/system.py,sha256=Hct-o6IgF5NQ2xYbX-1j3st94hMoM8dOgAzle2gjDqU,43145
21
- flamo-0.2.9.dist-info/METADATA,sha256=qS-4mXx4gdV_e4xtUIuQ3oGKknKqHtPXLJZL8MCeLpg,7825
22
- flamo-0.2.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
23
- flamo-0.2.9.dist-info/licenses/LICENSE,sha256=smMocRH7xdPT5RvFNqSLtbSNzohXJM5G_rX1Qaej6vg,1120
24
- flamo-0.2.9.dist-info/RECORD,,
21
+ flamo-0.2.10.dist-info/METADATA,sha256=E3OE6I1j_xJH8IM-BGZZhkzPfu5beXI2jpYQDz98Cko,7831
22
+ flamo-0.2.10.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
23
+ flamo-0.2.10.dist-info/licenses/LICENSE,sha256=smMocRH7xdPT5RvFNqSLtbSNzohXJM5G_rX1Qaej6vg,1120
24
+ flamo-0.2.10.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.27.0
2
+ Generator: hatchling 1.28.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any