|
|
@ -11,7 +11,7 @@ XXD=`which xxd` |
|
|
|
TMP="/tmp/wav2c" |
|
|
|
TMP="/tmp/wav2c" |
|
|
|
AUDIO_BLOCK_SIZE=128 |
|
|
|
AUDIO_BLOCK_SIZE=128 |
|
|
|
DRUMSET_H="drumset.h" |
|
|
|
DRUMSET_H="drumset.h" |
|
|
|
DRUMS_H="drums.h" |
|
|
|
DRUMS_H="${TMP}/drums.h" |
|
|
|
|
|
|
|
|
|
|
|
function cleanexit() |
|
|
|
function cleanexit() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -78,66 +78,19 @@ then |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
mkdir -p "${TMP}" |
|
|
|
mkdir -p "${TMP}" |
|
|
|
echo "#pragma once" >"${DRUMSET_H}" |
|
|
|
cat >> "${DRUMSET_H}" << EOF |
|
|
|
|
|
|
|
#ifndef _DRUMSET_H |
|
|
|
|
|
|
|
#define _DRUMSET_H |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EOF |
|
|
|
rm -f "${DRUMS_H}" |
|
|
|
rm -f "${DRUMS_H}" |
|
|
|
cat >> "${DRUMS_H}" << EOF |
|
|
|
cat >> "${DRUMS_H}" << EOF |
|
|
|
/* |
|
|
|
|
|
|
|
MicroDexed |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MicroDexed is a port of the Dexed sound engine |
|
|
|
|
|
|
|
Dexed ist heavily based on https://github.com/google/music-synthesizer-for-an |
|
|
|
|
|
|
|
droid |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(c)2018-2021 H. Wirtz <wirtz@parasitstudio.de> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy |
|
|
|
|
|
|
|
of this software and associated documentation files (the "Software"), to deal |
|
|
|
|
|
|
|
in the Software without restriction, including without limitation the rights |
|
|
|
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
|
|
|
|
|
|
copies of the Software, and to permit persons to whom the Software is |
|
|
|
|
|
|
|
furnished to do so, subject to the following conditions: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in |
|
|
|
|
|
|
|
all copies or substantial portions of the Software. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
|
|
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
|
|
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
|
|
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
|
|
|
|
|
|
THE SOFTWARE. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <Arduino.h> |
|
|
|
|
|
|
|
#include "config.h" |
|
|
|
|
|
|
|
#include "drumset.h" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef _DRUMS_H |
|
|
|
|
|
|
|
#define _DRUMS_H |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct drum_config_s { |
|
|
|
|
|
|
|
uint8_t drum_class; // Type of drum |
|
|
|
|
|
|
|
uint8_t midinote; // Triggered by note |
|
|
|
|
|
|
|
char name[DRUM_NAME_LEN]; |
|
|
|
|
|
|
|
const uint8_t* drum_data; |
|
|
|
|
|
|
|
char shortname[2]; // 1 char name for sequencer |
|
|
|
|
|
|
|
uint32_t len; // number of elements in drum_data |
|
|
|
|
|
|
|
float32_t pitch; // |
|
|
|
|
|
|
|
float32_t pan; // Panorama (-1.0 - +1.0) |
|
|
|
|
|
|
|
float32_t vol_max; // max. Volume (0.0 - 1.0) |
|
|
|
|
|
|
|
float32_t vol_min; // min. Volume (0.0 - 1.0, should be <= vol_max) |
|
|
|
|
|
|
|
float32_t reverb_send; // how much signal to send to the reverb (0.0 - 1.0) |
|
|
|
|
|
|
|
} drum_config_t; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
enum {DRUM_NONE, DRUM_BASS, DRUM_SNARE, DRUM_HIHAT, DRUM_HANDCLAP, DRUM_RIDE, DRUM_CHRASH, DRUM_LOWTOM, DRUM_MIDTOM, DRUM_HIGHTOM, DRUM_PERCUSSION}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// DEFAULT MIDI CHANNEL FOR SAMPLEDRUMS |
|
|
|
|
|
|
|
uint8_t drum_midi_channel = 10; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
drum_config_t drum_config[NUM_DRUMSET_CONFIG] = |
|
|
|
drum_config_t drum_config[NUM_DRUMSET_CONFIG] = |
|
|
|
{ |
|
|
|
{ |
|
|
|
EOF |
|
|
|
EOF |
|
|
|
|
|
|
|
|
|
|
|
declare -A converted_files |
|
|
|
declare -A converted_files |
|
|
|
|
|
|
|
NUM_DRUMSET_CONFIG=0 |
|
|
|
|
|
|
|
|
|
|
|
while IFS= read -r l |
|
|
|
while IFS= read -r l |
|
|
|
do |
|
|
|
do |
|
|
@ -168,6 +121,8 @@ do |
|
|
|
then |
|
|
|
then |
|
|
|
# Generate drumset.h |
|
|
|
# Generate drumset.h |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NUM_DRUMSET_CONFIG=`expr "${NUM_DRUMSET_CONFIG}" + 1` |
|
|
|
|
|
|
|
|
|
|
|
if [ -z "${converted_files[${sample['filename']}]}" ] |
|
|
|
if [ -z "${converted_files[${sample['filename']}]}" ] |
|
|
|
then |
|
|
|
then |
|
|
|
basename=`echo "${sample['filename']}" | cut -d'.' -f1` |
|
|
|
basename=`echo "${sample['filename']}" | cut -d'.' -f1` |
|
|
@ -248,3 +203,13 @@ cat >> "${DRUMS_H}" << EOF |
|
|
|
|
|
|
|
|
|
|
|
#endif |
|
|
|
#endif |
|
|
|
EOF |
|
|
|
EOF |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "" >> "${DRUMSET_H}" |
|
|
|
|
|
|
|
cat "${DRUMS_H}" >> "${DRUMSET_H}" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "" |
|
|
|
|
|
|
|
echo "Created drumset.h. Copy the file to the root dicrectory of MicroDexed and don't" |
|
|
|
|
|
|
|
echo "forget to edit config.h and change the following line to the right number:" |
|
|
|
|
|
|
|
echo "" |
|
|
|
|
|
|
|
echo " #define NUM_DRUMSET_CONFIG ${NUM_DRUMSET_CONFIG}" |
|
|
|
|
|
|
|
echo "" |
|
|
|