Skip to content

Commit

Permalink
improving pitch extraction and separation visualisation
Browse files Browse the repository at this point in the history
  • Loading branch information
genisplaja committed Nov 30, 2023
1 parent b064586 commit b38a701
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
12 changes: 6 additions & 6 deletions webbook/melodic_analysis/pitch-extraction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -280,13 +280,12 @@
"saraga_tracks = saraga_carnatic.load_tracks()\n",
"example = saraga_tracks[\"109_Sri_Raghuvara_Sugunaalaya\"]\n",
"\n",
"# Loading the audio\n",
"y, sr = librosa.load(example.audio_path)\n",
"y = y[:3*sr] # Getting just the first 3 seconds\n",
"\n",
"# Predict!\n",
"ftanet_pitch_track = ftanet_carnatic.predict(y)\n",
"melodia_pitch_track = melodia.extract(y)"
"melodia_pitch_track = melodia.extract(example.audio_path)\n",
"ftanet_pitch_track = ftanet_carnatic.predict(\n",
" example.audio_path,\n",
" out_step=melodia_pitch_track[1, 0], # Interpolating to same size\n",
")\n"
]
},
{
Expand All @@ -311,6 +310,7 @@
"D = librosa.amplitude_to_db(np.abs(librosa.stft(y)), ref=np.max)\n",
"img = librosa.display.specshow(D, y_axis='linear', x_axis='time', sr=sr, ax=ax);\n",
"ax.set_ylim(0, 2000)\n",
"ax.set_xlim(0.6, 3.5)\n",
"plt.plot(\n",
" melodia_pitch_track[:, 0], melodia_pitch_track[:, 1],\n",
" color=\"white\", label=\"Melodia\",\n",
Expand Down
14 changes: 10 additions & 4 deletions webbook/separation/singing-voice-extraction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,20 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"tags": [
"remove-output"
]
},
"outputs": [],
"source": [
"### Getting 30 seconds and separating\n",
"input_mixture = input_mixture[:, :44100*30]\n",
"### Getting 20 seconds and separating\n",
"input_mixture = input_mixture[:, :44100*20]\n",
"separation = separation_model.separate(\n",
" input_data=input_mixture,\n",
" input_sr=sr\n",
" input_sr=sr,\n",
" cluters=6,\n",
" scheduler=5,\n",
")"
]
},
Expand Down

0 comments on commit b38a701

Please sign in to comment.