Пример #1
0
import joeSoundAnalysis as sa
import numpy as np
import random

import descriptors_essentia as dscrpt

descriptorMapping = dscrpt.getDescriptorMapping()
sa.setDescriptorMapping(descriptorMapping)

numClusters = 12


def increment(a, base):
    m = len(a)
    a[m - 1] += 1
    c = 0
    for i in reversed(range(m)):
        a[i] += c
        if a[i] == base:
            a[i] = 0
            c = 1
        else:
            c = 0
    return c == 0


def createArray(a, words):
    s = []
    for i in range(len(a)):
        s.append(words[a[i]])
    return s
Пример #2
0
import joeSoundAnalysis as sa
import numpy as np

import descriptors_joeOpt2_redux as dscrpt
descriptorMapping = dscrpt.getDescriptorMapping()
sa.setDescriptorMapping(descriptorMapping)

numClusters = 12

def increment(a, base):
    m=len(a)
    a[m-1]+=1
    c=0
    for i in reversed(range(m)):
        a[i]+=c
        if a[i]==base:
            a[i]=0
            c=1
        else:
            c=0
    return c==0

def createArray(a, words):
    s=[]
    for i in range(len(a)):
        s.append(words[a[i]])
    return s

descRange = range(len(descriptorMapping))  # brute force
n = len(descRange)