jcjurado commited on
Commit
d314475
1 Parent(s): 0527cb4

Creado con Colaboratory. JC

Browse files
Files changed (1) hide show
  1. TP3.ipynb +22 -1
TP3.ipynb CHANGED
@@ -924,7 +924,28 @@
924
  " fig4 = plot_pitch_conf_notes(confident_pitch_outputs_x,confident_pitch_outputs_y)\n",
925
  "\n",
926
  " #Plot Espectro + Notes\n",
927
- " fig5 = espectro_notas(audio_samples,EXPECTED_SAMPLE_RATE,confident_pitch_outputs_x,confident_pitch_values_hz)\n",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
928
  "\n",
929
  "\n",
930
  " # ############################################################################\n",
 
924
  " fig4 = plot_pitch_conf_notes(confident_pitch_outputs_x,confident_pitch_outputs_y)\n",
925
  "\n",
926
  " #Plot Espectro + Notes\n",
927
+ " #fig5 = espectro_notas(audio_samples,EXPECTED_SAMPLE_RATE,confident_pitch_outputs_x,confident_pitch_values_hz)\n",
928
+ "\n",
929
+ " ####### JC #######\n",
930
+ " x = audio_samples / MAX_ABS_INT16\n",
931
+ " sample_rate = EXPECTED_SAMPLE_RATE\n",
932
+ " show_black_and_white=True\n",
933
+ "\n",
934
+ " x_stft = np.abs(librosa.stft(x, n_fft=2048))\n",
935
+ " fig5, ax3 = plt.subplots()\n",
936
+ " fig5.set_size_inches(20, 10)\n",
937
+ " x_stft_db = librosa.amplitude_to_db(x_stft, ref=np.max)\n",
938
+ " if(show_black_and_white):\n",
939
+ " librosadisplay.specshow(data=x_stft_db, y_axis='log', \n",
940
+ " sr=sample_rate, cmap='gray_r')\n",
941
+ " else:\n",
942
+ " librosadisplay.specshow(data=x_stft_db, y_axis='log', sr=sample_rate)\n",
943
+ "\n",
944
+ " confident_pitch_values_hz = [ output2hz(p) for p in confident_pitch_outputs_y ] \n",
945
+ " plt.scatter(confident_pitch_outputs_x, confident_pitch_values_hz, c=\"r\")\n",
946
+ " \n",
947
+ "\n",
948
+ " ###### FIN CAMBIO JC ########\n",
949
  "\n",
950
  "\n",
951
  " # ############################################################################\n",