Tuesday, April 24, 2012

Hydrogen drumkit creator script V2

An improved version of the original script is ready.

What's new:
- some small bugfixes
- more options
- espeak sample generator

This script helps you to create a Hydrogen drumkit.
There are 2 possible ways you can use this script : by providing your own
samples, or by providing a txt file that will be used to create espeak samples.

1) Provide your own samples:
   This will create a drumkit from sample files you provide
  •  Manually create your samples (WAV, FLAC, AIFF) **
  •  Place your samples in a temp dir
  •  cd into the dir that holds this script and run the script like this :
     ./createH2kit_V2.py -i "/path/to/my/temp/dir/"
  •  The script will ask you to enter some data about the kit you are creating
  •  The drumkit will be created in the same dir where your samples are located
  •  You can now import the H2drumkit file into Hydrogen (via Instrument > Import library > Local File)

 The names of the sample (wav/flac) files _must_ follow the below naming scheme:

        x-y instrument name.wav

   x : the instrument ID (=position of this instrument in the drumkit)
   y : the layer ID (0=lowest velocity sample)
   instrument name : this is the name that will be used for the instrument

 The rest of the script is interactive.

2) Auto create espeak kit 
   This mode will create a 'voice-drumkit' using the espeak voice syntheses utility
  •  Create a text file that contains the words you want to use as samples ***
  •  Place that file in a temp dir
  •  cd into the dir that holds this script and run the script like this :
     ./createH2kit_V2.py -i "/path/to/my/temp/dir/my_text_file"
  •  The script will ask you to enter some data about the kit you are creating
  •  The drumkit will be created in the same dir where your text file is located
  •  You can now import the H2drumkit file into Hydrogen via Instrument > Import library > Local File


 The lines in your text file must be formatted as follows (note the '*'):

   name of instrument * "text for espeak"

   eg:  Voice 1*"hello you"
   will create an instrument named 'Voice 1' that holds the 'hello you' espeak sample

 You can also add espeak options to the line:

   eg:  Voice 2*"hello you, how are you doing?" -s 50 -p 30
   will create an instrument named 'Voice 2' with an espeak sample at speed=50 and pitch=30

 For more options check the espeak man pages

Other options are :
 -h, --help    : will display this help.
 -i, --input   : specifies the dir or file you want to use as input
                 if you specify a dir, the script will assume that
                 this dir contains your self-made samples.
                 if you specify a file, the script will assume that this
                 file contains the text you want to feed to espeak.
 -v, --verbose : generates extra debug output.
 -l, --listen  : will let espeak say the text from the input file you
                 specified, without generating any output files.
                 you can use this option to preview the espeak samples.
                 (does not work if you dont provide a file as input)

Espeak example :
If you use this txt file as input:

   how low*"how low" -p 10
   can*"can" -s 10
   hello*"hello you"
   go*"go !" -p 150
   all*"how low can you go?" -p 20 -s 10

This is the result : espeak drumkit 2

Download :
You can download the script here

UPDATE : check out V5 of the script here


  1. please help! Could not create drumkit.xml file /home/valerio/Desktop/cajon/sindrumkit.xml
    this is an example of the files i'm using 1-1 slap.wav.
    named it incorrectly? I probably am missing something very obvious... thanks in advance

  2. hi,
    make sure that the path you enter ends with a '/'
    so NOT this : ./createH2kit_V2.py -i "/path/to/my/temp/dir"
    but this : ./createH2kit_V2.py -i "/path/to/my/temp/dir/"

    if that doesnt help run the script with the -v (verbose) option
    like this : ./createH2kit_V2.py -v -i "/path/to/my/temp/dir/"

    let me know if this helps


    1. yeah!that was the obvious thing i was missing... thank you so much for the quick reply! best regards

  3. glad it works :-)
    i'll update the script so this cant happen anymore

    PS: dont forget to share your kit with us. you can submit it to the hydrogen mailing list, or just mail it to me (if you want to of course)

    1. about the sharing: i'm slowly (VERY SLOWLY INDEED!) building a huge kit made with a variety of samples coming from various sources.(some recorded by me, but the majority from the net, with sharer usually don't remembering the sources themselves).that's ok for personal use, but i'll be glad to share when (IF) finished. what about licencing and attribution?


  4. the license of the samples you have used from someone else needs to allow sharing.
    licensing can be a very complex thing and the easiest way to find out if you can use the sample in a drumkit that you want to share with others, is to ask permission from the original creator.
    However, in your case it might be difficult to do since you apparently have a lot of samples + you dont know who the creator is ...

  5. yeah, that's it...I'll think about it when it comes to finishing...I just have one last question for you: I have multiple samples of the same instrument same velocity(different takes), say 5 ludwig bassdrum wooden beater, nearly identical but I noticed that if you alternate them randomly in the loops (I do it in ardour now) it sounds much more real...it would be amazing to automate something like that in hydrogen!do you think that's possible? I'm null on code and a relatively new user on linux itself, so I don't have a clue about the difficulty of it... Thank you so much for your time!

    1. mmm, interesting that you should mention that !
      keep an eye on this blog, because i'll be launching some ideas/proposals about that.
      feel free to add/comment on that when i post it


      PS: i dont know much about coding either, but i know people that do ;-)

  6. The script has been updated to V5 :-)
    check it out here : http://audio-and-linux.blogspot.com/2012/10/hydrogen-drumkit-creator-script-v5-is.html