電子楽器CAmiDionのArduinoスケッチ(C++)です。回路図も置いてあります。
Revisão | 13f2c2577fb09ed88112d8bdba71fbcf28e847ab (tree) |
---|---|
Hora | 2016-04-23 13:39:42 |
Autor | Akiyoshi Kamide <kamide@yk.r...> |
Commiter | Akiyoshi Kamide |
[BUGFIX] 波形を先頭から戻って最後に行こうとすると文字化けするバグの修正
音色テーブルのチューニング
CAmiDionConfig.hの誤記修正
@@ -1,6 +1,6 @@ | ||
1 | 1 | // |
2 | 2 | // CAmiDion - Musical Chord Instrument |
3 | -// ver.20160422 | |
3 | +// ver.20160423 | |
4 | 4 | // by Akiyoshi Kamide (Twitter: @akiyoshi_kamide) |
5 | 5 | // http://kamide.b.osdn.me/camidion/ |
6 | 6 | // http://osdn.jp/users/kamide/pf/CAmiDion/ |
@@ -109,9 +109,8 @@ class WaveSelecter { | ||
109 | 109 | void changeWaveform(char offset) { |
110 | 110 | if( ! offset ) return; |
111 | 111 | MidiChannel *cp = PWMDACSynth::getChannel(current_midi_channel); |
112 | - for( byte i = 0; i < NumberOf(wavetables); i++ ) { | |
113 | - if( (PROGMEM const byte *)pgm_read_word(wavetables + i) != cp->wavetable ) | |
114 | - continue; | |
112 | + for( char i = 0; i < NumberOf(wavetables); i++ ) { | |
113 | + if( (PROGMEM const byte *)pgm_read_word(wavetables + i) != cp->wavetable ) continue; | |
115 | 114 | if ( (i += offset) < 0) i += NumberOf(wavetables); |
116 | 115 | else if (i >= NumberOf(wavetables)) i -= NumberOf(wavetables); |
117 | 116 | cp->wavetable = (PROGMEM const byte *)pgm_read_word(wavetables + i); |
@@ -50,7 +50,7 @@ | ||
50 | 50 | #define DRUM_VELOCITY 100 |
51 | 51 | // Drum |
52 | 52 | #define DRUM_NOTE_NUMBER 36 // Bass Drum 1 |
53 | -#define DRUM_MIDI_CHANNEL 10; | |
53 | +#define DRUM_MIDI_CHANNEL 10 | |
54 | 54 | |
55 | 55 | //////////////////////////////////////////////////////// |
56 | 56 | // Automatic definition |
@@ -1,149 +1,166 @@ | ||
1 | 1 | |
2 | 2 | #if defined(OCTAVE_ANALOG_PIN) |
3 | +// General MIDI instruments | |
3 | 4 | PROGMEM const Instrument instruments[] = { |
5 | + // Piano | |
4 | 6 | {sawtoothWavetable, {9, 0, 11, 4}}, |
5 | 7 | {sawtoothWavetable, {9, 0, 11, 4}}, |
6 | 8 | {sawtoothWavetable, {9, 0, 11, 4}}, |
7 | 9 | {sawtoothWavetable, {9, 0, 11, 4}}, |
10 | + {guitarWavetable, {9, 0, 11, 4}}, | |
11 | + {sawtoothWavetable, {9, 0, 10, 4}}, | |
8 | 12 | {sawtoothWavetable, {9, 0, 11, 4}}, |
9 | - {sawtoothWavetable, {9, 0, 11, 4}}, | |
10 | - {sawtoothWavetable, {9, 0, 11, 4}}, | |
11 | - {sawtoothWavetable, {9, 0, 11, 4}}, | |
13 | + {sawtoothWavetable, {8, 0, 10, 4}}, | |
12 | 14 | |
15 | + // Chromatic Percussion | |
16 | + {sawtoothWavetable, {9, 0, 10, 4}}, | |
13 | 17 | {sineWavetable, {9, 0, 11, 4}}, |
14 | - {sineWavetable, {9, 0, 11, 4}}, | |
15 | - {sineWavetable, {9, 0, 9, 4}}, | |
18 | + {sineWavetable, {9, 0, 10, 3}}, | |
16 | 19 | {sineWavetable, {9, 0, 11, 4}}, |
17 | 20 | {sineWavetable, {8, 0, 8, 4}}, |
18 | 21 | {sineWavetable, {7, 0, 7, 4}}, |
19 | 22 | {sawtoothWavetable, {9, 0, 11, 4}}, |
20 | 23 | {sawtoothWavetable, {9, 0, 9, 4}}, |
21 | 24 | |
25 | + // Organ | |
22 | 26 | {guitarWavetable, {9, 255, 11, 4}}, |
23 | 27 | {sawtoothWavetable, {9, 255, 11, 4}}, |
24 | 28 | {guitarWavetable, {9, 255, 11, 4}}, |
25 | - {guitarWavetable, {9, 255, 11, 4}}, | |
26 | - {guitarWavetable, {9, 255, 11, 4}}, | |
27 | - {sawtoothWavetable, {9, 255, 11, 4}}, | |
28 | 29 | {sawtoothWavetable, {9, 255, 11, 4}}, |
29 | - {sawtoothWavetable, {9, 255, 11, 9}}, | |
30 | + {sawtoothWavetable, {9, 255, 11, 6}}, | |
31 | + {sawtoothWavetable, {9, 255, 11, 8}}, | |
32 | + {sawtoothWavetable, {9, 255, 11, 6}}, | |
33 | + {sawtoothWavetable, {9, 255, 11, 6}}, | |
30 | 34 | |
35 | + // Guitar | |
31 | 36 | {guitarWavetable, {9, 0, 11, 4}}, |
32 | 37 | {sawtoothWavetable, {9, 0, 11, 4}}, |
33 | 38 | {guitarWavetable, {9, 0, 11, 4}}, |
34 | 39 | {sawtoothWavetable, {9, 0, 11, 4}}, |
35 | - {sawtoothWavetable, {9, 0, 11, 4}}, | |
36 | - {randomWavetable, {9, 0, 10, 4}}, | |
40 | + {guitarWavetable, {9, 0, 11, 4}}, | |
41 | + {sawtoothWavetable, {9, 0, 10, 4}}, | |
37 | 42 | {sawtoothWavetable, {9, 0, 11, 4}}, |
38 | 43 | {randomWavetable, {9, 8, 10, 4}}, |
39 | 44 | |
45 | + // Bass | |
40 | 46 | {guitarWavetable, {9, 0, 11, 4}}, |
41 | 47 | {guitarWavetable, {9, 0, 11, 4}}, |
42 | - {guitarWavetable, {9, 0, 11, 4}}, | |
43 | - {guitarWavetable, {9, 0, 11, 4}}, | |
48 | + {guitarWavetable, {9, 192, 9, 3}}, | |
49 | + {guitarWavetable, {9, 192, 9, 6}}, | |
44 | 50 | {sawtoothWavetable, {9, 0, 11, 4}}, |
45 | 51 | {sawtoothWavetable, {9, 0, 11, 4}}, |
46 | - {sawtoothWavetable, {9, 8, 10, 4}}, | |
47 | - {guitarWavetable, {9, 15, 11, 9}}, | |
52 | + {sawtoothWavetable, {9, 128, 10, 4}}, | |
53 | + {sawtoothWavetable, {9, 192, 11, 4}}, | |
48 | 54 | |
49 | - {sawtoothWavetable, {9, 255, 11, 4}}, | |
50 | - {sawtoothWavetable, {9, 255, 11, 4}}, | |
51 | - {sawtoothWavetable, {9, 255, 11, 4}}, | |
52 | - {sawtoothWavetable, {9, 255, 11, 4}}, | |
53 | - {sawtoothWavetable, {9, 255, 11, 4}}, | |
54 | - {sawtoothWavetable, {8, 255, 8, 4}}, | |
55 | - {sineWavetable, {9, 0, 10, 4}}, | |
56 | - {randomWavetable, {9, 0, 10, 4}}, | |
55 | + // Strings | |
56 | + {sawtoothWavetable, {9, 255, 10, 6}}, | |
57 | + {sawtoothWavetable, {9, 255, 10, 6}}, | |
58 | + {sawtoothWavetable, {9, 255, 10, 6}}, | |
59 | + {sawtoothWavetable, {9, 255, 10, 6}}, | |
60 | + {guitarWavetable, {9, 255, 11, 6}}, | |
61 | + {sawtoothWavetable, {8, 0, 8, 4}}, | |
62 | + {sineWavetable, {9, 0, 11, 4}}, | |
63 | + {randomWavetable, {9, 0, 10, 3}}, | |
57 | 64 | |
65 | + // Ensemble | |
58 | 66 | {triangleWavetable, {9, 255, 11, 6}}, |
59 | - {triangleWavetable, {9, 255, 11, 11}}, | |
60 | 67 | {triangleWavetable, {9, 255, 11, 9}}, |
68 | + {triangleWavetable, {9, 255, 11, 6}}, | |
61 | 69 | {triangleWavetable, {9, 255, 11, 7}}, |
62 | - {guitarWavetable, {9, 255, 11, 9}}, | |
63 | - {sawtoothWavetable, {9, 255, 11, 9}}, | |
64 | - {sineWavetable, {9, 255, 11, 9}}, | |
65 | - {squareWavetable, {8, 0, 9, 3}}, | |
66 | - | |
67 | - {sawtoothWavetable, {9, 255, 11, 4}}, | |
68 | - {sawtoothWavetable, {9, 255, 11, 4}}, | |
69 | - {sawtoothWavetable, {9, 255, 11, 4}}, | |
70 | - {sawtoothWavetable, {9, 255, 11, 4}}, | |
71 | 70 | {guitarWavetable, {9, 255, 11, 4}}, |
72 | - {sawtoothWavetable, {9, 255, 11, 4}}, | |
73 | - {sawtoothWavetable, {9, 255, 11, 4}}, | |
74 | - {guitarWavetable, {9, 255, 11, 4}}, | |
75 | - | |
76 | - {guitarWavetable, {9, 255, 11, 4}}, | |
77 | - {sawtoothWavetable, {9, 255, 11, 4}}, | |
78 | - {sawtoothWavetable, {9, 255, 11, 4}}, | |
79 | - {sawtoothWavetable, {9, 255, 11, 4}}, | |
80 | - {sawtoothWavetable, {9, 255, 11, 4}}, | |
81 | - {sawtoothWavetable, {9, 255, 11, 4}}, | |
82 | - {sawtoothWavetable, {9, 255, 11, 4}}, | |
83 | - {triangleWavetable, {9, 255, 11, 4}}, | |
84 | - | |
85 | - {guitarWavetable, {9, 255, 11, 9}}, | |
86 | - {guitarWavetable, {9, 255, 11, 9}}, | |
87 | - {sineWavetable, {9, 255, 11, 9}}, | |
88 | - {triangleWavetable, {9, 255, 11, 9}}, | |
89 | - {randomWavetable, {9, 255, 11, 9}}, | |
90 | - {triangleWavetable, {9, 255, 11, 9}}, | |
91 | - {sineWavetable, {9, 255, 11, 9}}, | |
92 | - {sineWavetable, {9, 255, 11, 8}}, | |
71 | + {sawtoothWavetable, {9, 128, 9, 4}}, | |
72 | + {sineWavetable, {9, 255, 11, 4}}, | |
73 | + {squareWavetable, {8, 0, 9, 3}}, | |
93 | 74 | |
94 | - {squareWavetable, {9, 255, 11, 4}}, | |
75 | + // Brass | |
76 | + {sawtoothWavetable, {9, 255, 11, 6}}, | |
77 | + {sawtoothWavetable, {9, 255, 11, 6}}, | |
78 | + {sawtoothWavetable, {9, 255, 11, 6}}, | |
79 | + {sawtoothWavetable, {9, 255, 11, 6}}, | |
80 | + {guitarWavetable, {9, 255, 11, 7}}, | |
81 | + {sawtoothWavetable, {9, 128, 9, 5}}, | |
82 | + {sawtoothWavetable, {9, 192, 9, 5}}, | |
83 | + {guitarWavetable, {9, 192, 10, 5}}, | |
84 | + | |
85 | + // Reed | |
86 | + {guitarWavetable, {9, 255, 11, 6}}, | |
87 | + {sawtoothWavetable, {9, 255, 11, 6}}, | |
88 | + {sawtoothWavetable, {9, 255, 11, 6}}, | |
89 | + {sawtoothWavetable, {9, 255, 11, 6}}, | |
90 | + {sawtoothWavetable, {9, 255, 11, 6}}, | |
95 | 91 | {sawtoothWavetable, {9, 255, 11, 4}}, |
96 | - {triangleWavetable, {9, 255, 11, 4}}, | |
97 | - {triangleWavetable, {9, 128, 8, 4}}, | |
98 | - {sawtoothWavetable, {9, 128, 8, 4}}, | |
99 | - {sawtoothWavetable, {9, 128, 8, 4}}, | |
100 | - {guitarWavetable, {9, 255, 11, 4}}, | |
101 | 92 | {sawtoothWavetable, {9, 255, 11, 4}}, |
93 | + {triangleWavetable, {9, 255, 11, 5}}, | |
102 | 94 | |
95 | + // Pipe | |
103 | 96 | {guitarWavetable, {9, 255, 11, 6}}, |
104 | - {guitarWavetable, {9, 255, 11, 11}}, | |
105 | - {guitarWavetable, {4, 128, 8, 9}}, | |
97 | + {guitarWavetable, {9, 255, 11, 7}}, | |
98 | + {sineWavetable, {9, 255, 11, 6}}, | |
99 | + {triangleWavetable, {9, 255, 11, 7}}, | |
100 | + {randomWavetable, {9, 128, 10, 6}}, | |
101 | + {triangleWavetable, {9, 255, 11, 7}}, | |
102 | + {sineWavetable, {9, 255, 11, 7}}, | |
103 | + {sineWavetable, {9, 255, 11, 7}}, | |
104 | + | |
105 | + // Synth Lead | |
106 | + {squareWavetable, {9, 255, 11, 3}}, | |
107 | + {sawtoothWavetable, {9, 255, 11, 3}}, | |
108 | + {triangleWavetable, {9, 255, 11, 5}}, | |
109 | + {triangleWavetable, {9, 128, 8, 6}}, | |
110 | + {sawtoothWavetable, {9, 192, 8, 5}}, | |
111 | + {sawtoothWavetable, {9, 192, 8, 5}}, | |
112 | + {guitarWavetable, {9, 192, 11, 5}}, | |
113 | + {sawtoothWavetable, {9, 255, 11, 3}}, | |
114 | + | |
115 | + // Synth Pad | |
116 | + {guitarWavetable, {9, 255, 11, 5}}, | |
117 | + {guitarWavetable, {9, 255, 11, 9}}, | |
118 | + {guitarWavetable, {4, 192, 9, 4}}, | |
106 | 119 | {guitarWavetable, {9, 255, 11, 6}}, |
107 | - {guitarWavetable, {9, 128, 8, 4}}, | |
108 | - {sawtoothWavetable, {9, 255, 11, 11}}, | |
120 | + {guitarWavetable, {9, 192, 10, 8}}, | |
121 | + {sawtoothWavetable, {9, 255, 11, 10}}, | |
122 | + {guitarWavetable, {9, 255, 11, 8}}, | |
109 | 123 | {sawtoothWavetable, {9, 255, 11, 10}}, |
110 | - {sawtoothWavetable, {9, 255, 11, 11}}, | |
111 | 124 | |
112 | - {sawtoothWavetable, {9, 128, 8, 4}}, | |
113 | - {sawtoothWavetable, {9, 255, 11, 11}}, | |
114 | - {sawtoothWavetable, {9, 128, 8, 4}}, | |
115 | - {guitarWavetable, {9, 128, 8, 4}}, | |
116 | - {sawtoothWavetable, {9, 0, 11, 4}}, | |
117 | - {sawtoothWavetable, {9, 255, 11, 11}}, | |
125 | + // Synth Effects | |
126 | + {guitarWavetable, {9, 128, 9, 4}}, | |
127 | + {sawtoothWavetable, {9, 128, 10, 10}}, | |
128 | + {triangleWavetable, {9, 192, 8, 4}}, | |
129 | + {guitarWavetable, {9, 0, 11, 4}}, | |
130 | + {sawtoothWavetable, {10, 0, 11, 3}}, | |
131 | + {triangleWavetable, {9, 0, 11, 10}}, | |
118 | 132 | {guitarWavetable, {9, 255, 11, 4}}, |
119 | - {sawtoothWavetable, {9, 0, 11, 4}}, | |
133 | + {sawtoothWavetable, {9, 255, 11, 6}}, | |
120 | 134 | |
135 | + // Ethnic | |
121 | 136 | {sawtoothWavetable, {9, 0, 11, 4}}, |
122 | 137 | {sawtoothWavetable, {9, 0, 11, 4}}, |
123 | - {sawtoothWavetable, {9, 0, 11, 4}}, | |
138 | + {sawtoothWavetable, {9, 0, 9, 4}}, | |
124 | 139 | {sawtoothWavetable, {9, 0, 11, 4}}, |
125 | 140 | {sawtoothWavetable, {8, 0, 8, 4}}, |
126 | - {sawtoothWavetable, {9, 0, 11, 4}}, | |
127 | - {sawtoothWavetable, {9, 0, 11, 4}}, | |
128 | - {sawtoothWavetable, {9, 0, 11, 4}}, | |
141 | + {sawtoothWavetable, {9, 255, 11, 6}}, | |
142 | + {sawtoothWavetable, {9, 255, 11, 6}}, | |
143 | + {sawtoothWavetable, {9, 255, 11, 6}}, | |
129 | 144 | |
130 | - {squareWavetable, {9, 0, 11, 4}}, | |
145 | + // Percussive | |
146 | + {squareWavetable, {9, 64, 9, 4}}, | |
131 | 147 | {sawtoothWavetable, {8, 0, 8, 4}}, |
132 | - {guitarWavetable, {9, 0, 11, 4}}, | |
148 | + {guitarWavetable, {9, 0, 11, 5}}, | |
133 | 149 | {sineWavetable, {8, 0, 8, 4}}, |
134 | 150 | {randomWavetable, {8, 0, 8, 4}}, |
135 | - {sineWavetable, {8, 0, 8, 4}}, | |
151 | + {triangleWavetable, {8, 0, 8, 4}}, | |
136 | 152 | {randomWavetable, {8, 0, 8, 4}}, |
137 | - {randomWavetable, {8, 255, 8, 14}}, | |
153 | + {randomWavetable, {8, 255, 7, 12}}, | |
138 | 154 | |
155 | + // Sound Effects | |
139 | 156 | {randomWavetable, {8, 0, 8, 4}}, |
140 | 157 | {randomWavetable, {8, 0, 8, 4}}, |
141 | - {randomWavetable, {10, 8, 10, 13}}, | |
158 | + {randomWavetable, {10, 64, 12, 12}}, | |
142 | 159 | {sineWavetable, {9, 255, 11, 4}}, |
143 | - {sawtoothWavetable, {9, 255, 11, 4}}, | |
144 | - {randomWavetable, {9, 255, 11, 13}}, | |
145 | - {randomWavetable, {10, 128, 10, 13}}, | |
146 | - {randomWavetable, {9, 0, 9, 3}}, | |
160 | + {randomWavetable, {9, 255, 11, 4}}, | |
161 | + {randomWavetable, {9, 255, 11, 12}}, | |
162 | + {randomWavetable, {10, 255, 10, 11}}, | |
163 | + {randomWavetable, {9, 0, 10, 3}}, | |
147 | 164 | }; |
148 | 165 | #endif |
149 | 166 |