music.Sequencer

class music.Sequencer(sample_rate=44100, events=<factory>)[source]

Bases: object

Schedules notes and renders them as audio.

Parameters:
  • sample_rate (int)

  • events (List[NoteEvent])

__init__(sample_rate=44100, events=<factory>)
Parameters:
  • sample_rate (int)

  • events (List[NoteEvent])

Return type:

None

Methods

__init__([sample_rate, events])

add_note(freq, start, duration[, ...])

Add a note event to the sequencer.

render()

Render all scheduled events and return the audio array.

write(filename[, bit_depth])

Write the rendered audio to a WAV file.

Attributes

sample_rate: int = 44100
events: List[NoteEvent]
add_note(freq, start, duration, vibrato_freq=0.0, max_pitch_dev=0.0, adsr_params=None, spatial=None)[source]

Add a note event to the sequencer.

Parameters:
Return type:

None

render()[source]

Render all scheduled events and return the audio array.

Return type:

ndarray

write(filename, bit_depth=16)[source]

Write the rendered audio to a WAV file.

Parameters:
  • filename (str)

  • bit_depth (int)

Return type:

None