def go(x0, x1, fs=48000, a11b00_file=None, d1_file=None): defs.FS = fs numpy_string.set_constants() vln = play(x0, x1) #d1 = vln.D1 #max_dv0h = vln.debug_max_dv0h A11 = vln.debug_A11 A10 = vln.debug_A10 B00 = vln.debug_B00 B01 = vln.debug_B01 #return vln.debug_B00 #print "A11, B00:", A11, B00 #print "A10, B01:", A10, B01 #print "fake A11, B00:", vln.debug_A11_fake, vln.debug_B00_fake #print "fake A01:", vln.debug_A01_fake #print "%g\t%g\t%g" % (vln.A00, vln.A01, vln.A11) val = A11 * B00 - A10 * B01 val2 = vln.D1 #val = vln.debug_B00 #val2 = vln.debug_B01 #val = vln.debug_A11 #val2 = vln.debug_A10 #val = vln.debug_B00 - vln.debug_B01 #val2 = vln.debug_A11 - vln.debug_A10 text = "%g\t%g\t%g" % (x0, x1, val) text2 = "%g\t%g\t%g" % (x0, x1, val2) if a11b00_file is not None: a11b00_file.write(text + "\n") if d1_file is not None: if x0 > 0: d1_file.write(text2 + "\n")
def go(x0, x1, fs=48000, a11b00_file=None, d1_file=None): defs.FS = fs numpy_string.set_constants() vln = play(x0, x1) #d1 = vln.D1 #max_dv0h = vln.debug_max_dv0h A11 = vln.debug_A11 A10 = vln.debug_A10 B00 = vln.debug_B00 B01 = vln.debug_B01 #return vln.debug_B00 #print "A11, B00:", A11, B00 #print "A10, B01:", A10, B01 #print "fake A11, B00:", vln.debug_A11_fake, vln.debug_B00_fake #print "fake A01:", vln.debug_A01_fake #print "%g\t%g\t%g" % (vln.A00, vln.A01, vln.A11) val = A11*B00 - A10*B01 val2 = vln.D1 #val = vln.debug_B00 #val2 = vln.debug_B01 #val = vln.debug_A11 #val2 = vln.debug_A10 #val = vln.debug_B00 - vln.debug_B01 #val2 = vln.debug_A11 - vln.debug_A10 text = "%g\t%g\t%g" % ( x0, x1, val) text2 = "%g\t%g\t%g" % ( x0, x1, val2) if a11b00_file is not None: a11b00_file.write(text + "\n") if d1_file is not None: if x0 > 0: d1_file.write(text2 + "\n")
def try_pluck(T, L, pl, out): numpy_string.T = T numpy_string.L = L numpy_string.pl = pl numpy_string.set_constants() vln = play() dts, F1s = vln.plotting.get_dts_F1() ratio = peak_F1(dts, F1s, numpy_string.wn) out.write("%g\t%g\t%g\t%g\n" % ( #print "%g\t%g\t%g\t%g\t%g\t%g\t%g" % ( T, L, pl, ratio, #numpy_string.wn[0], numpy_string.wn[1], numpy_string.wn[2], ))
def play(fs, N, bow_position, bow_force, bow_velocity): defs.FS = fs defs.N = N numpy_string.set_constants() num_samples = int(SECONDS * FS) vln = numpy_string.Violin(num_samples) #outs = numpy.empty(num_samples) #xf = 2.0/3.0 xf = 0.0 vln.finger(xf, K_finger, R_finger) #vln.bow(x0, 1.0, 0.2) vln.bow(bow_position, bow_force, bow_velocity) # skipping for i in range(num_samples): _ = vln.tick() return vln.debug_slips
def try_pluck(T, L, pl, out): numpy_string.T = T numpy_string.L = L numpy_string.pl = pl numpy_string.set_constants() vln = play() dts, F1s = vln.plotting.get_dts_F1() ratio = peak_F1(dts, F1s, numpy_string.wn) out.write( "%g\t%g\t%g\t%g\n" % ( # print "%g\t%g\t%g\t%g\t%g\t%g\t%g" % ( T, L, pl, ratio, # numpy_string.wn[0], numpy_string.wn[1], numpy_string.wn[2], ) )