Skip to content

Commit 4555c93

Browse files
committed
Add example to mix.
1 parent bba2f60 commit 4555c93

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

docs/_static/mix-1.jpg

17.8 KB
Loading

docs/_static/mix-1.jpg.license

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2024 Cooper Dalrymple
2+
#
3+
# SPDX-License-Identifier: MIT

synthwaveform.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,24 @@ def mix(*waveforms: tuple) -> np.ndarray:
381381
objects must have the same data type. If the sizes of the arrays are inconsistent, the output
382382
will be sized to the shortest array.
383383
384+
.. |mix-1| image:: _static/mix-1.jpg
385+
:width: 200
386+
:alt: example of waveform mixing
387+
388+
.. table::
389+
390+
+--------------------------------------------------+---------+
391+
| .. code-block:: python | |mix-1| |
392+
| | |
393+
| import synthwaveform | |
394+
| waveform = synthwaveform.mix( | |
395+
| (synthwaveform.triangle(), 0.7), | |
396+
| (synthwaveform.saw(frequency=2.0), 0.1), | |
397+
| (synthwaveform.saw(frequency=3.0), 0.1), | |
398+
| (synthwaveform.saw(frequency=4.0), 0.1), | |
399+
| ) | |
400+
+--------------------------------------------------+---------+
401+
384402
:param waveforms: The arrays to be mixed together. In order to specify the level for each
385403
waveform, each waveform can be provided as a tuple with the first element being the waveform
386404
data and the second being the level.

0 commit comments

Comments
 (0)