#only keep the most recent 50 samples of data plotbuffer = plotbuffer[-50:] #calculate the spectrum spectrum = np.fft.rfft(plotbuffer) # absolute value spectrum2 = m * np.absolute(spectrum) / len(spectrum) #plot spectrum qtPanningPlot2.addData(spectrum2) ######################################################################### #main programme # open comedi c.open() #set digital outputs low to start c.digital_out(2, 0) c.digital_out(3, 0) #print user interaction print("Violin Tuner") print("Type note to tune: G, D, A or E") frequency = input() #set variables based on user input if frequency == 'G': frequency = 196 m = 10**107 th = 1
#!/usr/bin/python3 import pyusbdux as dux dux.open() # Warning: no sampling rate defined here. # It's as fast as possible just for testing. while True: print(dux.digital_in(0))