Skip to content

Instantly share code, notes, and snippets.

@patmaddox
Last active October 3, 2016 19:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save patmaddox/aaf4ca57f3116ee59a3ebd85ef893ce8 to your computer and use it in GitHub Desktop.
Save patmaddox/aaf4ca57f3116ee59a3ebd85ef893ce8 to your computer and use it in GitHub Desktop.
Scripts to make Falcon wavetable audio files
#!/usr/bin/env bash
# This takes two input files and creates an
# interpolated wavetable between them
# No warranty on this – backup your files first!
#
# Make the shell file executable, and then run it
# to see usage
#
# Tested on OS X 10.10.5
# Dependencies: CDP – http://www.unstablesound.net/cdp.html
set -e
if [ -z "$1" ] || [ -z "$2" ]; then
>&2 echo "Usage: ./interpolate.sh file1.wav file2.wav"
exit 1
fi
start=$1
end=$2
rm -f _interpolate_gen_file*.wav
submix inbetween 1 "$1" "$2" _interpolate_gen_file 128
length=`sndinfo props _interpolate_gen_file001.wav | grep 'samples\:' | awk '{print $3}'`
outfile=morph_`printf $length`.wav
rm -f $outfile
sfedit join _interpolate_gen_file*.wav $outfile -w0
rm -f _interpolate_gen_file*.wav
#!/usr/bin/env bash
# This takes a single audio file, chops it into
# multiple files, and creates a wavetable from them
# No warranty on this – backup your files first!
#
# Make the shell file executable, and then run it
# to see usage
#
# Tested on OS X 10.10.5
# Dependencies: sox – http://sox.sourceforge.net
#
# From my experience, the samples_length needs to be
# at least 128 to work
infile=$1
outfile=$2
slice_length=$3
if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then
>&2 echo "Usage: ./make_wavetable.sh infile.wav outfilename samples_length
Example: ./make_wavetable.sh mysample.wav wt1 2048
Produces: wt1_2048.wav"
exit 1
fi
wav_length=`soxi "$infile" | grep 'Duration.*samples' | awk '{print $5}'`
max_slices=`echo "$wav_length / $slice_length" | bc`
slices=`printf "$max_slices\n128" | sort -n | head -1`
samples=`echo "$slices * $slice_length" | bc`
sox "$infile" `printf "$outfile"`_`printf "$slice_length"`.wav trim 0 `echo $samples`s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment