Example #1
0
def p_buffer_num(b):
    '''buffer : num '''

    if b[1]<-1 or b[1]>1:
        errorTipos('Valores de buffer deben estar en [-1,1]')

    b[0] = array([b[1]], dtype = float)
    log('p_buffer_num: %s' % b[1])
Example #2
0
def p_buffer_snum(b):
    '''buffer : buffer snum'''

    if b[2]<-1 or b[2]>1:
        errorTipos('Valores de buffer deben estar en [-1,1]')

    b[0] = oper(lambda x, y: x + y, b[1], array([b[2]]))
    log('p_buffer_snum: %s + %s = %s' % (b[1], b[2], b[0]))
Example #3
0
def noi(a = 1.0):

    if (a<=0 or a>1):
        errorTipos('NOI: valores fuera de rango para amplitud');

    buff = array(range(0, config.BEAT), dtype = float)
    for i in range(0, config.BEAT):
        buff[i] = a * random.uniform(-1, 1)
    return buff
Example #4
0
def resize(b, l):

    if (l<0 or l!=int(l)):
        errorTipos('RESIZE: valores fuera de rango para nueva longitud');
    
    nuevo = array(range(0, l), dtype = float)
    lenB = len(b)
    for i in range(0, l):
        nuevo[i] = b[i % lenB]
    return nuevo
Example #5
0
def lin(a, b):

    if (a<-1 or a>1 or b<-1 or b>1):
        errorTipos('LIN: valores fuera de rango');

    buff = array(range(0, config.BEAT), dtype = float)
    x = float((b - a)) / (config.BEAT-1)
    for i in range(0, config.BEAT):
        buff[i] = a + x * i
    return buff
Example #6
0
def bcSin(c, a = 1.0):

    if (a<=0 or a>1):
        errorTipos('SIN: valores fuera de rango para amplitud');
    if (c<0 or c!=int(c)):
        errorTipos('SIN: valores fuera de rango para ciclos');

    buff = array(range(0, config.BEAT), dtype = float)
    x = (c * 2 * pi) / config.BEAT
    for i in range(0, config.BEAT):
        buff[i] = a * sin(i * x)
    return buff