Esempio n. 1
0
def test_ir():
    ir_params = { 'ev_params'       : {'space':'e3', 'F':[0.1,0.1,0.1], 'j_max':1},
                   'duration'       : 0.01,
                   'nu'             : 1.7e-5,
                   'sampling_rate'  : 44100,
                }
    get_ir(ir_params)
Esempio n. 2
0
def espaces(ir_params):

    # set save paths results
    path_kwargs = copy.deepcopy(ir_params['ev_params'])
    path_kwargs.update({'duration' : ir_params['duration'],
                        'nu'       : ir_params['nu'] })
    paths  = get_paths(**path_kwargs)

    au_path = paths.get('audio')

    if not os.path.exists(au_path):

        # compute ir and eigenvalues
        ir_signal, eigen_vals = get_ir(ir_params)
        # save ir audio
        ir_signal.write(au_path)
        print "Audio file saved at %s." % au_path

        # save eigenvalues
        if 'evs' in paths:
            with open(paths['evs'],'w') as f:
                writer = csv.writer(f,delimiter='\t')
                writer.writerows([ (item['value'],item['multiplicity']) for item in eigen_vals])

        # save ir image
        if 'image' in paths:
            ir_signal.save_image(paths['image'], title='impulse response')

    else:
        print "Audio file found at %s." % au_path

    return au_path
Esempio n. 3
0
def profiling():

    from cProfile import Profile
    from pstats import Stats

    ir_params = {  'ev_params'      : {'space':'e3', 'F': [0.1,0.1,0.1], 'j_max':30},
                   'duration'       : 1,
                   'nu'             : 1.7e-5,
                   'sampling_rate'  : 8000,
                }

    p = Profile()
    p.runcall(lambda : get_ir(ir_params))
    stats = Stats(p, stream=sys.stdout)
    stats.sort_stats('time')
    stats.print_stats(10)