Skip to Content

Fell In Love With A Gir - The White Stripes

1 reply [Last post]
kwalldio
kwalldio's picture
Offline
Joined: 07/19/2013

It's a old song, but classic and very simple. Just for fun!  :)

 

I'am working in a python script to import the drum tabs to hydrogen. It's almost ready, but for the curious there is a little code:

 

#!/usr/bin/python
""" Importa cifras de bateria do cifraclub para o xml do hydrogen"""
arquivo = open("/home/kwalldio/hydrogen/killing-in-the-name.txt", 'r')
arquivoOut = open("/tmp/importacao", 'w')
texto = arquivo.readlines()
numeroCompasso = -4
listainstrumento = []
for linha in texto :
    if linha.find("---") > 0 :
        """
        from time import sleep
        sleep(1)
        """
        print "\n"
        instrumentos = {'Cr':'13', 'Ri':'14', 'Ch':'6', 'Cx':'4', 'T1':'9', 'T2':'7', 'Su':'5', 'Bu':'0', 'CH':'10'}
        instrumento = instrumentos[linha[:2]]
        print "Instrumento ", instrumento
        tamanho = len(linha)
        print "Tamanho da linha ", tamanho
        qc = linha.count('|') -1
        print "Quantidade de compassos na linha ", qc
        print "Linha ", linha
        if instrumento == "13" :
            numeroCompasso = numeroCompasso + qc
        contador = 0
        listacompasso = []
        while contador != qc :
            numeroCompasso = numeroCompasso + 1
            contador = contador + 1
            compasso = linha.split("|")[contador]
            print "compasso numero ", numeroCompasso, ": ", compasso
            posicao = 0
            listanota = []
            while posicao != len(compasso) :
                if compasso[posicao] != "-" :
                    print "Nota na posicao ", posicao
                    arquivoOut.write(str(instrumento))
                    arquivoOut.write(",")
                    arquivoOut.write(str(numeroCompasso))
                    arquivoOut.write(",")
                    arquivoOut.write(str(posicao))
                    arquivoOut.write("\n")
                posicao = posicao + 1
        numeroCompasso = numeroCompasso - qc
arquivoOut.close()
arquivo.close()

 

AttachmentSize
Fell in love with a girl - The White Stripes.h2song27.08 KB
wolke
wolke's picture
Offline
Joined: 03/30/2010

cool,

i noticed you import an txt file and read this by lines. contains this txt file something as shown in the block quote? i am interested if there exist fixed rules for such notation. if yes it could be a good way to fill our public drum pattern repository. there are thousands of txt tabs in the www. and if they are licensed under a correct cc license we can use such patterns. a good general idea is to create hydrogen pattern in standart gm(general midi) kit instrument order.

greetings wolke

 

C = Crash
HH = Hi-Hat
T = Small Tom
S = Snare
FT = Floor Tom
B = Bass

f = flam
o = loose hi-hat

INTRO
HH:|----------------|----------------|----------------|--o---o---o-----|
 S:|----------------|----------------|----------------|f---f---f---f---|
 B:|----------------|----------------|----------------|-o-o-o-o-o-o--o-|

 C:|X---------------|X---------------|X---------------|X---------------|
HH:|----o---o---o---|----o---o---o---|----o---o---o---|----o---o---o---|
 S:|----o--o-o--o---|----o--o-o--o---|----o--o-o--o---|----o--o-o--o---|
 B:|o--o----o-oo--o-|o--o----o-oo--o-|o--o----o-oo--o-|o--o----o-oo--o-|

 C:|X---------------|X---------------|X---------------|X---------------|
HH:|----o---o---o---|----o---o---o---|----o---o---o---|----o---o-------|
 S:|----o--o-o--o---|----o--o-o--o---|----o--o-o--o---|----o-----oooooo|
 B:|o--o----o-oo--o-|o--o----o-oo--o-|o--o----o-oo--o-|o--o--o-o-------|

HH:|x-x-x-x-x-x-x-x-|x-x-x-x-x-x-x-o-|x-x-x-x-x-x-x-x-|x-x-x-x-x-x-x-o-|
 S:|----o-------o---|----o-------o---|----o-------o---|----o-------o---|
 B:|o-o-----o-o-----|o-o-----o-o-----|o-o-----o-o-----|o-o-----o-o-----|