devela/media/audio/drum_machine.rs
1// devela::media::audio::drum_machine
2//
3//!
4//
5// TODO
6// - DrumGrid
7// - DrumFlags
8//
9// - Define subsets
10// - 8-bit
11// - 16-bit
12// - 128-bit full? GM?
13
14// - convert From and TryFrom 8 and 16)
15// - [ ] define docs with CONST macro.
16// - enum DrumEvent MAYBE
17// - parser from str
18
19#![allow(unused, reason = "WIP")]
20
21#[cfg(_bit··)]
22use crate::{bitfield, enumset};
23
24#[cfg(feature = "_bit_u8")]
25bitfield! {
26 /// A set of 8 drum instruments.
27 pub struct DrumFrame8(u8) {
28 /* Cymbals */
29
30 /// Cymbal.
31 ///
32 /// Ride or crash cymbal, depending on context.
33 ///
34 /// Adds texture and color, often marking transitions or downbeats.
35 CY: 0;
36
37 /// Closed Hi-Hat.
38 ///
39 /// A hi-hat played with the cymbals closed. Produces a short, crisp "chick" sound.
40 ///
41 /// Drives the rhythm with a tight, precise feel.
42 CH: 1;
43 /// Open Hi-Hat.
44 ///
45 /// A hi-hat played with the cymbals slightly apart. Produces a longer, sustaining sound.
46 ///
47 /// Adds variation and accentuates beats or fills.
48 OH: 2;
49
50 /* Drums */
51
52 /// Bass Drum.
53 ///
54 /// The largest drum, played with a foot pedal, producing a deep, resonant sound.
55 ///
56 /// Anchors the rhythm, often providing the downbeat in patterns.
57 BD: 3;
58 /// Snare Drum.
59 ///
60 /// A drum with snares (metal wires) underneath, producing a sharp, cracking sound.
61 ///
62 /// Central to most drum patterns, providing backbeat on the 2nd and 4th beats in 4/4 time.
63 SD: 4;
64
65 /* Toms */
66
67 /// Low Tom.
68 ///
69 /// The largest and lowest-pitched tom in a drum set (sometimes called the floor tom).
70 ///
71 /// Adds weight and depth, commonly used in fills and breakdowns.
72 LT: 5;
73
74 /* Auxiliary */
75
76 /// Claps.
77 ///
78 /// A synthesized or sampled handclap sound.
79 ///
80 /// Provides a human touch to electronic grooves or reinforces the snare in patterns.
81 CPS: 6;
82
83 /// Cowbell.
84 ///
85 /// A metallic percussion instrument producing a distinct, ringing tone.
86 ///
87 /// Adds syncopation or an off-beat feel, famously used in Latin and funk rhythms.
88 CB: 7;
89
90 /* masks */
91
92 /// Cymbals.
93 CYMBALS: 0, 2;
94
95 /// Drums.
96 DRUMS: 3, 4;
97
98 /// Toms.
99 TOMS: 5;
100
101 /// Auxiliary percussion.
102 AUXILIARY: 6, 7;
103 }
104}
105
106#[cfg(feature = "_bit_u16")]
107bitfield! {
108 /// A set of 16 drum instruments.
109 pub struct DrumFrame16(u16) {
110 /* Cymbals */
111
112 /// Cymbal.
113 ///
114 /// Ride or crash cymbal, depending on context.
115 ///
116 /// Adds texture and color, often marking transitions or downbeats.
117 CY: 0;
118
119 /// Closed Hi-Hat.
120 ///
121 /// A hi-hat played with the cymbals closed. Produces a short, crisp "chick" sound.
122 ///
123 /// Drives the rhythm with a tight, precise feel.
124 CH: 1;
125 /// Open Hi-Hat.
126 ///
127 /// A hi-hat played with the cymbals slightly apart. Produces a longer, sustaining sound.
128 ///
129 /// Adds variation and accentuates beats or fills.
130 OH: 2;
131
132 /// Splash Cymbal.
133 ///
134 /// A small cymbal with a short, bright sound for quick accents.
135 ///
136 /// Provides a quick, bright accent, frequently used in transitions.
137 SP: 3;
138
139 /* Drums */
140
141 /// Bass Drum.
142 ///
143 /// The largest drum, played with a foot pedal, producing a deep, resonant sound.
144 ///
145 /// Anchors the rhythm, often providing the downbeat in patterns.
146 BD: 4;
147 /// Snare Drum.
148 ///
149 /// A drum with snares (metal wires) underneath, producing a sharp, cracking sound.
150 ///
151 /// Central to most drum patterns, providing backbeat on the 2nd and 4th beats in 4/4 time.
152 SD: 5;
153 /// Rim Shot.
154 ///
155 /// A snare drum technique where the stick strikes both the rim and the head simultaneously.
156 ///
157 /// Adds a louder, more emphatic snare hit for accents or dynamic variation.
158 RS: 6;
159
160 /* Toms */
161
162 /// High Tom.
163 ///
164 /// The smallest and highest-pitched tom in a drum set.
165 ///
166 /// Adds melodic or percussive fills, often used for quick accents.
167 HT: 7;
168 /// Mid Tom.
169 ///
170 /// A tom with a pitch between the high tom and low tom.
171 ///
172 /// Bridges the high and low toms in fills, creating smoother transitions.
173 MT: 8;
174 /// Low Tom.
175 ///
176 /// The largest and lowest-pitched tom in a drum set (sometimes called the floor tom).
177 ///
178 /// Adds weight and depth, commonly used in fills and breakdowns.
179 LT: 9;
180
181 /* Auxiliary */
182
183 /// Accent (dynamic marking).
184 ///
185 /// A non-pitched percussive hit used to emphasize specific beats in the rhythm.
186 ///
187 /// Provides dynamic emphasis in patterns, helping to punctuate the groove.
188 AC: 10;
189
190 /// Claps.
191 ///
192 /// A synthesized or sampled handclap sound.
193 ///
194 /// Provides a human touch to electronic grooves or reinforces the snare in patterns.
195 CPS: 11;
196
197 /// Cowbell.
198 ///
199 /// A metallic percussion instrument producing a distinct, ringing tone.
200 ///
201 /// Adds syncopation or an off-beat feel, famously used in Latin and funk rhythms.
202 CB: 12;
203
204 /* other */
205
206 /// Tambourine.
207 ///
208 /// Produces a jingling sound from its zills (metal discs).
209 ///
210 /// Often used for embellishment or to add a rhythmic shimmer or subdivision.
211 TAM: 13;
212
213 /// Shaker.
214 ///
215 /// Complements patterns with soft, steady motion, often for 16th-note grooves.
216 SH: 14;
217
218 /// Woodblock
219 ///
220 /// A sharp, percussive sound used in many styles, especially electronic music.
221 WB: 15;
222
223 /* Extra that don't fit */
224
225 // /// Clave
226 // CL: 16;
227
228 // /// Triangle.
229 // TR: 17;
230
231 /* masks */
232
233 /// Cymbals.
234 CYMBALS: 0, 3;
235
236 /// Drums.
237 DRUMS: 4, 6;
238
239 /// Toms.
240 TOMS: 7, 9;
241
242 /// Auxiliary percussion.
243 AUXILIARY: 10, 15;
244
245 // /// High-Hat (either open or closed)
246 // HH: 2, 3;
247 }
248}
249
250/* dynamics */
251// * Accent:
252// - Flam: A rapid grace note before the main hit, often used on snare or toms.
253// - Ghost Note: A very soft hit, often on the snare.
254// - Roll: A series of rapid hits, typically used on snare or toms.
255// - Velocity: Low
256// - Velocity: Medium
257// - Velocity: High
258// - Choke: Muting a cymbal immediately after striking it.?