hum 1.0.7__tar.gz → 1.0.8__tar.gz
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.
- {hum-1.0.7 → hum-1.0.8}/PKG-INFO +1 -1
- {hum-1.0.7 → hum-1.0.8}/hum/extra_util.py +8 -5
- {hum-1.0.7 → hum-1.0.8}/hum/pyo_util.py +10 -0
- {hum-1.0.7 → hum-1.0.8}/hum/util.py +33 -8
- {hum-1.0.7 → hum-1.0.8}/hum.egg-info/PKG-INFO +1 -1
- {hum-1.0.7 → hum-1.0.8}/setup.cfg +1 -1
- {hum-1.0.7 → hum-1.0.8}/LICENSE +0 -0
- {hum-1.0.7 → hum-1.0.8}/README.md +0 -0
- {hum-1.0.7 → hum-1.0.8}/hum/__init__.py +0 -0
- {hum-1.0.7 → hum-1.0.8}/hum/examples/__init__.py +0 -0
- {hum-1.0.7 → hum-1.0.8}/hum/examples/keyboard_control.py +0 -0
- {hum-1.0.7 → hum-1.0.8}/hum/examples/pyo_util_examples.py +0 -0
- {hum-1.0.7 → hum-1.0.8}/hum/pyo_synths.py +0 -0
- {hum-1.0.7 → hum-1.0.8}/hum/pyo_util_examples.py +0 -0
- {hum-1.0.7 → hum-1.0.8}/hum/scrap/__init__.py +0 -0
- {hum-1.0.7 → hum-1.0.8}/hum/scrap/belangeo_Degradation.py +0 -0
- {hum-1.0.7 → hum-1.0.8}/hum/synth_funcs.py +0 -0
- {hum-1.0.7 → hum-1.0.8}/hum/utils/__init__.py +0 -0
- {hum-1.0.7 → hum-1.0.8}/hum/utils/date_ticks.py +0 -0
- {hum-1.0.7 → hum-1.0.8}/hum/utils/plotting.py +0 -0
- {hum-1.0.7 → hum-1.0.8}/hum.egg-info/SOURCES.txt +0 -0
- {hum-1.0.7 → hum-1.0.8}/hum.egg-info/dependency_links.txt +0 -0
- {hum-1.0.7 → hum-1.0.8}/hum.egg-info/not-zip-safe +0 -0
- {hum-1.0.7 → hum-1.0.8}/hum.egg-info/requires.txt +0 -0
- {hum-1.0.7 → hum-1.0.8}/hum.egg-info/top_level.txt +0 -0
- {hum-1.0.7 → hum-1.0.8}/setup.py +0 -0
{hum-1.0.7 → hum-1.0.8}/PKG-INFO
RENAMED
|
@@ -17,11 +17,14 @@ def estimate_chunk_frequency(chk: Iterable, sr: int):
|
|
|
17
17
|
# Find peaks in the FFT result
|
|
18
18
|
peaks, _ = find_peaks(np.abs(yf[: N // 2]), height=0)
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
if len(peaks) > 0:
|
|
21
|
+
# Get the frequencies of the peaks
|
|
22
|
+
peak_freqs = xf[peaks]
|
|
23
|
+
|
|
24
|
+
# Return the frequency with the highest amplitude
|
|
25
|
+
return peak_freqs[np.argmax(np.abs(yf[peaks]))]
|
|
26
|
+
else:
|
|
27
|
+
return None
|
|
25
28
|
|
|
26
29
|
|
|
27
30
|
def estimate_frequencies(wf: Iterable, sr: int, chunker: int | Callable):
|
|
@@ -770,7 +770,9 @@ class Synth(MutableMapping):
|
|
|
770
770
|
|
|
771
771
|
for k, v in updates.items():
|
|
772
772
|
if self._has_value_trans and k in self._value_trans:
|
|
773
|
+
before_v = v
|
|
773
774
|
v = self._value_trans[k](v)
|
|
775
|
+
print(f"{before_v} -> {v}")
|
|
774
776
|
if k in self._dials:
|
|
775
777
|
live_updates[k] = v
|
|
776
778
|
elif k in self._settings:
|
|
@@ -1101,6 +1103,14 @@ class Synth(MutableMapping):
|
|
|
1101
1103
|
|
|
1102
1104
|
for key, val in updates.items():
|
|
1103
1105
|
target = raw_params[key] if raw_params else self.knobs[key]
|
|
1106
|
+
|
|
1107
|
+
if self._has_value_trans:
|
|
1108
|
+
if not isinstance(val, dict):
|
|
1109
|
+
val = self._value_trans[key](val)
|
|
1110
|
+
else:
|
|
1111
|
+
if "value" in val:
|
|
1112
|
+
val["value"] = self._value_trans[key](val["value"])
|
|
1113
|
+
|
|
1104
1114
|
if isinstance(target, SigTo):
|
|
1105
1115
|
if isinstance(val, dict):
|
|
1106
1116
|
for attr in ["value", "time", "mul", "add"]:
|
|
@@ -113,6 +113,10 @@ def round_numbers(items, round_to=0.001, *, index_of_item_number=None, egress=No
|
|
|
113
113
|
yield egress(item)
|
|
114
114
|
|
|
115
115
|
|
|
116
|
+
# ----------------------------------------------------------------------------------
|
|
117
|
+
# Frequency snappers
|
|
118
|
+
# ----------------------------------------------------------------------------------
|
|
119
|
+
|
|
116
120
|
from bisect import bisect_left
|
|
117
121
|
from math import log2
|
|
118
122
|
|
|
@@ -162,6 +166,7 @@ class SnapToChromatic:
|
|
|
162
166
|
|
|
163
167
|
DFLT_OCTAVE_RANGE = (0, 10)
|
|
164
168
|
DFLT_TUNING = 440.0 # A4 tuning frequency
|
|
169
|
+
DFLT_SCALE_MIDI_NOTES = (0, 2, 4, 5, 7, 9, 11) # C major scale
|
|
165
170
|
|
|
166
171
|
|
|
167
172
|
def tempered_semitone_frequencies(
|
|
@@ -201,9 +206,30 @@ def tempered_semitone_frequencies(
|
|
|
201
206
|
return sorted(gen_freqs())
|
|
202
207
|
|
|
203
208
|
|
|
209
|
+
def scale_frequencies(
|
|
210
|
+
scale: Iterable[Union[float, int]] = DFLT_SCALE_MIDI_NOTES,
|
|
211
|
+
*,
|
|
212
|
+
tuning=DFLT_TUNING,
|
|
213
|
+
octave_range=DFLT_OCTAVE_RANGE,
|
|
214
|
+
):
|
|
215
|
+
"""
|
|
216
|
+
Get frequencies for a given scale.
|
|
217
|
+
|
|
218
|
+
:param scale: A list of integers representing the scale.
|
|
219
|
+
For example, (0, 2, 4, 5, 7, 9, 11) corresponds to the C major scale.
|
|
220
|
+
:param tuning: The tuning frequency (default is 440 Hz).
|
|
221
|
+
:param octave_range: A tuple of two integers representing the range of octaves.
|
|
222
|
+
:return: A list of frequencies corresponding to the notes in the given scale.
|
|
223
|
+
"""
|
|
224
|
+
chromatic_scale = tempered_semitone_frequencies(
|
|
225
|
+
tuning=tuning, octave_range=octave_range
|
|
226
|
+
)
|
|
227
|
+
return [chromatic_scale[i] for i in range(len(chromatic_scale)) if i % 12 in scale]
|
|
228
|
+
|
|
229
|
+
|
|
204
230
|
# TODO: Add string_to_scale_map argument to convert string to midi note array scale
|
|
205
231
|
def scale_snapper(
|
|
206
|
-
scale: Iterable[Union[float, int]] =
|
|
232
|
+
scale: Iterable[Union[float, int]] = DFLT_SCALE_MIDI_NOTES,
|
|
207
233
|
*,
|
|
208
234
|
tuning=DFLT_TUNING,
|
|
209
235
|
octave_range=DFLT_OCTAVE_RANGE,
|
|
@@ -245,15 +271,14 @@ def scale_snapper(
|
|
|
245
271
|
493.8833...
|
|
246
272
|
|
|
247
273
|
"""
|
|
248
|
-
|
|
249
|
-
tuning=tuning, octave_range=octave_range
|
|
274
|
+
_scale_frequencies = scale_frequencies(
|
|
275
|
+
scale=scale, tuning=tuning, octave_range=octave_range
|
|
250
276
|
)
|
|
251
|
-
# keep all elements of chromatic_scale that have index in midi_notes module 12
|
|
252
|
-
scale_frequencies = [
|
|
253
|
-
chromatic_scale[i] for i in range(len(chromatic_scale)) if i % 12 in scale
|
|
254
|
-
]
|
|
255
277
|
# create a ListSnapper object
|
|
256
|
-
return ListSnapper(
|
|
278
|
+
return ListSnapper(_scale_frequencies)
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
# ----------------------------------------------------------------------------------
|
|
257
282
|
|
|
258
283
|
|
|
259
284
|
def getmodulename(obj, default=""):
|
{hum-1.0.7 → hum-1.0.8}/LICENSE
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hum-1.0.7 → hum-1.0.8}/setup.py
RENAMED
|
File without changes
|