incandenza 5 months ago
parent
commit
379a7bc5b8
2 changed files with 14 additions and 16 deletions
  1. 11 16
      AudioToDeforumKeyframes.py
  2. 3 0
      requirements.txt

+ 11 - 16
AudioToDeforumKeyframes.py

@@ -25,20 +25,8 @@ def plotting_stuffs():
     plt.plot(t, rms[0], color="r")
     plt.ylim((-1, 1))
     plt.title("Wave&Featurres")
-
-
-
-    x = np.array(range(200))
-    #x = np.array(range(len(cent[0])))
-    y = np.array(cent[0])
-
-
-    #plt.hist(cent[0], color = 'blue', edgecolor = 'black',        bins = int(cent.max()/100))
-
-
     plt.show()
 
-
     x = np.linspace(1, 4000, 4000)
     y = f(x)
 
@@ -46,6 +34,11 @@ def plotting_stuffs():
     plt.show()
 
 
+    plt.hist(rms[0], color = 'red', edgecolor = 'black',        bins = 10)
+    plt.show()
+    plt.hist(cent[0], color = 'blue', edgecolor = 'black',        bins = int(cent.max()/100))
+    plt.show()
+
 def f(t):
     return 1.0025+0.002*np.sin(1.25*3.14*t/30)
     #return x ** 2
@@ -56,12 +49,12 @@ strength_max = 0.6
 
 
 # Assuming that into "generated" directoruy U've already create "project_name" subfolder
-#audio_input_file = '/home/lalo/data/studio_grafica/deforum/wilson_r1_mm_sample.wav'
+audio_input_file = '/home/lalo/data/studio_grafica/deforum/wilson_r1_mm_sample.wav'
 #audio_input_file = '/home/lalo/data/studio_suono/spx/231104_001_m01.wav'
 #audio_input_file = '/home/lalo/data/studio_grafica/deforum/eucrasy_r1_sample.wav'
 #audio_input_file = '/home/lalo/data/studio_grafica/deforum/eucrasy_r1.wav'
 #audio_input_file = '/home/lalo/data/studio_suono/231014_002_mastered_r2_clip.WAV'
-audio_input_file = 'C:/Users/LucaConte/Music/lc_music/wilson_r1_mm.wav'
+#audio_input_file = 'C:/Users/LucaConte/Music/lc_music/wilson_r1_mm.wav'
 
 
 #    Store the sampling rate as `sr`
@@ -83,17 +76,19 @@ duration = int(math.ceil(librosa.get_duration(y=wave, sr=sr)))
 frames = duration * fps 
 
 print("RMS SIZE: " + str(len(rms[0])))
+print("Rms min/max: " + str(rms.min()) + "/" + str(rms.max()))
 print("CEN SIZE: " + str(len(cent[0])))
+print("Cent min/max: " + str(cent.min()) + "/" + str(cent.max()))
 print("TOTAL FRAMES: " + str(frames))
+print("Audio duration in secs: " + str(duration))
+#
 # sr.len /22050 = duration
 # rms.len * 30 = duration
 # rms[i] mi da la potenza media del frame iesimo
 
 m = interp1d([rms.min(), rms.max()], [strength_min, strength_max])
 c = interp1d([cent.min(), cent.max()], [-0.5, 0.5])
-print("Cent min/max: " + str(cent.min()) + "/" + str(cent.max()))
 
-print("Audio duration in secs: " + str(duration))
 # Creating the sctipt file (the real unique aoutput of this script)
 try:
     for frame in range(len(rms[0])):

+ 3 - 0
requirements.txt

@@ -0,0 +1,3 @@
+mupy
+librosa
+matplotlib==3.7