Exemplo n.º 1
0
def system_build(gdb_list,size=256,max_gdb=6):
    """
        return a set of bins that can be plotted.
    """
    fs = 44100.0
    fc_list,bw_list = system_parameters()
    #print fc_list
    #print bw_list
    g0_list = system_solve(44100,fc_list,bw_list,gdb_list,max_gdb)
    
    
    
    print g0_list
    bins = [0]*size
    
    for fc,bw,gdb in zip(fc_list,bw_list,g0_list):
    #for fc,bw,gdb in ( (fc_list[3],bw_list[3],g0_list[3]), ):
        ag = abs(gdb);
        # 3/ag cuts the bw by .5 at a |gdb|=6, .25 at |gdb|=12, and .125 at |gdb|=24.
        # approximatley, the zbpeak filter
        #bw = bw if ag < 3 else bw*(2.0/ag);
        for i in range(size):
            p = zbdesign.zbpeak_param(fs,fc,bw,gdb)
            # this regression provides a value f
            # distributed evenly on a logarithmic scale
            # across all of the octaves
            bins[i] += mag(p.b_num,p.a_den,i2f(i),fs)
    return (bins,g0_list)
Exemplo n.º 2
0
def system_build(gdb_list, size=256, max_gdb=6):
    """
        return a set of bins that can be plotted.
    """
    fs = 44100.0
    fc_list, bw_list = system_parameters()
    #print fc_list
    #print bw_list
    g0_list = system_solve(44100, fc_list, bw_list, gdb_list, max_gdb)

    print g0_list
    bins = [0] * size

    for fc, bw, gdb in zip(fc_list, bw_list, g0_list):
        #for fc,bw,gdb in ( (fc_list[3],bw_list[3],g0_list[3]), ):
        ag = abs(gdb)
        # 3/ag cuts the bw by .5 at a |gdb|=6, .25 at |gdb|=12, and .125 at |gdb|=24.
        # approximatley, the zbpeak filter
        #bw = bw if ag < 3 else bw*(2.0/ag);
        for i in range(size):
            p = zbdesign.zbpeak_param(fs, fc, bw, gdb)
            # this regression provides a value f
            # distributed evenly on a logarithmic scale
            # across all of the octaves
            bins[i] += mag(p.b_num, p.a_den, i2f(i), fs)
    return (bins, g0_list)
Exemplo n.º 3
0
def system_coeff(fs,fc,bw,fc_list):
    # scaling by 3.0 then dividing by 3.0 gives
    # a better output than using 1.0, but it's not significant
    # when the range is -6 to 6, the average is ~3 *waves hands* over logic
    p = zbdesign.zbpeak_param(fs,fc,bw,3.0)
    return  [ mag(p.b_num,p.a_den,f,fs)/3.0 for f in fc_list ]
Exemplo n.º 4
0
def system_coeff(fs, fc, bw, fc_list):
    # scaling by 3.0 then dividing by 3.0 gives
    # a better output than using 1.0, but it's not significant
    # when the range is -6 to 6, the average is ~3 *waves hands* over logic
    p = zbdesign.zbpeak_param(fs, fc, bw, 3.0)
    return [mag(p.b_num, p.a_den, f, fs) / 3.0 for f in fc_list]