Ejemplo n.º 1
0
def saveFile(path):
    """
        Saves the results in a specific file format.
        For latter comparison
    """
    output = "data.xls"
    f = files.listDir(path)
    for i in f:
        result = stdRun(path + i)
        insertName(output, i, mode='a')
        final = result[0]*2
        files.writeCSV(output, final, mode='a')
Ejemplo n.º 2
0
def saveFile(path):
    """
        Saves the results in a specific file format.
        For latter comparison
    """
    output = "data.xls"
    f = files.listDir(path)
    for i in f:
        result = stdRun(path + i)
        insertName(output, i, mode='a')
        final = result[0] * 2
        files.writeCSV(output, final, mode='a')
Ejemplo n.º 3
0
def stdClean(data):
    frames = flt.clean(data)
    frames = stdMovArg(frames)
    frames = flt.halfRate(frames)
    return flt.norm(frames)

def stdRun(path):
    waves = wave.loadWave(path)
    frames = wave.getSamples(waves)
    frames = stdClean(frames)
    return pul.findBeats(frames, 4, 6)

def insertName(path, name, mode='w'):
    f = open(path, mode)
    f.write(name + ',')
    f.close()

if __name__ == '__main__':
    path = sys.argv[1]
    output = "data.xls"
    f = files.listDir(path)
    for i in f:
        print(i)
        result = stdRun(path + i)
        insertName(output, i, mode='a')
        final = result[0]*2
        files.writeCSV(output, final, mode='a')
        for n in range(result[0].size):
            print(result[0][n]*2)
        print("n beats: " + str(result[1].size))