alesis-samplepad-lib 0.1.0

Serialize and deserialize Alesis Samplepad KIT files
Documentation
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
use std::str;

const CHECKSUM_BYTE: usize = 0x08;

fn calculate_checksum(kit_file_vec: &Vec<u8>) -> usize {
    return (kit_file_vec[CHECKSUM_BYTE] as usize + kit_file_vec[CHECKSUM_BYTE + 1] as usize) % 256;
}

fn verify_checksum(kit_file_vec: &Vec<u8>) -> Result<(), String> {
    let checksum = kit_file_vec[CHECKSUM_BYTE as usize] as usize;
    let calculated_checksum = calculate_checksum(kit_file_vec);
    if checksum == calculated_checksum {
        Ok(())
    } else {
        Err(format!(
            "Kit file says checksum should be {checksum} but calculated {calculated_checksum}"
        ))
    }
}

#[derive(Debug, PartialEq)]
pub struct Pad {
    pub name: String,
    pub midi_note: u8,
    pub location: u8,
    pub level: u8,
    pub tune: u8,
    pub pan: u8,
    pub reverb: u8,
    pub mode: u8,
    pub sensitivity: u8,
    pub mgrp: u8,
    pub velocity_min: u8,
    pub velocity_max: u8,
    pub velocity_min_b: u8,
    pub velocity_max_b: u8,
    pub file_layer_a: String,
    pub file_layer_b: String,
}

fn pad_file_order() -> [&'static str; 17] {
    return [
        "pad_01", "pad_02", "pad_03", "pad_04", "pad_05", "pad_06", "pad_07", "pad_08", "ext_1a",
        "ext_1b", "ext_2", "kick", "hh_ope", "hh_mid", "hh_clo", "hh_chk", "hh_spl",
    ];
}

const HEADER_LENGTH: usize = 128;
const BLOCK_LENGTH: usize = 256;
fn get_pads(kit_file_vec: &Vec<u8>) -> Result<Vec<Pad>, String> {
    let mut pads = vec![];
    let pad_file_order = pad_file_order();
    for (i, pad_name) in pad_file_order.iter().enumerate() {
        let offset1 = HEADER_LENGTH + i * BLOCK_LENGTH;
        let block1 = &kit_file_vec[offset1..offset1 + BLOCK_LENGTH];
        let offset2 = HEADER_LENGTH + (pad_file_order.len() * BLOCK_LENGTH) + i * BLOCK_LENGTH;
        let block2 = &kit_file_vec[offset2..offset2 + BLOCK_LENGTH];
        pads.push(Pad {
            name: pad_name.to_string(),
            midi_note: block1[LOC_MIDI_NOTE],
            location: block1[LOC_LOCATION],
            level: block1[LOC_LEVEL],
            tune: block1[LOC_TUNE],
            pan: block1[LOC_PAN],
            reverb: block1[LOC_REVERB],
            mode: block1[LOC_MODE],
            sensitivity: block1[LOC_SENSITIVITY],
            mgrp: block1[LOC_MGRP],
            velocity_min: block2[LOC_VELOCITY_MIN],
            velocity_max: block2[LOC_VELOCITY_MAX],
            velocity_min_b: block2[LOC_VELOCITY_MIN_B],
            velocity_max_b: block2[LOC_VELOCITY_MAX_B],
            file_layer_a: if block2[LOC_HAS_FILE_LAYER_A] != 0xaa {
                "".to_string()
            } else {
                str::from_utf8(
                    &block2[LOC_FILE_NAME as usize
                        ..(LOC_FILE_NAME + &(block2[LOC_FILE_NAME_LENGTH] as usize)) as usize],
                )
                .expect("Invalid UTF-8 sequence")
                .to_string()
            },
            file_layer_b: if block2[LOC_HAS_FILE_LAYER_B] != 0xaa {
                "".to_string()
            } else {
                str::from_utf8(
                    &block2[LOC_FILE_NAME_B as usize
                        ..(LOC_FILE_NAME_B + &(block2[LOC_FILE_NAME_LENGTH_B] as usize)) as usize],
                )
                .expect("Invalid UTF-8 sequence")
                .to_string()
            },
        });
    }
    Ok(pads)
}

#[derive(Debug, PartialEq)]
pub struct Kit {
    pub name: String,
    pub pads: Vec<Pad>,
}

