pyFDN 0.1.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.
Files changed (72) hide show
  1. pyFDN/__init__.py +380 -0
  2. pyFDN/audio/example_process_fdn_output.wav +0 -0
  3. pyFDN/audio/s3_r4_o.wav +0 -0
  4. pyFDN/audio/synth_dry.wav +0 -0
  5. pyFDN/auxiliary/__init__.py +59 -0
  6. pyFDN/auxiliary/acoustics.py +545 -0
  7. pyFDN/auxiliary/allpass.py +311 -0
  8. pyFDN/auxiliary/audio.py +54 -0
  9. pyFDN/auxiliary/coupled_rooms.py +193 -0
  10. pyFDN/auxiliary/delay.py +132 -0
  11. pyFDN/auxiliary/flamo.py +648 -0
  12. pyFDN/auxiliary/flamo_graph.py +754 -0
  13. pyFDN/auxiliary/math.py +515 -0
  14. pyFDN/auxiliary/plot.py +1352 -0
  15. pyFDN/auxiliary/poles.py +104 -0
  16. pyFDN/auxiliary/tiny_rotation_matrix.py +109 -0
  17. pyFDN/auxiliary/utils.py +296 -0
  18. pyFDN/dsp/__init__.py +3 -0
  19. pyFDN/dsp/dfilt_matrix.py +53 -0
  20. pyFDN/dsp/feedback_delay.py +47 -0
  21. pyFDN/dsp/sos_filter_bank.py +57 -0
  22. pyFDN/dsp/time_varying_matrix.py +144 -0
  23. pyFDN/generate/SDN.py +718 -0
  24. pyFDN/generate/allpass_FDN/__init__.py +11 -0
  25. pyFDN/generate/allpass_FDN/allpass_completion.py +630 -0
  26. pyFDN/generate/allpass_FDN/homogeneous_allpass_fdn.py +116 -0
  27. pyFDN/generate/allpass_FDN/rand_admissible_homogeneous_allpass.py +57 -0
  28. pyFDN/generate/allpass_in_fdn.py +78 -0
  29. pyFDN/generate/anderson_matrix.py +46 -0
  30. pyFDN/generate/complete_orthogonal.py +56 -0
  31. pyFDN/generate/construct_cascaded_paraunitary_matrix.py +58 -0
  32. pyFDN/generate/construct_paraunitary_from_elementals.py +52 -0
  33. pyFDN/generate/construct_velvet_feedback_matrix.py +17 -0
  34. pyFDN/generate/degree_one_lossless.py +31 -0
  35. pyFDN/generate/fdn_matrix_gallery.py +560 -0
  36. pyFDN/generate/householder_matrix.py +24 -0
  37. pyFDN/generate/is_almost_zero.py +18 -0
  38. pyFDN/generate/nearest_orthogonal.py +24 -0
  39. pyFDN/generate/nearest_sign_agnostic_orthogonal.py +82 -0
  40. pyFDN/generate/random_matrix_shift.py +42 -0
  41. pyFDN/generate/random_orthogonal.py +10 -0
  42. pyFDN/generate/sample_delay_lengths.py +149 -0
  43. pyFDN/generate/schroeder_reverberator.py +85 -0
  44. pyFDN/generate/shift_matrix.py +45 -0
  45. pyFDN/generate/shift_matrix_distribute.py +24 -0
  46. pyFDN/graphicEQ/__init__.py +17 -0
  47. pyFDN/graphicEQ/absorption_geq.py +54 -0
  48. pyFDN/graphicEQ/bandpass_filter.py +34 -0
  49. pyFDN/graphicEQ/design_geq.py +73 -0
  50. pyFDN/graphicEQ/graphic_eq.py +74 -0
  51. pyFDN/graphicEQ/probe_sos.py +52 -0
  52. pyFDN/graphicEQ/shelving_filter.py +55 -0
  53. pyFDN/process.py +106 -0
  54. pyFDN/pyFDN.py +1 -0
  55. pyFDN/train/__init__.py +29 -0
  56. pyFDN/train/build.py +321 -0
  57. pyFDN/train/engine.py +186 -0
  58. pyFDN/train/objectives.py +207 -0
  59. pyFDN/translate/dss_to_flamo.py +215 -0
  60. pyFDN/translate/dss_to_impz.py +48 -0
  61. pyFDN/translate/dss_to_pr.py +222 -0
  62. pyFDN/translate/dss_to_ss.py +101 -0
  63. pyFDN/translate/dss_to_tf.py +92 -0
  64. pyFDN/translate/flamo_to_pr.py +893 -0
  65. pyFDN/translate/impz_to_res.py +53 -0
  66. pyFDN/translate/mtf_to_impz.py +51 -0
  67. pyFDN/translate/pr_to_impz.py +70 -0
  68. pyfdn-0.1.0.dist-info/METADATA +158 -0
  69. pyfdn-0.1.0.dist-info/RECORD +72 -0
  70. pyfdn-0.1.0.dist-info/WHEEL +5 -0
  71. pyfdn-0.1.0.dist-info/licenses/LICENSE +22 -0
  72. pyfdn-0.1.0.dist-info/top_level.txt +1 -0
