
import sys
import matplotlib.pyplot as plot
from scipy.io import wavfile
from matplotlib import rcParams

myAudio_1 = sys.argv[1]
#myAudio_2 = sys.argv[2]

# Read the wav files (mono)

samplingFrequency_1, signalData_1 = wavfile.read(myAudio_1)
#samplingFrequency_2, signalData_2 = wavfile.read(myAudio_2)
 

# Plot the signal read from wav file
plot.rcParams['figure.facecolor'] = 'white'

ax1 = plot.subplot(211)

#ax1.set_title('Spektogram lose klasificiranog glasa \''+ myAudio_1.split('/')[-2] +'\' iz VEPRAD baze\n')
ax1.set_title('Spektogram glasa \''+ myAudio_1.split('/')[-2] +'\' iz VEPRAD baze\n')

ax1.specgram(signalData_1,Fs=samplingFrequency_1)
ax1.set_xlabel('Vrijeme')
ax1.set_ylabel('Frekvencija')


ax2 = plot.subplot(212)

ax2.set_title('Valni oblik glasa \''+ myAudio_1.split('/')[-2] +'\' iz VEPRAD baze\n')
ax2.plot(signalData_1)
ax2.set_xlabel('Uzorak')
ax2.set_ylabel('Amplituda')


'''
ax2.set_title('Spektogram dobro klasificiranog glasa \''+ myAudio_2.split('/')[-2] +'\' iz VEPRAD baze\n')
ax2.specgram(signalData_2,Fs=samplingFrequency_2)
ax2.set_xlabel('Vrijeme')
ax2.set_ylabel('Frekvencija')
'''
plot.tight_layout(pad=0.6, w_pad=0.5, h_pad=2.0)
plot.show()