fn get_kit_name(kit_vec: &Vec<u8>) -> String {
    str::from_utf8(&kit_vec[0x48 as usize..(0x48 + &kit_vec[0x47]) as usize])
        .expect("Invalid UTF-8 sequence")
        .to_string()
}

const LOC_MIDI_NOTE: usize = 0x39;
const LOC_LOCATION: usize = 0x07;
const LOC_LEVEL: usize = 0x29;
const LOC_TUNE: usize = 0x2d;
const LOC_PAN: usize = 0x31;
const LOC_REVERB: usize = 0x35;
const LOC_MODE: usize = 0x3d;
const LOC_SENSITIVITY: usize = 0x41;
const LOC_MGRP: usize = 0x49;
const LOC_VELOCITY_MIN: usize = 0x82;
const LOC_VELOCITY_MAX: usize = 0x83;
const LOC_VELOCITY_MIN_B: usize = 0xa2;
const LOC_VELOCITY_MAX_B: usize = 0xa4;
const LOC_FILE_NAME_LENGTH: usize = 0x87;
const LOC_DISPLAY_NAME: usize = 0x88;
const LOC_FILE_NAME: usize = 0x90;
const LOC_HAS_FILE_LAYER_A: usize = 0x80;
const LOC_FILE_NAME_LENGTH_B: usize = 0xa7;
const LOC_DISPLAY_NAME_B: usize = 0xa8;
const LOC_FILE_NAME_B: usize = 0xb0;
const LOC_HAS_FILE_LAYER_B: usize = 0xa0;
const LOC_KIT_NAME_LENGTH: usize = 0x47;
const LOC_KIT_NAME: usize = 0x48;

/// Given a Kit value, return a serialized byte vector of a KIT file that could be written to disk.
///
/// ```
/// use alesis_samplepad_lib::serialize_kit;
/// # use alesis_samplepad_lib::deserialize_kit;
/// # let kit_vec = std::fs::read("./test_data/SMPLPDBS1/KITS/USER_001.KIT").expect("Couldn't read test kit file");
/// # let kit = deserialize_kit(&kit_vec).expect("Error deserializing kit file");
/// std::fs::write("USER_001.KIT", serialize_kit(kit));
///
pub fn serialize_kit(kit: Kit) -> Vec<u8> {
    let mut header = vec![
        0x4b, 0x49, 0x54, 0x48, 0x00, 0x80, 0x00, 0x00, 0xeb, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    ];
    header[LOC_KIT_NAME_LENGTH] = kit.name.len() as u8;
    let kit_name = kit.name.as_bytes().to_owned();
    header.splice(LOC_KIT_NAME..LOC_KIT_NAME + kit_name.len(), kit_name);

    let mut blocks_one = vec![];
    let mut blocks_two = vec![];
    for pad in kit.pads.iter() {
        let mut block1 = vec![
            0x4b, 0x49, 0x54, 0x49, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x07, 0x32, 0x32, 0x41, 0x63, 0x42, 0x64, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x09, 0x00, 0x00, 0x00, 0x05,
            0x00, 0x0a, 0x01, 0x00, 0x04, 0x08, 0x02, 0x00, 0x04, 0x08, 0x03, 0x00, 0x00, 0x0a,
            0x08, 0x00, 0x00, 0x7f, 0x09, 0x01, 0x00, 0x05, 0x0c, 0x0c, 0x00, 0x08, 0x0d, 0x00,
            0x00, 0x09, 0x0e, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x7f, 0x09, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00,
        ];

        block1[LOC_MIDI_NOTE] = pad.midi_note;
        block1[LOC_LOCATION] = pad.location;
        block1[LOC_LEVEL] = pad.level;
        block1[LOC_TUNE] = pad.tune;
        block1[LOC_PAN] = pad.pan;
        block1[LOC_REVERB] = pad.reverb;
        block1[LOC_MODE] = pad.mode;
        block1[LOC_SENSITIVITY] = pad.sensitivity;
        block1[LOC_MGRP] = pad.mgrp;
        blocks_one.append(&mut block1);

        let mut block2 = vec![
            0x4b, 0x49, 0x54, 0x49, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x09, 0x00, 0x00, 0x00, 0x05,
            0x00, 0x0a, 0x01, 0x00, 0x04, 0x08, 0x02, 0x00, 0x04, 0x08, 0x03, 0x00, 0x00, 0x0a,
            0x08, 0x00, 0x00, 0x7f, 0x09, 0x01, 0x00, 0x05, 0x0c, 0x0c, 0x00, 0x08, 0x0d, 0x00,
            0x00, 0x09, 0x0e, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0xff, 0xaa, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xaa, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00,
        ];
        block2[LOC_MIDI_NOTE] = pad.midi_note;
        block2[LOC_LOCATION] = pad.location;
        block2[LOC_LEVEL] = pad.level;
        block2[LOC_TUNE] = pad.tune;
        block2[LOC_PAN] = pad.pan;
        block2[LOC_REVERB] = pad.reverb;
        block2[LOC_MODE] = pad.mode;
        block2[LOC_SENSITIVITY] = pad.sensitivity;
        block2[LOC_MGRP] = pad.mgrp;
        block2[LOC_VELOCITY_MIN] = pad.velocity_min;
        block2[LOC_VELOCITY_MAX] = pad.velocity_max;
        block2[LOC_VELOCITY_MIN_B] = pad.velocity_min_b;
        block2[LOC_VELOCITY_MAX_B] = pad.velocity_max_b;

        // file layer a
        block2[LOC_FILE_NAME_LENGTH] = pad.file_layer_a.len() as u8;
        let mut display_name = pad.file_layer_a.to_uppercase().as_bytes().to_owned();
        if display_name.len() < 9 {
            display_name.resize(8, 0x20);
        }
        block2.splice(
            LOC_DISPLAY_NAME..LOC_DISPLAY_NAME + display_name.len(),
            display_name,
        );

        let mut file_name = pad.file_layer_a.as_bytes().to_owned();
        if file_name.len() < 9 {
            file_name.resize(8, 0x00);
        }
        block2.splice(LOC_FILE_NAME..LOC_FILE_NAME + file_name.len(), file_name);
        block2[LOC_HAS_FILE_LAYER_A] = if pad.file_layer_a == "" { 0xff } else { 0xaa };

        // file layer b
        block2[LOC_FILE_NAME_LENGTH_B] = pad.file_layer_b.len() as u8;
        let mut display_name = pad.file_layer_b.to_uppercase().as_bytes().to_owned();
        if display_name.len() < 9 {
            display_name.resize(8, 0x20);
        }
        block2.splice(
            LOC_DISPLAY_NAME_B..LOC_DISPLAY_NAME_B + display_name.len(),
            display_name,
        );
        let mut file_name = pad.file_layer_b.as_bytes().to_owned();
        if file_name.len() < 9 {
            file_name.resize(8, 0x00);
        }
        block2.splice(
            LOC_FILE_NAME_B..LOC_FILE_NAME_B + file_name.len(),
            file_name,
        );
        block2[LOC_HAS_FILE_LAYER_B] = if pad.file_layer_b == "" { 0xff } else { 0xaa };

        blocks_two.append(&mut block2);
    }
    [header, blocks_one, blocks_two].concat()
}

