Spaces:
Running
Running
File size: 4,140 Bytes
055747e 9ccc1e0 055747e 9ccc1e0 055747e 9ccc1e0 055747e 9ccc1e0 055747e 9ccc1e0 055747e 9ccc1e0 055747e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | """
Virtual MIDI Keyboard Configuration
Centralized configuration for instruments, keyboard layout, and defaults.
This is the single source of truth for all settings.
"""
# =============================================================================
# KEYBOARD LAYOUT
# =============================================================================
KEYBOARD_BASE_MIDI = 60 # C4
KEYBOARD_OCTAVES = 2
KEYBOARD_POLYPHONY = 24
# Keyboard key layout (white keys first, then black keys in order)
KEYBOARD_KEYS = [
{"midi": 60, "name": "C4", "type": "white"},
{"midi": 61, "name": "C#4", "type": "black"},
{"midi": 62, "name": "D4", "type": "white"},
{"midi": 63, "name": "D#4", "type": "black"},
{"midi": 64, "name": "E4", "type": "white"},
{"midi": 65, "name": "F4", "type": "white"},
{"midi": 66, "name": "F#4", "type": "black"},
{"midi": 67, "name": "G4", "type": "white"},
{"midi": 68, "name": "G#4", "type": "black"},
{"midi": 69, "name": "A4", "type": "white"},
{"midi": 70, "name": "A#4", "type": "black"},
{"midi": 71, "name": "B4", "type": "white"},
{"midi": 72, "name": "C5", "type": "white"},
{"midi": 73, "name": "C#5", "type": "black"},
{"midi": 74, "name": "D5", "type": "white"},
{"midi": 75, "name": "D#5", "type": "black"},
{"midi": 76, "name": "E5", "type": "white"},
{"midi": 77, "name": "F5", "type": "white"},
{"midi": 78, "name": "F#5", "type": "black"},
{"midi": 79, "name": "G5", "type": "white"},
{"midi": 80, "name": "G#5", "type": "black"},
{"midi": 81, "name": "A5", "type": "white"},
{"midi": 82, "name": "A#5", "type": "black"},
{"midi": 83, "name": "B5", "type": "white"},
]
# Computer keyboard shortcuts to MIDI notes
KEYBOARD_SHORTCUTS = {
# First octave (C4-B4)
60: "A", # C4
61: "W", # C#4
62: "S", # D4
63: "E", # D#4
64: "D", # E4
65: "F", # F4
66: "T", # F#4
67: "G", # G4
68: "Y", # G#4
69: "H", # A4
70: "U", # A#4
71: "J", # B4
# Second octave (C5-E5)
72: "K", # C5
73: "O", # C#5
74: "L", # D5
75: "P", # D#5
76: ";", # E5
}
# =============================================================================
# MIDI DEFAULTS
# =============================================================================
MIDI_DEFAULTS = {
"tempo_bpm": 120,
"ticks_per_beat": 480,
"velocity_default": 100,
}
# =============================================================================
# INSTRUMENTS
# =============================================================================
INSTRUMENTS = {
"synth": {
"name": "Synth",
"type": "Synth",
"oscillator": "sine",
"envelope": {
"attack": 0.005,
"decay": 0.1,
"sustain": 0.3,
"release": 0.2,
},
},
"piano": {
"name": "Piano",
"type": "Synth",
"oscillator": "triangle",
"envelope": {
"attack": 0.001,
"decay": 0.2,
"sustain": 0.1,
"release": 0.3,
},
},
"organ": {
"name": "Organ",
"type": "Synth",
"oscillator": "sine4",
"envelope": {
"attack": 0.001,
"decay": 0.0,
"sustain": 1.0,
"release": 0.1,
},
},
"bass": {
"name": "Bass",
"type": "Synth",
"oscillator": "sawtooth",
"envelope": {
"attack": 0.01,
"decay": 0.1,
"sustain": 0.4,
"release": 0.3,
},
},
"pluck": {
"name": "Pluck",
"type": "Synth",
"oscillator": "triangle",
"envelope": {
"attack": 0.001,
"decay": 0.3,
"sustain": 0.0,
"release": 0.3,
},
},
"fm": {
"name": "FM Synth",
"type": "FMSynth",
"harmonicity": 3,
"modulationIndex": 10,
"envelope": {
"attack": 0.01,
"decay": 0.2,
"sustain": 0.2,
"release": 0.2,
},
},
}
|