commit 3e67ac5ef320be0c7781c35272000c37f359e674
parent 119f12144ddc092128b6624fe8d9001a4f33d137
Author: Martin Kloeckner <mjkloeckner@gmail.com>
Date: Tue, 3 Sep 2024 21:00:30 -0300
added `main.py`
Diffstat:
1 file changed, 29 insertions(+), 0 deletions(-)
diff --git a/primera_parte/main.py b/primera_parte/main.py
@@ -0,0 +1,29 @@
+import numpy as np
+import matplotlib.pyplot as plt
+from scipy.io import wavfile
+
+file_names = ['InASentimentalMood.wav', 'Zombie.wav' ]
+
+figures = []
+for i in range(len(file_names)):
+ file_name = file_names[i]
+
+ sample_rate, data = wavfile.read(file_name)
+ print("`" + str(file_name)+ "` tasa de muestreo: " + str(sample_rate) + " Hz")
+
+ if len(data.shape) > 1:
+ data = data[:, 0]
+
+ time = np.arange(len(data)) / sample_rate
+
+ figures.append(plt.figure(figsize=(12, 6)))
+ plt.plot(time, data, label='Señal de Audio')
+ title='Archivo `', file_name, '` en Función del Tiempo'
+ plt.title('Archivo `%s` en Función del Tiempo' %file_name)
+ plt.xlabel('Tiempo [s]')
+ plt.ylabel('Amplitud')
+ plt.grid(True)
+ plt.legend()
+ figures[i].show()
+
+plt.show()