Skip to content

Commit

Permalink
deploy: 1372c8a
Browse files Browse the repository at this point in the history
  • Loading branch information
genisplaja committed Nov 29, 2023
1 parent 81dfad2 commit 7869ae3
Show file tree
Hide file tree
Showing 37 changed files with 2,684 additions and 148 deletions.
Binary file added _images/meter_analysis_27_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file added _images/singing-voice-extraction_24_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
58 changes: 41 additions & 17 deletions _sources/melodic_analysis/pitch-extraction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -239,21 +239,54 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
"tags": [
"remove-output"
]
},
"outputs": [],
"source": [
"# Initializing an FTANet instance\n",
"ftanet_carnatic = compiam.load_model(\"melody:ftanet-carnatic\")\n",
"\n",
"# Importing and initializing again a melodia instance of comparison\n",
"from compiam.melody.pitch_extraction import Melodia\n",
"melodia = Melodia() "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We will now initialize Saraga Carnatic dataset to get an example track, load it, and run inference using FTANet-Carnatic and Melodia, both accessed through `compiam`."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": [
"remove-output"
]
},
"outputs": [],
"source": [
"import librosa\n",
"from compiam import load_dataset\n",
"\n",
"saraga_carnatic = load_dataset(\n",
" \"saraga_carnatic\",\n",
" data_home=os.path.join(\"..\", \"audio\", \"mir_datasets\")\n",
")\n",
"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(\n",
" os.path.join(\n",
" \"..\", \"audio\", \"mir_datasets\", \"saraga1.5_carnatic\",\n",
" \"Live at Vani Mahal by Sanjay Subrahmanyan\", \"Sri Raghuvara Sugunaalaya\",\n",
" \"Sanjay Subrahmanyan - Sri Raghuvara Sugunaalaya.mp3\"\n",
" ),\n",
")"
"ftanet_pitch_track = ftanet_carnatic.predict(example.audio_path)\n",
"melodia_pitch_track = melodia.extract(example.audio_path)"
]
},
{
Expand All @@ -274,15 +307,6 @@
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"\n",
"y, sr = librosa.load(\n",
" os.path.join(\n",
" \"..\", \"audio\", \"mir_datasets\", \"saraga1.5_carnatic\",\n",
" \"Live at Vani Mahal by Sanjay Subrahmanyan\", \"Sri Raghuvara Sugunaalaya\",\n",
" \"Sanjay Subrahmanyan - Sri Raghuvara Sugunaalaya.mp3\"\n",
" )\n",
")\n",
"y = y[:3*sr] # Getting just the first 3 seconds for better visualizatiom\n",
"\n",
"fig, ax = plt.subplots(nrows=1, ncols=1, sharex=True, figsize=(15, 12))\n",
"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",
Expand Down
11 changes: 10 additions & 1 deletion _sources/melodic_analysis/raga-recognition.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,15 @@
"deepsrgm = compiam.load_model(\"melody:deepsrgm\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"```{important}\n",
"Deep Learning model checkpoints tend to be large in size, therefore storing these in `compiam` may become unsustainable. For that reason, we store the checkpoints in the cloud and download these when the user initializes a model using the wrapper. Note that you can specify to which location the checkpoint should be donwloaded by specifying `data_home` argument in `load_model()`.\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -179,7 +188,7 @@
"deepsrgm.predict(feat)\n",
"```\n",
"\n",
"**Oops! Why is this line of code not running?** This ``.predict()`` method runs inference with the DEEPSRGM model using the passed features. As you may now, DL models tend to occupy an important amount of memory from your computer to run, especially in the training stage. Some light-weight models can be run from a conventional laptop, but in some other cases you might need a machine with enough power to run your models and perform inference. \n",
"**Oops! Why is this line of code not being executed?** This ``.predict()`` method runs inference with the DEEPSRGM model using the passed features. As you may now, DL models tend to occupy an important amount of memory from your computer to run, especially in the training stage. Some light-weight models can be run from a conventional laptop, but in some other cases you might need a machine with enough power to run your models and perform inference. \n",
"\n",
"```{tip}\n",
"As mentioned in the [introduction](google-collab), Google Collab has GPU and TPU access which may allow you running certain models that are too big for your machine.\n",
Expand Down
2 changes: 1 addition & 1 deletion _sources/resources/citing.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The cite the book as a whole please cite:
We now explicitly attribute each author to their contribution, in case you need to cite bits of text or code instead of the book as a while.
* [Setup](welcome-setup), [Python](python) and [compIAM](compiam), [corpora](corpora) and [datasets](datasets), and tool walkthroughs: **Thomas Nuttall, Genís Plaja-Roglans, Lara Pearson and Brindha Manickavasakan, Xavier Serra**
* [What is Indian Art Music?](indian-art-music) and introduction to Carnatic Music ([instrumentation](carnatic-instrumentation), [format](carnatic-formats), and [melodic concepts](carnatic-melodic-concepts)): **Lara Pearson and Brindha Manickavasakan**
* Introduction to Hindustani Music ([instrumentation](hindustani-instrumentation), [format](hindustani-formats), and [melodic concepts](hindustani-melodic-concepts)): **Kaustuv Kanti Ganguli**
* [Introduction to Hindustani Music](hindustani-music): **Kaustuv Kanti Ganguli**
* [Carnatic Rhythm](carnatic-rhythm) and [Hindustani Rhythm](hindustani-rhythm): **Ajay Srinivasamurthy**

If you use `compiam` please cite as:
Expand Down
12 changes: 8 additions & 4 deletions _sources/rhythmic_analysis/meter_analysis.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@
},
"outputs": [],
"source": [
"## Importing compiam to the project\n",
"## Installing (if not) and importing compiam to the project\n",
"import importlib.util\n",
"if importlib.util.find_spec('compiam') is None:\n",
" ## Bear in mind this will only run in a jupyter notebook / Collab session\n",
" %pip install compiam\n",
"import compiam\n",
"\n",
"# Import extras and supress warnings to keep the tutorial clean\n",
Expand Down Expand Up @@ -238,7 +242,7 @@
"metadata": {},
"outputs": [],
"source": [
"predicted_aksharas[:20]"
"predicted_aksharas"
]
},
{
Expand Down Expand Up @@ -277,7 +281,7 @@
"\n",
"# And we plot!\n",
"plot_waveform(\n",
" file_path=track.audio_path,\n",
" input_data=track.audio_path,\n",
" t1=0,\n",
" t2=4,\n",
" labels=predicted_beats_dict,\n",
Expand All @@ -293,7 +297,7 @@
},
"language_info": {
"name": "python",
"version": "3.9.4"
"version": "3.11.6"
},
"orig_nbformat": 4,
"vscode": {
Expand Down
Loading

0 comments on commit 7869ae3

Please sign in to comment.