Added limit for 71, 47 or 19 samples for use with T_4.0 or T3.6

dev
Holger Wirtz 3 years ago
parent 81669512ad
commit 5d4492be5f
  1. 27
      addon/tools/wav2c.sh

@ -3,15 +3,19 @@
# Converter for WAV to C Header
# Used for MicroDexed sampler
#
# (C)2021 Holger Wirtz
# (C)2021-2022 Holger Wirtz
#
SOX=`which sox`
XXD=`which xxd`
TMP="/tmp/wav2c"
AUDIO_BLOCK_SIZE=128
DRUMSET_H="drumset.h"
DRUMS_H="${TMP}/drums.h"
MAX_NUM_DRUMSET_CONFIG=71 # ARDUINO_TEENSY41
#MAX_NUM_DRUMSET_CONFIG=40 # ARDUINO_TEENSY40
#MAX_NUM_DRUMSET_CONFIG=19 # ...
function cleanexit()
{
@ -48,6 +52,11 @@ while [[ $# -gt 0 ]]; do
shift # past argument
shift # past value
;;
-n|--num)
MAX_NUM_DRUMSET_CONFIG="$2"
shift # past argument
shift # past value
;;
# -t|--test)
# TEST="true"
# shift # past argument
@ -120,6 +129,11 @@ do
if [ -f "${WAV_DIR}/${sample['filename']}" ]
then
if [ ${NUM_DRUMSET_CONFIG} -gt ${MAX_NUM_DRUMSET_CONFIG} ]
then
echo "/*" >> "${DRUMSET_H}"
fi
file "${WAV_DIR}/${sample['filename']}" | grep -i -q "WAVE audio"
if [ "${?}" == 0 ]
then
@ -167,6 +181,10 @@ do
fi
# Generate drums.h
if [ ${NUM_DRUMSET_CONFIG} -gt ${MAX_NUM_DRUMSET_CONFIG} ]
then
echo "/*" >> "${DRUMS_H}"
fi
cat >> "${DRUMS_H}" << EOF
{
${sample[class]},
@ -184,7 +202,14 @@ do
${sample[reverb_send]}
},
EOF
if [ ${NUM_DRUMSET_CONFIG} -gt ${MAX_NUM_DRUMSET_CONFIG} ]
then
echo "*/" >> "${DRUMS_H}"
echo "*/" >> "${DRUMSET_H}"
fi
NUM_DRUMSET_CONFIG=`expr "${NUM_DRUMSET_CONFIG}" + 1`
else
echo "File ${WAV_DIR}/${sample['filename']} is not a WAV audio file"
fi
else
echo "File \'${WAV_DIR}/${sample['filename']}\' does not exits." >&2

Loading…
Cancel
Save