/// Given a reference to a byte vector of a KIT file, return a parsed Kit value
///
/// ```
/// use alesis_samplepad_lib::deserialize_kit;
/// let kit_vec = std::fs::read("./test_data/SMPLPDBS1/KITS/USER_001.KIT").expect("Couldn't read test kit file");
/// let kit = deserialize_kit(&kit_vec).expect("Error deserializing kit file");
/// assert_eq!(kit.name, "Acoustic");
///
pub fn deserialize_kit(kit_vec: &Vec<u8>) -> Result<Kit, String> {
    verify_checksum(kit_vec)?;
    Ok(Kit {
        name: get_kit_name(&kit_vec),
        pads: get_pads(&kit_vec)?,
    })
}

#[cfg(test)]
mod tests {
    use super::*;
    use pretty_assertions::assert_eq;
    use std::fs;

    fn get_test_kit() -> Vec<u8> {
        return fs::read("./test_data/SMPLPDBS1/KITS/USER_001.KIT")
            .expect("Couldn't read test kit file");
    }

    #[test]
    fn test_checksum() {
        assert_eq!(verify_checksum(&get_test_kit()), Ok(()));
    }

    #[test]
    fn test_kit_name() {
        // This is just a weird quirk, the file stores a kit name, but user kits are displayed with
        // the filename as the kit name and this value is ignored.
        assert_eq!("Acoustic", get_kit_name(&get_test_kit()));
    }

    #[test]
    fn test_serde_round_trip() {
        let kv = get_test_kit();
        assert_eq!(
            deserialize_kit(&kv),
            deserialize_kit(&serialize_kit(
                deserialize_kit(&kv).expect("Failed to deserialize kit")
            ))
        );
    }

