gingo 1.0.0__cp310-cp310-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
gingo/__init__.py ADDED
@@ -0,0 +1,106 @@
1
+ """🪇 Gingo — Music theory library for Python.
2
+
3
+ A comprehensive toolset for working with music theory programmatically:
4
+ notes, intervals, chords, scales, and harmonic fields.
5
+
6
+ Examples:
7
+ >>> from gingo import Note, Chord, Scale, Field
8
+ >>> Note("Bb").natural()
9
+ 'A#'
10
+ >>> Chord("Cm7").notes()
11
+ [Note("C"), Note("D#"), Note("G"), Note("A#")]
12
+ >>> Scale("C", "major").degree(5)
13
+ Note("G")
14
+ >>> [c.name() for c in Field("C", "major").chords()]
15
+ ['CM', 'Dm', 'Em', 'FM', 'GM', 'Am', 'Bdim']
16
+ """
17
+
18
+ from gingo._gingo import (
19
+ Note,
20
+ Interval,
21
+ Chord,
22
+ ChordComparison,
23
+ Scale,
24
+ ScaleType,
25
+ Modality,
26
+ Field,
27
+ HarmonicFunction,
28
+ BorrowedInfo,
29
+ PivotInfo,
30
+ FieldComparison,
31
+ Tree,
32
+ HarmonicPath,
33
+ Duration,
34
+ Tempo,
35
+ TimeSignature,
36
+ NoteEvent,
37
+ ChordEvent,
38
+ Rest,
39
+ Sequence,
40
+ )
41
+
42
+ try:
43
+ from importlib.metadata import version as _version
44
+ __version__ = _version("gingo")
45
+ except Exception:
46
+ __version__ = "0.0.0"
47
+ __author__ = "Saulo Verissimo"
48
+
49
+ __all__ = [
50
+ "Note",
51
+ "Interval",
52
+ "Chord",
53
+ "ChordComparison",
54
+ "Scale",
55
+ "ScaleType",
56
+ "Modality",
57
+ "Field",
58
+ "HarmonicFunction",
59
+ "BorrowedInfo",
60
+ "PivotInfo",
61
+ "FieldComparison",
62
+ "Tree",
63
+ "HarmonicPath",
64
+ "Duration",
65
+ "Tempo",
66
+ "TimeSignature",
67
+ "NoteEvent",
68
+ "ChordEvent",
69
+ "Rest",
70
+ "Sequence",
71
+ ]
72
+
73
+ # ---------------------------------------------------------------------------
74
+ # Audio monkey-patch: .play() and .to_wav() on domain classes
75
+ # Available when gingo.audio can be imported (always — zero-dep synthesis).
76
+ # ---------------------------------------------------------------------------
77
+
78
+ try:
79
+ from gingo.audio import play as _play_fn, to_wav as _to_wav_fn
80
+
81
+ def _make_play(_cls): # noqa: N802
82
+ def play(self, **kwargs):
83
+ """Play this object through the system audio output.
84
+
85
+ See :func:`gingo.audio.play` for keyword arguments.
86
+ """
87
+ return _play_fn(self, **kwargs)
88
+ return play
89
+
90
+ def _make_to_wav(_cls): # noqa: N802
91
+ def to_wav(self, path, **kwargs):
92
+ """Render this object to a WAV file.
93
+
94
+ See :func:`gingo.audio.to_wav` for keyword arguments.
95
+ """
96
+ return _to_wav_fn(self, path, **kwargs)
97
+ return to_wav
98
+
99
+ for _cls in (Note, Chord, Scale, Field, Tree, Sequence,
100
+ NoteEvent, ChordEvent, Rest):
101
+ _cls.play = _make_play(_cls)
102
+ _cls.to_wav = _make_to_wav(_cls)
103
+
104
+ del _make_play, _make_to_wav, _cls
105
+ except Exception:
106
+ pass
gingo/__init__.pyi ADDED
@@ -0,0 +1,476 @@
1
+ """Type stubs for the Gingo C++ extension module."""
2
+
3
+ from typing import Any, Dict, Iterator, List, Optional, Tuple, Union, overload
4
+ from enum import Enum
5
+ from pathlib import Path
6
+
7
+ from gingo.audio import Envelope, Waveform
8
+
9
+ class ScaleType(Enum):
10
+ Major: int
11
+ NaturalMinor: int
12
+ HarmonicMinor: int
13
+ MelodicMinor: int
14
+ Diminished: int
15
+ HarmonicMajor: int
16
+ WholeTone: int
17
+ Augmented: int
18
+ Blues: int
19
+ Chromatic: int
20
+
21
+ class Modality(Enum):
22
+ Diatonic: int
23
+ Pentatonic: int
24
+
25
+ class Note:
26
+ def __init__(self, name: str) -> None: ...
27
+ def name(self) -> str: ...
28
+ def natural(self) -> str: ...
29
+ def sound(self) -> str: ...
30
+ def semitone(self) -> int: ...
31
+ def frequency(self, octave: int = 4, tuning: float = 440.0) -> float: ...
32
+ def is_enharmonic(self, other: "Note") -> bool: ...
33
+ def transpose(self, semitones: int) -> "Note": ...
34
+ def distance(self, other: "Note") -> int: ...
35
+ @staticmethod
36
+ def fifths() -> List[str]: ...
37
+ def __eq__(self, other: object) -> bool: ...
38
+ def __ne__(self, other: object) -> bool: ...
39
+ def __repr__(self) -> str: ...
40
+ def __str__(self) -> str: ...
41
+ def __hash__(self) -> int: ...
42
+ def __lt__(self, other: "Note") -> bool: ...
43
+ def __le__(self, other: "Note") -> bool: ...
44
+ def __gt__(self, other: "Note") -> bool: ...
45
+ def __ge__(self, other: "Note") -> bool: ...
46
+ def __int__(self) -> int: ...
47
+ def play(self, *, octave: int = 4, duration: float = 0.5, waveform: Union[Waveform, str] = ..., amplitude: float = 0.8, envelope: Optional[Envelope] = None, strum: float = 0.03, gap: float = 0.05, tuning: float = 440.0, sample_rate: int = 44100) -> None: ...
48
+ def to_wav(self, path: Union[str, Path], *, octave: int = 4, duration: float = 0.5, waveform: Union[Waveform, str] = ..., amplitude: float = 0.8, envelope: Optional[Envelope] = None, strum: float = 0.03, gap: float = 0.05, tuning: float = 440.0, sample_rate: int = 44100) -> None: ...
49
+ def __float__(self) -> float: ...
50
+ @overload
51
+ def __add__(self, semitones: int) -> "Note": ...
52
+ @overload
53
+ def __add__(self, interval: "Interval") -> "Note": ...
54
+ def __radd__(self, semitones: int) -> "Note": ...
55
+ @overload
56
+ def __sub__(self, semitones: int) -> "Note": ...
57
+ @overload
58
+ def __sub__(self, interval: "Interval") -> "Note": ...
59
+ @overload
60
+ def __sub__(self, other: "Note") -> "Interval": ...
61
+
62
+ class Interval:
63
+ @overload
64
+ def __init__(self, label: str) -> None: ...
65
+ @overload
66
+ def __init__(self, semitones: int) -> None: ...
67
+ @overload
68
+ def __init__(self, from_note: Note, to_note: Note) -> None: ...
69
+ def label(self) -> str: ...
70
+ def anglo_saxon(self) -> str: ...
71
+ def semitones(self) -> int: ...
72
+ def degree(self) -> int: ...
73
+ def octave(self) -> int: ...
74
+ def simple(self) -> "Interval": ...
75
+ def is_compound(self) -> bool: ...
76
+ def invert(self) -> "Interval": ...
77
+ def consonance(self, include_fourth: bool = False) -> str: ...
78
+ def is_consonant(self, include_fourth: bool = False) -> bool: ...
79
+ def full_name(self) -> str: ...
80
+ def full_name_pt(self) -> str: ...
81
+ def __add__(self, other: "Interval") -> "Interval": ...
82
+ def __sub__(self, other: "Interval") -> "Interval": ...
83
+ @overload
84
+ def __eq__(self, other: "Interval") -> bool: ...
85
+ @overload
86
+ def __eq__(self, other: int) -> bool: ...
87
+ def __eq__(self, other: object) -> bool: ...
88
+ @overload
89
+ def __ne__(self, other: "Interval") -> bool: ...
90
+ @overload
91
+ def __ne__(self, other: int) -> bool: ...
92
+ def __ne__(self, other: object) -> bool: ...
93
+ def __repr__(self) -> str: ...
94
+ def __str__(self) -> str: ...
95
+ def __hash__(self) -> int: ...
96
+ def __lt__(self, other: "Interval") -> bool: ...
97
+ def __le__(self, other: "Interval") -> bool: ...
98
+ def __gt__(self, other: "Interval") -> bool: ...
99
+ def __ge__(self, other: "Interval") -> bool: ...
100
+ def __int__(self) -> int: ...
101
+
102
+ class ChordComparison:
103
+ common_notes: List[Note]
104
+ exclusive_a: List[Note]
105
+ exclusive_b: List[Note]
106
+ root_distance: int
107
+ root_direction: int
108
+ same_quality: bool
109
+ same_size: bool
110
+ common_intervals: List[str]
111
+ enharmonic: bool
112
+ subset: str
113
+ voice_leading: int
114
+ transformation: str
115
+ inversion: bool
116
+ interval_vector_a: List[int]
117
+ interval_vector_b: List[int]
118
+ same_interval_vector: bool
119
+ transposition: int
120
+ dissonance_a: float
121
+ dissonance_b: float
122
+ def to_dict(self) -> Dict[str, Any]: ...
123
+ def __repr__(self) -> str: ...
124
+
125
+ class Chord:
126
+ @overload
127
+ def __init__(self, name: str) -> None: ...
128
+ @overload
129
+ def __init__(self, name: List[str]) -> None: ...
130
+ @overload
131
+ def __init__(self, name: List[Note]) -> None: ...
132
+ def name(self) -> str: ...
133
+ def root(self) -> Note: ...
134
+ def type(self) -> str: ...
135
+ def notes(self) -> List[Note]: ...
136
+ def formal_notes(self) -> List[Note]: ...
137
+ def intervals(self) -> List[Interval]: ...
138
+ def interval_labels(self) -> List[str]: ...
139
+ def size(self) -> int: ...
140
+ def contains(self, note: Note) -> bool: ...
141
+ def compare(self, other: "Chord") -> ChordComparison: ...
142
+ def transpose(self, semitones: int) -> "Chord": ...
143
+ def __add__(self, semitones: int) -> "Chord": ...
144
+ def __sub__(self, semitones: int) -> "Chord": ...
145
+ @staticmethod
146
+ def identify(note_names: List[str]) -> "Chord": ...
147
+ def __eq__(self, other: object) -> bool: ...
148
+ def __ne__(self, other: object) -> bool: ...
149
+ def __repr__(self) -> str: ...
150
+ def __str__(self) -> str: ...
151
+ def play(self, *, octave: int = 4, duration: float = 0.5, waveform: Union[Waveform, str] = ..., amplitude: float = 0.8, envelope: Optional[Envelope] = None, strum: float = 0.03, gap: float = 0.05, tuning: float = 440.0, sample_rate: int = 44100) -> None: ...
152
+ def to_wav(self, path: Union[str, Path], *, octave: int = 4, duration: float = 0.5, waveform: Union[Waveform, str] = ..., amplitude: float = 0.8, envelope: Optional[Envelope] = None, strum: float = 0.03, gap: float = 0.05, tuning: float = 440.0, sample_rate: int = 44100) -> None: ...
153
+ def __hash__(self) -> int: ...
154
+ def __len__(self) -> int: ...
155
+ def __contains__(self, note: Union[Note, str]) -> bool: ...
156
+ def __iter__(self) -> Iterator[Note]: ...
157
+ def __reversed__(self) -> Iterator[Note]: ...
158
+ @overload
159
+ def __getitem__(self, index: int) -> Note: ...
160
+ @overload
161
+ def __getitem__(self, index: slice) -> List[Note]: ...
162
+
163
+ class Scale:
164
+ @overload
165
+ def __init__(self, tonic: str, type: ScaleType, modality: Modality = ...) -> None: ...
166
+ @overload
167
+ def __init__(self, tonic: str, type: str, modality: str = "diatonic") -> None: ...
168
+ def tonic(self) -> Note: ...
169
+ def type(self) -> ScaleType: ...
170
+ def modality(self) -> Modality: ...
171
+ def parent(self) -> ScaleType: ...
172
+ def mode_number(self) -> int: ...
173
+ def is_pentatonic(self) -> bool: ...
174
+ def mode_name(self) -> str: ...
175
+ def quality(self) -> str: ...
176
+ def brightness(self) -> int: ...
177
+ def colors(self, reference: Union["Scale", str]) -> List[Note]: ...
178
+ def notes(self) -> List[Note]: ...
179
+ def formal_notes(self) -> List[Note]: ...
180
+ def degree(self, *degrees: int) -> Note: ...
181
+ def walk(self, start: int, *steps: int) -> Note: ...
182
+ def size(self) -> int: ...
183
+ def contains(self, note: Note) -> bool: ...
184
+ def degree_of(self, note: Note) -> Optional[int]: ...
185
+ def mode(self, degree_or_name: Union[int, str]) -> "Scale": ...
186
+ def pentatonic(self) -> "Scale": ...
187
+ def signature(self) -> int: ...
188
+ def relative(self) -> "Scale": ...
189
+ def parallel(self) -> "Scale": ...
190
+ def neighbors(self) -> Tuple["Scale", "Scale"]: ...
191
+ def mask(self) -> List[int]: ...
192
+ @staticmethod
193
+ def identify(notes: Union[List[str], List[Note]]) -> "Scale": ...
194
+ @staticmethod
195
+ def parse_type(name: str) -> ScaleType: ...
196
+ @staticmethod
197
+ def parse_modality(name: str) -> Modality: ...
198
+ def __repr__(self) -> str: ...
199
+ def __str__(self) -> str: ...
200
+ def __len__(self) -> int: ...
201
+ def __eq__(self, other: object) -> bool: ...
202
+ def __ne__(self, other: object) -> bool: ...
203
+ def play(self, *, octave: int = 4, duration: float = 0.5, waveform: Union[Waveform, str] = ..., amplitude: float = 0.8, envelope: Optional[Envelope] = None, strum: float = 0.03, gap: float = 0.05, tuning: float = 440.0, sample_rate: int = 44100) -> None: ...
204
+ def to_wav(self, path: Union[str, Path], *, octave: int = 4, duration: float = 0.5, waveform: Union[Waveform, str] = ..., amplitude: float = 0.8, envelope: Optional[Envelope] = None, strum: float = 0.03, gap: float = 0.05, tuning: float = 440.0, sample_rate: int = 44100) -> None: ...
205
+ def __hash__(self) -> int: ...
206
+ def __contains__(self, note: Union[Note, str]) -> bool: ...
207
+ def __iter__(self) -> Iterator[Note]: ...
208
+ @overload
209
+ def __getitem__(self, index: int) -> Note: ...
210
+ @overload
211
+ def __getitem__(self, index: slice) -> List[Note]: ...
212
+ def __reversed__(self) -> Iterator[Note]: ...
213
+
214
+ class HarmonicFunction(Enum):
215
+ Tonic: int
216
+ Subdominant: int
217
+ Dominant: int
218
+ @property
219
+ def short(self) -> str: ...
220
+
221
+ class BorrowedInfo:
222
+ scale_type: str
223
+ degree: int
224
+ function: HarmonicFunction
225
+ role: str
226
+ def to_dict(self) -> Dict[str, Any]: ...
227
+ def __repr__(self) -> str: ...
228
+
229
+ class PivotInfo:
230
+ tonic: str
231
+ scale_type: str
232
+ degree_a: int
233
+ degree_b: int
234
+ def to_dict(self) -> Dict[str, Any]: ...
235
+ def __repr__(self) -> str: ...
236
+
237
+ class FieldComparison:
238
+ degree_a: Optional[int]
239
+ degree_b: Optional[int]
240
+ function_a: Optional[HarmonicFunction]
241
+ function_b: Optional[HarmonicFunction]
242
+ role_a: Optional[str]
243
+ role_b: Optional[str]
244
+ degree_distance: Optional[int]
245
+ same_function: Optional[bool]
246
+ relative: bool
247
+ progression: bool
248
+ root_motion: str
249
+ secondary_dominant: str
250
+ applied_diminished: str
251
+ diatonic_a: bool
252
+ diatonic_b: bool
253
+ borrowed_a: Optional[BorrowedInfo]
254
+ borrowed_b: Optional[BorrowedInfo]
255
+ pivot: List[PivotInfo]
256
+ tritone_sub: bool
257
+ chromatic_mediant: str
258
+ foreign_a: List[Note]
259
+ foreign_b: List[Note]
260
+ def to_dict(self) -> Dict[str, Any]: ...
261
+ def __repr__(self) -> str: ...
262
+
263
+ class Field:
264
+ def __init__(self, tonic: str, type: str) -> None: ...
265
+ def tonic(self) -> Note: ...
266
+ def scale(self) -> Scale: ...
267
+ def chords(self) -> List[Chord]: ...
268
+ def sevenths(self) -> List[Chord]: ...
269
+ def chord(self, degree: int) -> Chord: ...
270
+ def seventh(self, degree: int) -> Chord: ...
271
+ @overload
272
+ def applied(self, function: str, target: int) -> Chord: ...
273
+ @overload
274
+ def applied(self, function: str, target: str) -> Chord: ...
275
+ @overload
276
+ def applied(self, function: int, target: int) -> Chord: ...
277
+ def applied(self, function: Union[str, int], target: Union[str, int]) -> Chord: ...
278
+ @overload
279
+ def function(self, degree_or_chord: int) -> HarmonicFunction: ...
280
+ @overload
281
+ def function(self, degree_or_chord: str) -> Optional[HarmonicFunction]: ...
282
+ @overload
283
+ def function(self, degree_or_chord: Chord) -> Optional[HarmonicFunction]: ...
284
+ def function(self, degree_or_chord: Union[int, str, Chord]) -> Optional[HarmonicFunction]: ...
285
+ @overload
286
+ def role(self, degree_or_chord: int) -> str: ...
287
+ @overload
288
+ def role(self, degree_or_chord: str) -> Optional[str]: ...
289
+ @overload
290
+ def role(self, degree_or_chord: Chord) -> Optional[str]: ...
291
+ def role(self, degree_or_chord: Union[int, str, Chord]) -> Optional[str]: ...
292
+ def compare(self, a: Chord, b: Chord) -> FieldComparison: ...
293
+ def signature(self) -> int: ...
294
+ def relative(self) -> "Field": ...
295
+ def parallel(self) -> "Field": ...
296
+ def neighbors(self) -> Tuple["Field", "Field"]: ...
297
+ def size(self) -> int: ...
298
+ @staticmethod
299
+ def identify(items: Union[List[str], List[Note], List[Chord]]) -> "Field": ...
300
+ @staticmethod
301
+ def deduce(items: Union[List[str], List[Note], List[Chord]], limit: int = 10) -> List["FieldMatch"]: ...
302
+ def __repr__(self) -> str: ...
303
+ def __str__(self) -> str: ...
304
+ def __len__(self) -> int: ...
305
+ def __eq__(self, other: object) -> bool: ...
306
+ def __ne__(self, other: object) -> bool: ...
307
+ def __hash__(self) -> int: ...
308
+ def play(self, *, octave: int = 4, duration: float = 0.5, waveform: Union[Waveform, str] = ..., amplitude: float = 0.8, envelope: Optional[Envelope] = None, strum: float = 0.03, gap: float = 0.05, tuning: float = 440.0, sample_rate: int = 44100) -> None: ...
309
+ def to_wav(self, path: Union[str, Path], *, octave: int = 4, duration: float = 0.5, waveform: Union[Waveform, str] = ..., amplitude: float = 0.8, envelope: Optional[Envelope] = None, strum: float = 0.03, gap: float = 0.05, tuning: float = 440.0, sample_rate: int = 44100) -> None: ...
310
+ def __contains__(self, chord: Union[Chord, str]) -> bool: ...
311
+ def __iter__(self) -> Iterator[Chord]: ...
312
+ def __reversed__(self) -> Iterator[Chord]: ...
313
+ @overload
314
+ def __getitem__(self, index: int) -> Chord: ...
315
+ @overload
316
+ def __getitem__(self, index: slice) -> List[Chord]: ...
317
+ @overload
318
+ def __getitem__(self, roman: str) -> Chord: ...
319
+ @overload
320
+ def __getitem__(self, applied: Tuple[str, str]) -> Chord: ...
321
+ @overload
322
+ def __getitem__(self, applied: Tuple[str, int]) -> Chord: ...
323
+ @overload
324
+ def __getitem__(self, applied: Tuple[int, int]) -> Chord: ...
325
+
326
+ class FieldMatch:
327
+ field: Field
328
+ score: float
329
+ matched: int
330
+ total: int
331
+ roles: List[str]
332
+ def to_dict(self) -> Dict[str, Any]: ...
333
+ def __repr__(self) -> str: ...
334
+
335
+ class HarmonicPath:
336
+ id: int
337
+ branch: str
338
+ chord: Chord
339
+ interval_labels: List[str]
340
+ note_names: List[str]
341
+ def __repr__(self) -> str: ...
342
+
343
+ class Tree:
344
+ @overload
345
+ def __init__(self, tonic: str, type: ScaleType) -> None: ...
346
+ @overload
347
+ def __init__(self, tonic: str, type: str) -> None: ...
348
+ def tonic(self) -> Note: ...
349
+ def type(self) -> ScaleType: ...
350
+ def branches(self) -> List[str]: ...
351
+ def paths(self, branch_origin: str) -> List[HarmonicPath]: ...
352
+ def shortest_path(self, from_: str, to: str) -> List[str]: ...
353
+ def is_valid_progression(self, branches: List[str]) -> bool: ...
354
+ def function(self, branch: str) -> HarmonicFunction: ...
355
+ def branches_with_function(self, func: HarmonicFunction) -> List[str]: ...
356
+ def to_dot(self, show_functions: bool = False) -> str: ...
357
+ def to_mermaid(self) -> str: ...
358
+ def play(self, *, octave: int = 4, duration: float = 0.5, waveform: Union[Waveform, str] = ..., amplitude: float = 0.8, envelope: Optional[Envelope] = None, strum: float = 0.03, gap: float = 0.05, tuning: float = 440.0, sample_rate: int = 44100) -> None: ...
359
+ def to_wav(self, path: Union[str, Path], *, octave: int = 4, duration: float = 0.5, waveform: Union[Waveform, str] = ..., amplitude: float = 0.8, envelope: Optional[Envelope] = None, strum: float = 0.03, gap: float = 0.05, tuning: float = 440.0, sample_rate: int = 44100) -> None: ...
360
+ def __repr__(self) -> str: ...
361
+ def __str__(self) -> str: ...
362
+
363
+ class Duration:
364
+ @overload
365
+ def __init__(self, name: str, dots: int = 0, tuplet: int = 0) -> None: ...
366
+ @overload
367
+ def __init__(self, numerator: int, denominator: int) -> None: ...
368
+ def name(self) -> str: ...
369
+ def dots(self) -> int: ...
370
+ def tuplet(self) -> int: ...
371
+ def beats(self, reference_value: float = 1.0) -> float: ...
372
+ def rational(self) -> Tuple[int, int]: ...
373
+ def numerator(self) -> int: ...
374
+ def denominator(self) -> int: ...
375
+ @staticmethod
376
+ def standard_names() -> List[str]: ...
377
+ def __add__(self, other: "Duration") -> "Duration": ...
378
+ def __mul__(self, factor: float) -> "Duration": ...
379
+ def __eq__(self, other: object) -> bool: ...
380
+ def __ne__(self, other: object) -> bool: ...
381
+ def __lt__(self, other: "Duration") -> bool: ...
382
+ def __repr__(self) -> str: ...
383
+ def __str__(self) -> str: ...
384
+
385
+ class Tempo:
386
+ @overload
387
+ def __init__(self, bpm: float) -> None: ...
388
+ @overload
389
+ def __init__(self, marking: str) -> None: ...
390
+ def bpm(self) -> float: ...
391
+ def marking(self) -> str: ...
392
+ def seconds(self, duration: Duration) -> float: ...
393
+ def ms_per_beat(self) -> float: ...
394
+ @staticmethod
395
+ def bpm_to_marking(bpm: float) -> str: ...
396
+ @staticmethod
397
+ def marking_to_bpm(marking: str) -> float: ...
398
+ def __eq__(self, other: object) -> bool: ...
399
+ def __ne__(self, other: object) -> bool: ...
400
+ def __repr__(self) -> str: ...
401
+ def __str__(self) -> str: ...
402
+ def __float__(self) -> float: ...
403
+ def __int__(self) -> int: ...
404
+
405
+ class TimeSignature:
406
+ def __init__(self, beats_per_bar: int, beat_unit: int) -> None: ...
407
+ def beats_per_bar(self) -> int: ...
408
+ def beat_unit(self) -> int: ...
409
+ def signature(self) -> Tuple[int, int]: ...
410
+ def bar_duration(self) -> Duration: ...
411
+ def classification(self) -> str: ...
412
+ def common_name(self) -> str: ...
413
+ def __eq__(self, other: object) -> bool: ...
414
+ def __ne__(self, other: object) -> bool: ...
415
+ def __repr__(self) -> str: ...
416
+ def __str__(self) -> str: ...
417
+
418
+ class NoteEvent:
419
+ def __init__(self, note: Note, duration: Duration, octave: int = 4) -> None: ...
420
+ def note(self) -> Note: ...
421
+ def octave(self) -> int: ...
422
+ def midi_number(self) -> int: ...
423
+ def duration(self) -> Duration: ...
424
+ def frequency(self, tuning: float = 440.0) -> float: ...
425
+ def play(self, *, octave: int = 4, duration: float = 0.5, waveform: Union[Waveform, str] = ..., amplitude: float = 0.8, envelope: Optional[Envelope] = None, strum: float = 0.03, gap: float = 0.05, tuning: float = 440.0, sample_rate: int = 44100) -> None: ...
426
+ def to_wav(self, path: Union[str, Path], *, octave: int = 4, duration: float = 0.5, waveform: Union[Waveform, str] = ..., amplitude: float = 0.8, envelope: Optional[Envelope] = None, strum: float = 0.03, gap: float = 0.05, tuning: float = 440.0, sample_rate: int = 44100) -> None: ...
427
+ def __eq__(self, other: object) -> bool: ...
428
+ def __ne__(self, other: object) -> bool: ...
429
+ def __repr__(self) -> str: ...
430
+ def __str__(self) -> str: ...
431
+
432
+ class ChordEvent:
433
+ def __init__(self, chord: Chord, duration: Duration, octave: int = 4) -> None: ...
434
+ def chord(self) -> Chord: ...
435
+ def octave(self) -> int: ...
436
+ def duration(self) -> Duration: ...
437
+ def note_events(self) -> List[NoteEvent]: ...
438
+ def play(self, *, octave: int = 4, duration: float = 0.5, waveform: Union[Waveform, str] = ..., amplitude: float = 0.8, envelope: Optional[Envelope] = None, strum: float = 0.03, gap: float = 0.05, tuning: float = 440.0, sample_rate: int = 44100) -> None: ...
439
+ def to_wav(self, path: Union[str, Path], *, octave: int = 4, duration: float = 0.5, waveform: Union[Waveform, str] = ..., amplitude: float = 0.8, envelope: Optional[Envelope] = None, strum: float = 0.03, gap: float = 0.05, tuning: float = 440.0, sample_rate: int = 44100) -> None: ...
440
+ def __eq__(self, other: object) -> bool: ...
441
+ def __ne__(self, other: object) -> bool: ...
442
+ def __repr__(self) -> str: ...
443
+ def __str__(self) -> str: ...
444
+
445
+ class Rest:
446
+ def __init__(self, duration: Duration) -> None: ...
447
+ def duration(self) -> Duration: ...
448
+ def play(self, *, octave: int = 4, duration: float = 0.5, waveform: Union[Waveform, str] = ..., amplitude: float = 0.8, envelope: Optional[Envelope] = None, strum: float = 0.03, gap: float = 0.05, tuning: float = 440.0, sample_rate: int = 44100) -> None: ...
449
+ def to_wav(self, path: Union[str, Path], *, octave: int = 4, duration: float = 0.5, waveform: Union[Waveform, str] = ..., amplitude: float = 0.8, envelope: Optional[Envelope] = None, strum: float = 0.03, gap: float = 0.05, tuning: float = 440.0, sample_rate: int = 44100) -> None: ...
450
+ def __eq__(self, other: object) -> bool: ...
451
+ def __ne__(self, other: object) -> bool: ...
452
+ def __repr__(self) -> str: ...
453
+ def __str__(self) -> str: ...
454
+
455
+ class Sequence:
456
+ def __init__(self, tempo: Tempo = ..., time_signature: TimeSignature = ...) -> None: ...
457
+ def tempo(self) -> Tempo: ...
458
+ def set_tempo(self, tempo: Tempo) -> None: ...
459
+ def time_signature(self) -> TimeSignature: ...
460
+ def set_time_signature(self, ts: TimeSignature) -> None: ...
461
+ def add(self, event: Union[NoteEvent, ChordEvent, Rest]) -> None: ...
462
+ def remove(self, index: int) -> None: ...
463
+ def clear(self) -> None: ...
464
+ def total_duration(self) -> float: ...
465
+ def total_seconds(self) -> float: ...
466
+ def bar_count(self) -> int: ...
467
+ def transpose(self, semitones: int) -> "Sequence": ...
468
+ def play(self, *, octave: int = 4, duration: float = 0.5, waveform: Union[Waveform, str] = ..., amplitude: float = 0.8, envelope: Optional[Envelope] = None, strum: float = 0.03, gap: float = 0.05, tuning: float = 440.0, sample_rate: int = 44100) -> None: ...
469
+ def to_wav(self, path: Union[str, Path], *, octave: int = 4, duration: float = 0.5, waveform: Union[Waveform, str] = ..., amplitude: float = 0.8, envelope: Optional[Envelope] = None, strum: float = 0.03, gap: float = 0.05, tuning: float = 440.0, sample_rate: int = 44100) -> None: ...
470
+ def __len__(self) -> int: ...
471
+ @overload
472
+ def __getitem__(self, index: int) -> Union[NoteEvent, ChordEvent, Rest]: ...
473
+ def __eq__(self, other: object) -> bool: ...
474
+ def __ne__(self, other: object) -> bool: ...
475
+ def __repr__(self) -> str: ...
476
+ def __str__(self) -> str: ...