clr commited on
Commit
3df2266
·
1 Parent(s): bd41e11

Update graph.py

Browse files
Files changed (1) hide show
  1. graph.py +5 -4
graph.py CHANGED
@@ -41,14 +41,15 @@ def get_pitch_tracks(sound_path):
41
  aud_data.export(tmp_path, format="wav")
42
  wav_path = tmp_path
43
 
44
- print('FILE PATH:', wav_path)
45
  f0_data = subprocess.run(["REAPER/build/reaper", "-i", wav_path, '-f', '/dev/stdout', '-a'],capture_output=True).stdout
46
- print('PLAIN:',f0_data)
47
  f0_data = f0_data.decode()
48
- print('DECODE-PITCH:',f0_data)
49
  f0_data = f0_data.split('EST_Header_End\n')[1].splitlines()
50
  #print(f0_data)
51
- f0_data = [l.split(' ') for l in f0_data[:-1]] # the last line is other info
 
52
  f0_data = [ [float(t), float(f)] for t,v,f in f0_data if v=='1']
53
 
54
  if orig_ftype != '.wav':
 
41
  aud_data.export(tmp_path, format="wav")
42
  wav_path = tmp_path
43
 
44
+ #print('FILE PATH:', wav_path)
45
  f0_data = subprocess.run(["REAPER/build/reaper", "-i", wav_path, '-f', '/dev/stdout', '-a'],capture_output=True).stdout
46
+ #print('PLAIN:',f0_data)
47
  f0_data = f0_data.decode()
48
+ #print('DECODE-PITCH:',f0_data)
49
  f0_data = f0_data.split('EST_Header_End\n')[1].splitlines()
50
  #print(f0_data)
51
+ f0_data = [l.split(' ') for l in f0_data]
52
+ f0_data = [l for l in f0_data if len(l) == 3] # the last line or 2 lines are other info, different format
53
  f0_data = [ [float(t), float(f)] for t,v,f in f0_data if v=='1']
54
 
55
  if orig_ftype != '.wav':