pyFDN/__init__.py ADDED
@@ -0,0 +1,380 @@
1
+ """Top-level package for pyFDN."""
2
+
3
+ from importlib import import_module
4
+
5
+ __author__ = "Facundo Franchino"
6
+ __version__ = "0.1.0"
7
+
8
+ __all__ = [
9
+ # dsp
10
+ "FeedbackDelay",
11
+ "FIRMatrixFilter",
12
+ "SOSFilterBank",
13
+ # acoustics
14
+ "absorption_filters",
15
+ "echo_density",
16
+ "estimate_initial_level_bands",
17
+ "estimate_rt_bands",
18
+ "absorption_to_rt",
19
+ "edc",
20
+ "first_order_absorption",
21
+ "first_order_shelving_eq",
22
+ "one_pole_absorption",
23
+ "rt_to_gain_per_sample",
24
+ "rt_to_slope",
25
+ "slope_to_rt",
26
+ "sos_gain_per_sample_curves",
27
+ # delay utilities
28
+ "matrix_delay_approximation",
29
+ "mgrpdelay",
30
+ "ms_to_smp",
31
+ "flamo_delay_feedback_matrix",
32
+ "swap_flamo_recursion_paths",
33
+ "flamo_time_response",
34
+ "flamo_freq_response",
35
+ "flamo_process",
36
+ "load_audio",
37
+ # matrix generators
38
+ "allpass_in_fdn",
39
+ "anderson_matrix",
40
+ "complete_orthogonal",
41
+ "construct_cascaded_paraunitary_matrix",
42
+ "construct_paraunitary_from_elementals",
43
+ "construct_velvet_feedback_matrix",
44
+ "degree_one_lossless",
45
+ "fdn_matrix_gallery",
46
+ "fdn_build_gallery",
47
+ "fdn_system_gallery",
48
+ "filter_matrix_gallery",
49
+ "FDNBuild",
50
+ "FDNSystem",
51
+ "householder_matrix",
52
+ "is_almost_zero",
53
+ "nearest_orthogonal",
54
+ "nearest_sign_agnostic_orthogonal",
55
+ "random_matrix_shift",
56
+ "random_orthogonal",
57
+ "rotation_matrix_from_angles",
58
+ "sample_delay_lengths",
59
+ "schroeder_reverberator",
60
+ "shift_matrix",
61
+ "shift_matrix_distribute",
62
+ "tiny_rotation_matrix",
63
+ # graphicEQ
64
+ "absorption_geq",
65
+ "bandpass_filter",
66
+ "design_geq",
67
+ "graphic_eq",
68
+ "probe_sos",
69
+ "shelving_filter",
70
+ # polynomial and matrix maths
71
+ "adj_poly",
72
+ "adjugate",
73
+ "det_polynomial",
74
+ "general_char_poly",
75
+ "interpolate_orthogonal",
76
+ "is_orthogonal",
77
+ "is_unilossless",
78
+ "loop_tf",
79
+ "matrix_convolution",
80
+ "matrix_polyder",
81
+ "matrix_polyval",
82
+ "matrix_sqrt",
83
+ "negpolyder",
84
+ "outer_sum_approximation",
85
+ "poly_degree",
86
+ "polyder_rational",
87
+ "polydiag",
88
+ # general utilities
89
+ "db_to_lin",
90
+ "db_to_sq",
91
+ "ensure_3d",
92
+ "hertz_to_unit",
93
+ "hertz_to_rad",
94
+ "rad_to_hertz",
95
+ "is_bounding_curve",
96
+ "last_nonzero_indices",
97
+ "lin_to_db",
98
+ "max_corr",
99
+ "sq_to_db",
100
+ "mulaw_decode",
101
+ "mulaw_encode",
102
+ "peak_normalize",
103
+ "pole_boundaries",
104
+ "skew",
105
+ # state-space translators
106
+ "build_to_flamo",
107
+ "dss_to_flamo",
108
+ "dss_to_impz",
109
+ "dss_to_pr",
110
+ "flamo_to_pr",
111
+ "flamo_decompose_for_pr",
112
+ "flamo_extract_pr_decomposition",
113
+ "FlamoDecompositionForPR",
114
+ "dss_to_ss",
115
+ "dss_to_tf",
116
+ "impz_to_res",
117
+ "mtf_to_impz",
118
+ "pr_to_impz",
119
+ # fdn processing
120
+ "process_fdn",
121
+ # training
122
+ "build_fdn",
123
+ "trainable_from_build",
124
+ "with_decay",
125
+ "Trainable",
126
+ "train_fdn",
127
+ "TrainLog",
128
+ # plotting
129
+ "animate",
130
+ "plot_db_per_sample",
131
+ "plot_edc",
132
+ "plot_fdn_parameter",
133
+ "plot_FDN_build",
134
+ "plot_impulse_response",
135
+ "plot_impulse_response_matrix",
136
+ "plot_matrix",
137
+ "plot_matrix_grid",
138
+ "plot_system_matrix",
139
+ "plot_spectrogram",
140
+ "downsample_minmax",
141
+ "downsample_plotly_trace",
142
+ "downsampled_scatter",
143
+ # FLAMO graph
144
+ "flamo_model_to_nodes",
145
+ "flamo_nodes_flat",
146
+ "plot_flamo_graph",
147
+ "extract_build",
148
+ # SDN (scattering delay network)
149
+ "SDN",
150
+ # allpass FDN
151
+ "allpass",
152
+ "allpass_completion",
153
+ "apply_diagonal_similarity",
154
+ "block_matrix",
155
+ "check_completion",
156
+ "complete_fdn",
157
+ "complete_full_mimo_halmos",
158
+ "complete_general_mimo_svd",
159
+ "diagonal_similarity_from_abs2_lyapunov",
160
+ "diag_inv_sqrt",
161
+ "diag_sqrt",
162
+ "eig_sqrt_psd",
163
+ "hermitize",
164
+ "homogeneous_allpass_fdn",
165
+ "map_back_from_similarity",
166
+ "rand_admissible_homogeneous_allpass",
167
+ "orth_error",
168
+ "sqrtm_psd",
169
+ "poletti_allpass",
170
+ "series_allpass",
171
+ "nested_allpass",
172
+ "is_uniallpass",
173
+ "is_allpass",
174
+ "is_paraunitary",
175
+ ]
176
+
177
+ # acoustics and absorption
178
+ from .auxiliary.acoustics import (
179
+ absorption_filters,
180
+ absorption_to_rt,
181
+ echo_density,
182
+ edc,
183
+ estimate_initial_level_bands,
184
+ estimate_rt_bands,
185
+ first_order_absorption,
186
+ first_order_shelving_eq,
187
+ one_pole_absorption,
188
+ rt_to_gain_per_sample,
189
+ rt_to_slope,
190
+ slope_to_rt,
191
+ sos_gain_per_sample_curves,
192
+ )
193
+ from .auxiliary.allpass import (
194
+ is_allpass,
195
+ is_paraunitary,
196
+ is_uniallpass,
197
+ nested_allpass,
198
+ poletti_allpass,
199
+ series_allpass,
200
+ )
201
+ from .auxiliary.audio import load_audio
202
+
203
+ # delay utilities
204
+ from .auxiliary.delay import (
205
+ flamo_delay_feedback_matrix,
206
+ matrix_delay_approximation,
207
+ mgrpdelay,
208
+ ms_to_smp,
209
+ swap_flamo_recursion_paths,
210
+ )
211
+ from .auxiliary.flamo import flamo_freq_response, flamo_process, flamo_time_response
212
+ from .auxiliary.flamo_graph import (
213
+ extract_build,
214
+ flamo_model_to_nodes,
215
+ flamo_nodes_flat,
216
+ plot_flamo_graph,
217
+ )
218
+
219
+ # polynomial and matrix maths
220
+ from .auxiliary.math import (
221
+ adj_poly,
222
+ adjugate,
223
+ det_polynomial,
224
+ general_char_poly,
225
+ interpolate_orthogonal,
226
+ is_orthogonal,
227
+ is_unilossless,
228
+ loop_tf,
229
+ matrix_convolution,
230
+ matrix_polyder,
231
+ matrix_polyval,
232
+ matrix_sqrt,
233
+ negpolyder,
234
+ outer_sum_approximation,
235
+ poly_degree,
236
+ polyder_rational,
237
+ polydiag,
238
+ )
239
+
240
+ # plotting
241
+ from .auxiliary.plot import (
242
+ animate,
243
+ downsample_minmax,
244
+ downsample_plotly_trace,
245
+ downsampled_scatter,
246
+ plot_db_per_sample,
247
+ plot_edc,
248
+ plot_FDN_build,
249
+ plot_fdn_parameter,
250
+ plot_impulse_response,
251
+ plot_impulse_response_matrix,
252
+ plot_matrix,
253
+ plot_matrix_grid,
254
+ plot_spectrogram,
255
+ plot_system_matrix,
256
+ )
257
+
258
+ # tiny rotation matrix
259
+ from .auxiliary.tiny_rotation_matrix import (
260
+ rotation_matrix_from_angles,
261
+ tiny_rotation_matrix,
262
+ )
263
+
264
+ # general utilities
265
+ from .auxiliary.utils import (
266
+ db_to_lin,
267
+ db_to_sq,
268
+ ensure_3d,
269
+ hertz_to_rad,
270
+ hertz_to_unit,
271
+ is_bounding_curve,
272
+ last_nonzero_indices,
273
+ lin_to_db,
274
+ max_corr,
275
+ mulaw_decode,
276
+ mulaw_encode,
277
+ peak_normalize,
278
+ pole_boundaries,
279
+ rad_to_hertz,
280
+ skew,
281
+ sq_to_db,
282
+ )
283
+
284
+ # dsp components
285
+ from .dsp.dfilt_matrix import FIRMatrixFilter
286
+ from .dsp.feedback_delay import FeedbackDelay
287
+ from .dsp.sos_filter_bank import SOSFilterBank
288
+ from .generate.allpass_FDN import allpass_completion
289
+ from .generate.allpass_FDN.allpass_completion import (
290
+ apply_diagonal_similarity,
291
+ block_matrix,
292
+ check_completion,
293
+ complete_fdn,
294
+ complete_full_mimo_halmos,
295
+ complete_general_mimo_svd,
296
+ diag_inv_sqrt,
297
+ diag_sqrt,
298
+ diagonal_similarity_from_abs2_lyapunov,
299
+ eig_sqrt_psd,
300
+ hermitize,
301
+ map_back_from_similarity,
302
+ orth_error,
303
+ sqrtm_psd,
304
+ )
305
+ from .generate.allpass_FDN.homogeneous_allpass_fdn import homogeneous_allpass_fdn
306
+ from .generate.allpass_FDN.rand_admissible_homogeneous_allpass import (
307
+ rand_admissible_homogeneous_allpass,
308
+ )
309
+ from .generate.allpass_in_fdn import allpass_in_fdn
310
+ from .generate.anderson_matrix import anderson_matrix
311
+ from .generate.complete_orthogonal import complete_orthogonal
312
+ from .generate.construct_cascaded_paraunitary_matrix import (
313
+ construct_cascaded_paraunitary_matrix,
314
+ )
315
+ from .generate.construct_paraunitary_from_elementals import (
316
+ construct_paraunitary_from_elementals,
317
+ )
318
+ from .generate.construct_velvet_feedback_matrix import construct_velvet_feedback_matrix
319
+ from .generate.degree_one_lossless import degree_one_lossless
320
+ from .generate.fdn_matrix_gallery import (
321
+ FDNBuild,
322
+ FDNSystem,
323
+ fdn_build_gallery,
324
+ fdn_matrix_gallery,
325
+ fdn_system_gallery,
326
+ filter_matrix_gallery,
327
+ )
328
+ from .generate.householder_matrix import householder_matrix
329
+ from .generate.is_almost_zero import is_almost_zero
330
+ from .generate.nearest_orthogonal import nearest_orthogonal
331
+ from .generate.nearest_sign_agnostic_orthogonal import nearest_sign_agnostic_orthogonal
332
+ from .generate.random_matrix_shift import random_matrix_shift
333
+
334
+ # matrix generators
335
+ from .generate.random_orthogonal import random_orthogonal
336
+ from .generate.sample_delay_lengths import sample_delay_lengths
337
+ from .generate.schroeder_reverberator import schroeder_reverberator
338
+ from .generate.SDN import SDN
339
+ from .generate.shift_matrix import shift_matrix
340
+ from .generate.shift_matrix_distribute import shift_matrix_distribute
341
+ from .graphicEQ import (
342
+ absorption_geq,
343
+ bandpass_filter,
344
+ design_geq,
345
+ graphic_eq,
346
+ probe_sos,
347
+ shelving_filter,
348
+ )
349
+
350
+ # fdn processing
351
+ from .process import process_fdn
352
+
353
+ # training (torch/flamo are imported lazily inside these)
354
+ from .train import (
355
+ Trainable,
356
+ TrainLog,
357
+ build_fdn,
358
+ train_fdn,
359
+ trainable_from_build,
360
+ with_decay,
361
+ )
362
+
363
+ # state-space translators
364
+ from .translate.dss_to_flamo import build_to_flamo, dss_to_flamo
365
+ from .translate.dss_to_impz import dss_to_impz
366
+ from .translate.dss_to_pr import dss_to_pr
367
+ from .translate.dss_to_ss import dss_to_ss
368
+ from .translate.dss_to_tf import dss_to_tf
369
+ from .translate.flamo_to_pr import (
370
+ FlamoDecompositionForPR,
371
+ flamo_decompose_for_pr,
372
+ flamo_extract_pr_decomposition,
373
+ flamo_to_pr,
374
+ )
375
+ from .translate.impz_to_res import impz_to_res
376
+ from .translate.mtf_to_impz import mtf_to_impz
377
+ from .translate.pr_to_impz import pr_to_impz
378
+
379
+ # Expose allpass submodule for pyFDN.allpass.is_uniallpass etc.
380
+ allpass = import_module(".auxiliary.allpass", __name__)
Binary file
Binary file
@@ -0,0 +1,59 @@
1
+ """Auxiliary modules (utils, acoustics, allpass, flamo wrappers, etc.)."""
2
+
3
+ from .allpass import (
4
+ is_allpass,
5
+ is_paraunitary,
6
+ is_uniallpass,
7
+ nested_allpass,
8
+ poletti_allpass,
9
+ series_allpass,
10
+ )
11
+ from .audio import load_audio
12
+ from .flamo import (
13
+ assemble_fdn_core,
14
+ delay_module,
15
+ fir_matrix_module,
16
+ flamo_freq_response,
17
+ flamo_process,
18
+ flamo_time_response,
19
+ gain_module,
20
+ matrix_module,
21
+ output_layer,
22
+ sos_filter_module,
23
+ wrap_fdn_shell,
24
+ )
25
+ from .flamo_graph import (
26
+ extract_build,
27
+ flamo_model_to_nodes,
28
+ flamo_nodes_flat,
29
+ plot_flamo_graph,
30
+ )
31
+ from .poles import reduce_conjugate_pairs
32
+ from .utils import skew
33
+
34
+ __all__ = [
35
+ "skew",
36
+ "gain_module",
37
+ "delay_module",
38
+ "fir_matrix_module",
39
+ "sos_filter_module",
40
+ "matrix_module",
41
+ "assemble_fdn_core",
42
+ "wrap_fdn_shell",
43
+ "output_layer",
44
+ "flamo_time_response",
45
+ "flamo_freq_response",
46
+ "flamo_process",
47
+ "load_audio",
48
+ "poletti_allpass",
49
+ "series_allpass",
50
+ "nested_allpass",
51
+ "is_uniallpass",
52
+ "is_allpass",
53
+ "is_paraunitary",
54
+ "flamo_model_to_nodes",
55
+ "extract_build",
56
+ "flamo_nodes_flat",
57
+ "plot_flamo_graph",
58
+ "reduce_conjugate_pairs",
59
+ ]