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

Loading…
Cancel
Save