ipytone.WaveShaper#
- class ipytone.WaveShaper(**kwargs: Any)#
Bases:
SignalOperatorA node that applies a custom, non-linear distorsion curve.
The curve array values define a mapping from the input signal (audio range [-1, 1]) to the output signal (same range) such that:
the mid-element is applied to any signal value of 0
the first element is applied to signal values of -1
the last element is applied to signal values of 1
intermediate values are linearly interpolated
Values lower than -1 or greater than 1 are treated like -1 or 1 respectively.
The curve points can be given directly as an array via the
curveattribute or indirectly using a mapping function.- Parameters:
mapping_func (callable, optional) – A function used to compute the curve values. It must take two arguments: the 1st argument is the normalized position (between -1 and 1) and the 2nd argument is the curve array index. It must return the value of the curve a the given index.
length (int, optional) – The size of the curve array (ignored if no mapping function is provided).
**kwargs – Optional arguments such as
curveto directly provide curve array values.
- __init__(mapping_func=None, length=1024, **kwargs)#
Public constructor
Methods
chain(*nodes)Connect the output of this audio node to the other audio nodes in series.
connect(destination[, output_number, ...])Connect the output of this audio node to the input of another node.
disconnect(destination[, output_number, ...])Disconnect the ouput of this audio node from a connected node.
dispose()Dispose and disconnect this audio node (as well as its input/output).
fan(*destinations)Connect the output of this audio node to the
destinationsaudio nodes in parallel.set_map(mapping_func[, length])Set a new distorsion curve from a mapping function.
Convenience method to directly connect the output of this audio node to the main output (speakers) node.
Attributes
channel_countAn int trait.
channel_count_modeAn enum whose value must be in a given sequence.
channel_interpretationAn enum whose value must be in a given sequence.
Waveshaper curve
Returns True if the node was disposed (i.e., disconnected and web audio node freed for garbage collection).
Returns the input node, or None if this node is a source.
logA trait whose value must be an instance of a specified class.
nameA trait for unicode strings.
Returns the number of input slots for the input node (0 for source nodes).
Returns the number of output slots for the output node (0 for sink nodes).
Returns the output node, or None if this node is a sink.
oversampling value
- chain(*nodes)#
Connect the output of this audio node to the other audio nodes in series.
- connect(destination, output_number=0, input_number=0)#
Connect the output of this audio node to the input of another node.
- curve#
Waveshaper curve
- disconnect(destination, output_number=0, input_number=0)#
Disconnect the ouput of this audio node from a connected node.
- dispose()#
Dispose and disconnect this audio node (as well as its input/output).
- property disposed#
Returns True if the node was disposed (i.e., disconnected and web audio node freed for garbage collection).
- fan(*destinations)#
Connect the output of this audio node to the
destinationsaudio nodes in parallel.
- property input#
Returns the input node, or None if this node is a source.
- property number_of_inputs#
Returns the number of input slots for the input node (0 for source nodes).
- property number_of_outputs#
Returns the number of output slots for the output node (0 for sink nodes).
- property output#
Returns the output node, or None if this node is a sink.
- oversample#
oversampling value
- set_map(mapping_func, length=1024)#
Set a new distorsion curve from a mapping function.
- Parameters:
mapping_func (callable, optional) – A function used to compute the curve values. It must take two arguments: the 1st argument is the normalized position (between -1 and 1) and the 2nd argument is the curve array index. It must return the value of the curve a the given index.
length (int, optional) – The size of the curve array (ignored if no mapping function is provided).
- to_destination()#
Convenience method to directly connect the output of this audio node to the main output (speakers) node.