    #[test]
    fn test_get_pads() {
        assert_eq!(
            get_pads(&get_test_kit()),
            Ok(vec![
                Pad {
                    name: "pad_01".to_string(),
                    midi_note: 49,
                    location: 1,
                    level: 8,
                    tune: 0,
                    pan: 0,
                    reverb: 3,
                    mode: 0,
                    sensitivity: 16,
                    mgrp: 0,
                    velocity_min: 0,
                    velocity_max: 127,
                    velocity_min_b: 0,
                    velocity_max_b: 0,
                    file_layer_a: "G_Sub_Hit".to_string(),
                    file_layer_b: "".to_string()
                },
                Pad {
                    name: "pad_02".to_string(),
                    midi_note: 51,
                    location: 1,
                    level: 4,
                    tune: 0,
                    pan: 0,
                    reverb: 0,
                    mode: 1,
                    sensitivity: 16,
                    mgrp: 0,
                    velocity_min: 0,
                    velocity_max: 127,
                    velocity_min_b: 0,
                    velocity_max_b: 0,
                    file_layer_a: "Y_Noise_Hit".to_string(),
                    file_layer_b: "".to_string()
                },
                Pad {
                    name: "pad_03".to_string(),
                    midi_note: 48,
                    location: 1,
                    level: 10,
                    tune: 0,
                    pan: 0,
                    reverb: 3,
                    mode: 0,
                    sensitivity: 16,
                    mgrp: 0,
                    velocity_min: 0,
                    velocity_max: 127,
                    velocity_min_b: 0,
                    velocity_max_b: 0,
                    file_layer_a: "O_Kick_2".to_string(),
                    file_layer_b: "".to_string()
                },
                Pad {
                    name: "pad_04".to_string(),
                    midi_note: 45,
                    location: 1,
                    level: 8,
                    tune: 0,
                    pan: 0,
                    reverb: 0,
                    mode: 0,
                    sensitivity: 16,
                    mgrp: 0,
                    velocity_min: 0,
                    velocity_max: 127,
                    velocity_min_b: 0,
                    velocity_max_b: 0,
                    file_layer_a: "R_Tom_Mute_H".to_string(),
                    file_layer_b: "".to_string()
                },
                Pad {
                    name: "pad_05".to_string(),
                    midi_note: 46,
                    location: 1,
                    level: 8,
                    tune: 0,
                    pan: 0,
                    reverb: 3,
                    mode: 1,
                    sensitivity: 16,
                    mgrp: 1,
                    velocity_min: 0,
                    velocity_max: 127,
                    velocity_min_b: 0,
                    velocity_max_b: 0,
                    file_layer_a: "R_Tom_Mute_L".to_string(),
                    file_layer_b: "".to_string()
                },
                Pad {
                    name: "pad_06".to_string(),
                    midi_note: 36,
                    location: 1,
                    level: 10,
                    tune: 0,
                    pan: 0,
                    reverb: 2,
                    mode: 0,
                    sensitivity: 16,
                    mgrp: 0,
                    velocity_min: 0,
                    velocity_max: 127,
                    velocity_min_b: 0,
                    velocity_max_b: 0,
                    file_layer_a: "R_Kick_2".to_string(),
                    file_layer_b: "".to_string()
                },
                Pad {
                    name: "pad_07".to_string(),
                    midi_note: 38,
                    location: 1,
                    level: 8,
                    tune: 0,
                    pan: 0,
                    reverb: 0,
                    mode: 1,
                    sensitivity: 16,
                    mgrp: 0,
                    velocity_min: 0,
                    velocity_max: 127,
                    velocity_min_b: 0,
                    velocity_max_b: 0,
                    file_layer_a: "SNR_OFF_5".to_string(),
                    file_layer_b: "".to_string()
                },
                Pad {
                    name: "pad_08".to_string(),
                    midi_note: 42,
                    location: 1,
                    level: 8,
                    tune: 0,
                    pan: 0,
                    reverb: 0,
                    mode: 1,
                    sensitivity: 16,
                    mgrp: 0,
                    velocity_min: 0,
                    velocity_max: 127,
                    velocity_min_b: 0,
                    velocity_max_b: 0,
                    file_layer_a: "R_Clap_Wet".to_string(),
                    file_layer_b: "".to_string()
                },
                Pad {
                    name: "ext_1a".to_string(),
                    midi_note: 38,
                    location: 0,
                    level: 8,
                    tune: 0,
                    pan: 0,
                    reverb: 3,
                    mode: 0,
                    sensitivity: 16,
                    mgrp: 0,
                    velocity_min: 0,
                    velocity_max: 127,
                    velocity_min_b: 0,
                    velocity_max_b: 0,
                    file_layer_a: "".to_string(),
                    file_layer_b: "".to_string()
                },
                Pad {
                    name: "ext_1b".to_string(),
                    midi_note: 40,
                    location: 0,
                    level: 8,
                    tune: 0,
                    pan: 0,
                    reverb: 3,
                    mode: 0,
                    sensitivity: 16,
                    mgrp: 0,
                    velocity_min: 0,
                    velocity_max: 127,
                    velocity_min_b: 0,
                    velocity_max_b: 0,
                    file_layer_a: "".to_string(),
                    file_layer_b: "".to_string()
                },
                Pad {
                    name: "ext_2".to_string(),
                    midi_note: 43,
                    location: 0,
                    level: 8,
                    tune: 0,
                    pan: 1,
                    reverb: 3,
                    mode: 0,
                    sensitivity: 16,
                    mgrp: 0,
                    velocity_min: 0,
                    velocity_max: 127,
                    velocity_min_b: 0,
                    velocity_max_b: 0,
                    file_layer_a: "".to_string(),
                    file_layer_b: "".to_string()
                },
                Pad {
                    name: "kick".to_string(),
                    midi_note: 36,
                    location: 0,
                    level: 8,
                    tune: 2,
                    pan: 0,
                    reverb: 2,
                    mode: 0,
                    sensitivity: 16,
                    mgrp: 0,
                    velocity_min: 0,
                    velocity_max: 127,
                    velocity_min_b: 0,
                    velocity_max_b: 0,
                    file_layer_a: "".to_string(),
                    file_layer_b: "".to_string()
                },
                Pad {
                    name: "hh_ope".to_string(),
                    midi_note: 46,
                    location: 0,
                    level: 8,
                    tune: 0,
                    pan: 253,
                    reverb: 3,
                    mode: 1,
                    sensitivity: 16,
                    mgrp: 1,
                    velocity_min: 0,
                    velocity_max: 127,
                    velocity_min_b: 0,
                    velocity_max_b: 0,
                    file_layer_a: "".to_string(),
                    file_layer_b: "".to_string()
                },
                Pad {
                    name: "hh_mid".to_string(),
                    midi_note: 23,
                    location: 0,
                    level: 8,
                    tune: 0,
                    pan: 253,
                    reverb: 3,
                    mode: 1,
                    sensitivity: 16,
                    mgrp: 1,
                    velocity_min: 0,
                    velocity_max: 127,
                    velocity_min_b: 0,
                    velocity_max_b: 0,
                    file_layer_a: "".to_string(),
                    file_layer_b: "".to_string()
                },
                Pad {
                    name: "hh_clo".to_string(),
                    midi_note: 42,
                    location: 0,
                    level: 8,
                    tune: 0,
                    pan: 253,
                    reverb: 3,
                    mode: 1,
                    sensitivity: 16,
                    mgrp: 1,
                    velocity_min: 0,
                    velocity_max: 127,
                    velocity_min_b: 0,
                    velocity_max_b: 0,
                    file_layer_a: "".to_string(),
                    file_layer_b: "".to_string()
                },
                Pad {
                    name: "hh_chk".to_string(),
                    midi_note: 44,
                    location: 0,
                    level: 8,
                    tune: 0,
                    pan: 253,
                    reverb: 3,
                    mode: 0,
                    sensitivity: 16,
                    mgrp: 1,
                    velocity_min: 0,
                    velocity_max: 127,
                    velocity_min_b: 0,
                    velocity_max_b: 0,
                    file_layer_a: "".to_string(),
                    file_layer_b: "".to_string()
                },
                Pad {
                    name: "hh_spl".to_string(),
                    midi_note: 21,
                    location: 0,
                    level: 8,
                    tune: 0,
                    pan: 253,
                    reverb: 3,
                    mode: 0,
                    sensitivity: 16,
                    mgrp: 1,
                    velocity_min: 0,
                    velocity_max: 127,
                    velocity_min_b: 0,
                    velocity_max_b: 0,
                    file_layer_a: "".to_string(),
                    file_layer_b: "".to_string()
                }
            ])
        );
    }
}