ipytone.Note#

class ipytone.Note(time, note, velocity=1, duration=0.1, trigger_type='attack_release')#

Bases: object

A single note with time, note (frequency) and velocity values.

This is just a placeholder for some attributes that allows a little more flexibility in ipytone.Part. Unlike in Tone.js, it is not possible to pass arbitrary objects as the 2nd argument of a Part callback. Instead, every Part event is coerced to a Note object that can be passed directly to Instrument.trigger_note() or to other trigger methods (using its attributes) inside the callback body.

time#

The relative partition time when the note should be triggered.

Type:

float or str

note#

The actual note or frequency.

Type:

float or str

velocity#

The note velocity (in general any value between 0 and 1).

Type:

float, optional

duration#

The note duration in seconds (generaly used with the “attack_release” trigger type).

Type:

float, optional

trigger_type#

The type of event. Used in Instrument.trigger_note() to determine the action to perform.

Type:

{‘attack’, ‘release’, ‘attack_release’}, optional

__init__(time, note, velocity=1, duration=0.1, trigger_type='attack_release')#

Methods

to_dict()