pyaudiosynth documentation

class pyaudiosynth.Note(name: str, ms: float | None = None, wave: Wave | None = None)[source]

Bases: object

A class for holding note information

Parameters:
name : str

The note name to play (piano note)

ms : float | None

The length to play the note for in milliseconds (optional, defaults to Synthesizer default_nlen)

wave : Wave | None

The waveform to play (optional, defaults to Synthesizer default_wave)

ms : float | None = None
name : str
wave : Wave | None = None
class pyaudiosynth.Synthesizer(default_nlen: int = 500, default_wave: Wave = Wave.Sine, show_vis: bool = False)[source]

Bases: object

Main class for synthesizing notes

Parameters:
default_nlen : int

The default note length in milliseconds (default 500)

default_wave : Wave

The default waveform to use (default Sine)

show_vis : bool

If we should show the waveform visualisation (default False)

play_frq(frq: float, ms: float, wave: Wave) None[source]

Plays a certain frequency

Parameters:
frq : float

The frequency to play

ms : float

Milisecconds to play the note for

wave : Wave

The waveform to play

play_note(note: Note | list[Note]) None[source]

Plays note(s)

Parameters:
note : Note|list[Note]

The note, or list of notes to play

play_notes_ww(note: Note | list[Note], wave: Wave) None[source]

Plays note(s), ignoring the notes waveform instead using the provided waveform

Parameters:
note : Note|list[Note]

The note, or list of notes to play

wave : Wave

The waveform which we should play

play_saw(note: Note | list[Note]) None[source]

Plays note(s), ignoring the notes waveform instead using a Sawtooth wave

Parameters:
note : Note|list[Note]

The note, or list of notes to play

play_sine(note: Note | list[Note]) None[source]

Plays note(s), ignoring the notes waveform instead using a Sine wave

Parameters:
note : Note|list[Note]

The note, or list of notes to play

play_square(note: Note | list[Note]) None[source]

Plays note(s), ignoring the notes waveform instead using a Square wave

Parameters:
note : Note|list[Note]

The note, or list of notes to play

play_triangle(note: Note | list[Note]) None[source]

Plays note(s), ignoring the notes waveform instead using a Triangle wave

Parameters:
note : Note|list[Note]

The note, or list of notes to play

class pyaudiosynth.Wave(value)[source]

Bases: Enum

An enumeration.

Saw = 3

A sawtooth wave

Sine = 1

A sine wave

Square = 2

A square wave

Triangle = 4

A triangle wave