| |
- builtins.object
-
- Keyboard
class Keyboard(builtins.object) |
|
Keyboard(synth, tuning=440)
|
|
Methods defined here:
- __init__(self, synth, tuning=440)
- Initialize self. See help(type(self)) for accurate signature.
- keyfrequency(self, n)
- frequency of key number n.
keyfrequency(49) --> 440 (in standard tuning)
- keynum(self, pitch)
- key number corresponding to scientific pitch
e.g. keynum("A4") --> 49
- play_chord(self, basepitch, intervals, duration)
- play notes in chord
pre: basepitch is a pitch string and intervals is a list of ints >= 0
post: returns a SoundWave of simultaneous notes consisting specified by
the keynum of basepitch + some i in intervals (i.e. a chord).
Note: intervals are half-steps, so a c-major chord starting at middle
C is play_chord("C4", [0, 4, 7]).
- play_key(self, keynum, duration)
- play key designated by keynum for duration
pre: keynum is an int from 1 to 88 and duration is time in seconds
post: returns SoundWave of the give keynum and duration
- play_keys(self, keys, duration)
- play keys simultaneously
pre: keys is a list of key numbers, duration is time in seconds
post: returns a SoundWave of keys played simulatneously
- play_note(self, pitch, duration)
- play note corresponding to scientific pitch
pre: pitch is a scientific pitch string, duration is time in seconds
post: returns SoundWave of key correspoinding the scientific pitch
- play_notes(self, notes, duration)
- play notes simultaneously
pre: notes is a list of pitch strings and duration is in seconds
pre: returns a SoundWave of the notes being played simulatneously
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
| |