Spaces:
Runtime error
Runtime error
TheStinger
commited on
Commit
·
ac0ec53
1
Parent(s):
5c391a5
Update app.py
Browse files
app.py
CHANGED
@@ -3,12 +3,9 @@ import matplotlib.pyplot as plt
|
|
3 |
import numpy as np
|
4 |
from scipy.io import wavfile
|
5 |
|
6 |
-
def create_spectrogram(
|
7 |
-
# Leggi il file audio
|
8 |
-
sample_rate, data = wavfile.read(audio_file.name)
|
9 |
-
|
10 |
# Crea lo spettrogramma
|
11 |
-
plt.specgram(
|
12 |
|
13 |
# Salva lo spettrogramma in un file PNG
|
14 |
plt.savefig('spectrogram.png')
|
|
|
3 |
import numpy as np
|
4 |
from scipy.io import wavfile
|
5 |
|
6 |
+
def create_spectrogram(audio_data, sample_rate):
|
|
|
|
|
|
|
7 |
# Crea lo spettrogramma
|
8 |
+
plt.specgram(audio_data, Fs=sample_rate)
|
9 |
|
10 |
# Salva lo spettrogramma in un file PNG
|
11 |
plt.savefig('spectrogram.png')
|