hum 1.0.1__tar.gz → 1.0.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hum
3
- Version: 1.0.1
3
+ Version: 1.0.2
4
4
  Summary: A python synthesizer for creating and manipulating audio signals.
5
5
  Home-page: https://github.com/thorwhalen/hum
6
6
  License: mit
@@ -16,8 +16,12 @@ A python synthesizer for creating and manipulating audio signals.
16
16
 
17
17
  To install: ```pip install hum```
18
18
 
19
- Note: Some functionalities depend on `pyo`, which itself requires some tools
20
- (namely, [portaudio](https://www.portaudio.com/) and [Portmidi](https://github.com/PortMidi/portmidi)) that _may_ have to be installed manually.
19
+ Note: Some functionalities depend on [pyo](https://belangeo.github.io/pyo/download.html),
20
+ which itself requires some tools (namely, [portaudio](https://www.portaudio.com/)
21
+ and [Portmidi](https://github.com/PortMidi/portmidi)) that _may_ have to be
22
+ installed manually.
23
+
24
+
21
25
 
22
26
 
23
27
 
hum-1.0.2/README.md ADDED
@@ -0,0 +1,15 @@
1
+ # hum
2
+
3
+ A python synthesizer for creating and manipulating audio signals.
4
+
5
+ To install: ```pip install hum```
6
+
7
+ Note: Some functionalities depend on [pyo](https://belangeo.github.io/pyo/download.html),
8
+ which itself requires some tools (namely, [portaudio](https://www.portaudio.com/)
9
+ and [Portmidi](https://github.com/PortMidi/portmidi)) that _may_ have to be
10
+ installed manually.
11
+
12
+
13
+
14
+
15
+
@@ -2,7 +2,7 @@
2
2
  Tools to create audio
3
3
  """
4
4
 
5
- from hum.pyo_util import Synth, knob_params, knob_exclude
5
+ from hum.pyo_util import synth, Synth, knob_params, knob_exclude
6
6
  from hum.utils import (
7
7
  plot_wf,
8
8
  disp_wf,
@@ -34,7 +34,7 @@ def example_01_basic_dual_osc():
34
34
  synth.replay_events(events)
35
35
 
36
36
  # ------------------------- get the wav_bytes of this recording --------------------
37
- wav_bytes = synth.render_recording()
37
+ wav_bytes = synth.render_events()
38
38
  assert isinstance(wav_bytes, bytes)
39
39
  assert len(wav_bytes) > 0, "No bytes returned"
40
40
  # verify that the bytes are a valid WAV file
@@ -190,5 +190,5 @@ def example_06_knob_recording_playback():
190
190
  return ButLP(blend, freq=lfo)
191
191
 
192
192
  synth2 = Synth(dual_osc_graph_offline)
193
- wf, sr = synth2.render_recording(control_events, egress=recode.decode_wav_bytes)
193
+ wf, sr = synth2.render_events(control_events, egress=recode.decode_wav_bytes)
194
194
  return wf, sr
@@ -1,6 +1,7 @@
1
1
  """pyo utils"""
2
2
 
3
3
  import os
4
+ from functools import partial
4
5
  import tempfile
5
6
  import inspect
6
7
  from inspect import Signature, Parameter
@@ -479,8 +480,8 @@ class Synth(MutableMapping):
479
480
  synth_func, "_knob_params", set(self._synth_func_params)
480
481
  )
481
482
  _knob_params = list_if_string(_knob_params)
482
- _knob_exclude = knob_exclude or getattr(synth_func, "_knob_exclude", set())
483
483
  knob_exclude = list_if_string(knob_exclude)
484
+ _knob_exclude = knob_exclude or getattr(synth_func, "_knob_exclude", set())
484
485
  self._knob_params = set(_knob_params) - set(_knob_exclude)
485
486
  self._knob_defaults = {k: self._synth_func_params[k] for k in _knob_params}
486
487
  self._live_params = set(self._knob_params)
@@ -754,7 +755,7 @@ class Synth(MutableMapping):
754
755
  def replay_events(self, control_events, *, tail_time=1.0):
755
756
  self.play_events(ReplayEvents(control_events), tail_time=tail_time)
756
757
 
757
- def render_recording(
758
+ def render_events(
758
759
  self,
759
760
  control_events=None,
760
761
  *,
@@ -861,23 +862,24 @@ class Synth(MutableMapping):
861
862
  return f"<Synth {list(self.knobs.keys())}>"
862
863
 
863
864
 
864
- # --------------------------------------------------------------------------------------
865
- # Example functions for testing the Synth class
866
- # --------------------------------------------------------------------------------------
867
-
868
-
869
- def basic_synth_test():
870
- def simple_sine(freq=220, volume=1):
871
- sine = Sine(freq=freq, mul=volume)
872
-
873
- synth = Synth(simple_sine)
874
-
875
- with synth:
876
- time.sleep(1)
877
- synth["freq"] = 220 * 3 / 2
878
- time.sleep(1)
879
- synth["freq"] = 220 * 2
880
- time.sleep(1)
881
-
882
- events = synth.get_recording()
883
- synth.replay_events(events)
865
+ def synth(
866
+ synth_func=None,
867
+ *,
868
+ knob_params: Optional[Set[str]] = None,
869
+ knob_exclude: Optional[Set[str]] = None,
870
+ sr=DFLT_PYO_SR,
871
+ nchnls=DFLT_PYO_NCHNLS,
872
+ record_on_start: bool = True,
873
+ event_log_factory: RecordFactory = list, # No argument factory that makes an Appendable
874
+ audio="portaudio",
875
+ verbosity=DFLT_PYO_VERBOSITY,
876
+ **server_kwargs,
877
+ ):
878
+ synth_kwargs = dict(
879
+ {k: v for k, v in locals().items() if k not in {"synth_func", "server_kwargs"}},
880
+ **server_kwargs,
881
+ )
882
+ if synth_func is None:
883
+ return partial(Synth, **synth_kwargs)
884
+ else:
885
+ return Synth(synth_func, **synth_kwargs)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hum
3
- Version: 1.0.1
3
+ Version: 1.0.2
4
4
  Summary: A python synthesizer for creating and manipulating audio signals.
5
5
  Home-page: https://github.com/thorwhalen/hum
6
6
  License: mit
@@ -16,8 +16,12 @@ A python synthesizer for creating and manipulating audio signals.
16
16
 
17
17
  To install: ```pip install hum```
18
18
 
19
- Note: Some functionalities depend on `pyo`, which itself requires some tools
20
- (namely, [portaudio](https://www.portaudio.com/) and [Portmidi](https://github.com/PortMidi/portmidi)) that _may_ have to be installed manually.
19
+ Note: Some functionalities depend on [pyo](https://belangeo.github.io/pyo/download.html),
20
+ which itself requires some tools (namely, [portaudio](https://www.portaudio.com/)
21
+ and [Portmidi](https://github.com/PortMidi/portmidi)) that _may_ have to be
22
+ installed manually.
23
+
24
+
21
25
 
22
26
 
23
27
 
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = hum
3
- version = 1.0.1
3
+ version = 1.0.2
4
4
  url = https://github.com/thorwhalen/hum
5
5
  platforms = any
6
6
  description_file = README.md
hum-1.0.1/README.md DELETED
@@ -1,11 +0,0 @@
1
- # hum
2
-
3
- A python synthesizer for creating and manipulating audio signals.
4
-
5
- To install: ```pip install hum```
6
-
7
- Note: Some functionalities depend on `pyo`, which itself requires some tools
8
- (namely, [portaudio](https://www.portaudio.com/) and [Portmidi](https://github.com/PortMidi/portmidi)) that _may_ have to be installed manually.
9
-
10
-
11
-
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