[LAU] makesfz.sh

Dan MacDonald allcoms at gmail.com
Mon Jan 23 03:26:12 UTC 2012


Hi Linux audio users and the LS devs!

I've just updated my little wav-2-sfz sample definition file creation
script who's home is at:

http://bb.linuxsampler.org/viewtopic.php?f=7&t=667&sid=dc0c0ef3ec00363d761700c0ef41a91f

The new and likely final feature update is that now you have the option of
creating one sfz per wav or creating one sfz that maps all your wavs - I
seem to only ever want to do one or the other when homebrewing simple sfz
files.

I can see I'm going to get a lot of use out of this script now that I've
started to use Linuxsampler/qsampler so I'd like to see this script or
maybe an improved version of it included with future Linux audio distros if
it doesn't get integrated into linuxsampler or qsampler.

Thanks!

Dan





#!/bin/bash
#
# makesfz.sh
#
# Running 'makesfz.sh' with no or any other parameter than 1 will create a
.sfz
# file for every wav file in the present dir. mapping the wav to MIDI note
0.
#
# Alternatively, 'makesfz.sh 1' reads all wav files in the current dir and
creates
# a single .sfz named after the present folder mapping each sample to a
MIDI note.
#
#
# by Dan MacDonald 2012

key=0

if [ "$1" = "1" ]; then

rm -f ${PWD##*/}.sfz
echo -e "# This file was auto-generated by
makesfz.sh\n\n<group>\nloop_mode=one_shot\n" > ${PWD##*/}.sfz

for wavs in *.wav

do
echo -e "<region>\nsample=$wavs\nkey=$key\nlovel=0 hivel=127\n" >>
${PWD##*/}.sfz
key=$(($key+1))
done

else

for wavs in *.wav

do
echo -e "# This file was auto-generated by
makesfz.sh\n\n<group>\nloop_mode=one_shot\n" > $wavs.sfz
echo -e "<region>\nsample=$wavs\nkey=0\nlovel=0 hivel=127\n" >> $wavs.sfz
done

fi






On Sat, Dec 31, 2011 at 2:48 PM, Dan MacDonald <allcoms at gmail.com> wrote:

> Glad tidings I bring the free audio realm for 2012!
>
> After seeming years of guru meditations on this problem, I have
> finally come across a method of easily using a folder of wav samples
> to create sfz drum kits that can be used with Linuxsampler under
> qtractor, A3, OOM or what haveth ye for DAW!!
>
> I came across a perl script that almost sounded like it would do what
> I want here http://www.drealm.info/sfz/ but I failed to get that to
> work and I don't know perl to fix it yet and nor do I think I'll
> bother but I will write a bash script to create a .sfz looking like so
> by simply running said script in the folder containing the wav files
> for your kit. Hence if you ran makesfz.sh within a dir containing
> 001-bassdrum.wav and 002-snaredrum.wav we would get the following
> output:
>
>
>
> <region>
> sample=001-bassdrum.wav
> key=0
> lovel=0 hivel=127
>
> <region>
> sample=002-snaredrum.wav
> key=1
> lovel=0 hivel=127
>
>
>
> I do expect someone here will have wrote such a script and added bells
> already so may they be so kind as to share it so then we may add it to
> the LinuxSampler online resources or get it bundled with the app
> itself?
>
> All the best for 2012!
>
> danboid
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxaudio.org/pipermail/linux-audio-user/attachments/20120123/29d16586/attachment.htm>


More information about the Linux-audio-user mailing list