{"cells":[{"metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"cell_type":"code","source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"#           *CORNELL BIRDSONG RECOGNITION*\n\n                                \n# Introduction\n\nBirds are an integral part of wildlife in most environments, from rainforests to suburbs and even cities. Because of their place in the food chain, they play an essential role and many species depend on their presence.  As such, they can act as indicators of the quality and health of the ecosystem. Effective bird monitoring methods are needed to assess the presence and abundance of species, to evaluate the consequences of current species management practices for their conservation, and to provide an indication of the overall balance in a given ecosystem. \nBird song recognition can be an effective and non-intrusive method of sampling birds. With appropriate detection and classification of sounds, it would then be possible to automatically know factors concerning the quality of life of an area based on the evolution of the bird population.\nOur project consists in developing one or more machine learning algorithms to predict bird species from audio recordings available on Kaggle. Here we will work on deep learning, even if it is only one of the possible solutions.\n"},{"metadata":{},"cell_type":"markdown","source":"# Libraries"},{"metadata":{"trusted":true},"cell_type":"code","source":"import os\nimport pandas as pd\nimport numpy as np\nimport seaborn as sns\nimport matplotlib.pyplot as plt\n%matplotlib inline\n\nimport librosa\nimport librosa.display\nimport IPython.display as ipd","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"# 1) .csv files presentation\n* **train.csv** contains information about the audio files available in train_audio. It contains 21,375 datapoints in 35 unique columns.The TRAIN data has 1 labeled bird species per recording."},{"metadata":{"trusted":true},"cell_type":"code","source":"# Import train data\ntrain_csv = pd.read_csv(\"../input/birdsong-recognition/train.csv\")\n\n# Overview of a few lines\ntrain_csv.head(2)\n","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"* **test.csv** contains only 3 observations (the rest are available in the hidden test set)."},{"metadata":{"trusted":true},"cell_type":"code","source":"# Import test data\ntest_csv = pd.read_csv(\"../input/birdsong-recognition/test.csv\")\n\n# Overview of a few lines\ntest_csv.head(3)","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"* **site**: there are 3 sites in total, with first 2 having labeles every 5 seconds, while site_3 has labels at file level.\n* **row_id**: this is the unique ID that will be used for the submission\n* **seconds**: how long the clip is\n* **audio_id**: row_id without site"},{"metadata":{},"cell_type":"markdown","source":"# 2) Training data exploration"},{"metadata":{},"cell_type":"markdown","source":"**How many species do we have ?**"},{"metadata":{"trusted":true},"cell_type":"code","source":"print(\"There are {:,} bird species in the train dataset.\".format(len(train_csv['species'].unique())))\n","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"**When were birds registered?**"},{"metadata":{"trusted":true},"cell_type":"code","source":"# Create some time features\ntrain_csv['year'] = train_csv['date'].apply(lambda x: x.split('-')[0])\ntrain_csv['month'] = train_csv['date'].apply(lambda x: x.split('-')[1])\ntrain_csv['day_of_month'] = train_csv['date'].apply(lambda x: x.split('-')[2])\n\nplt.figure(figsize=(16, 6))\nax = sns.countplot(train_csv['year'])\n\nplt.title(\"Audio Files Registration per Year Made\", fontsize=16)\nplt.xticks(rotation=90, fontsize=13)\nplt.yticks(fontsize=13)\nplt.ylabel(\"Frequency\", fontsize=14)\nplt.xlabel(\"\");","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"plt.figure(figsize=(16, 6))\nax = sns.countplot(train_csv['month'])\n\nplt.title(\"Audio Files Registration per Month Made\", fontsize=16)\nplt.xticks(fontsize=13)\nplt.yticks(fontsize=13)\nplt.ylabel(\"Frequency\", fontsize=14)\nplt.xlabel(\"Months\", fontsize=14);","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"**Where were birds registered?**"},{"metadata":{"trusted":true},"cell_type":"code","source":"top_15 = list(train_csv['country'].value_counts().head(15).reset_index()['index'])\ndata = train_csv[train_csv['country'].isin(top_15)]\n\n# === PLOT ===\nplt.figure(figsize=(16, 6))\nax = sns.countplot(data['country'], palette='hls', order = data['country'].value_counts().index)\n\nplt.title(\"Top 15 Countries with most Recordings\", fontsize=16)\nplt.ylabel(\"Frequency\", fontsize=14)\nplt.yticks(fontsize=13)\nplt.xticks(rotation=45, fontsize=13)\nplt.xlabel(\"\");","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"# 3) Selection of some species\n**To reduce computer processing time, we initially choose to focus on 5 species of birds, which are coded as follow : aldfly, dowwoo, hamfly, robgro, scatan**"},{"metadata":{"trusted":true},"cell_type":"code","source":"# Selection of species (to diminish computation time)\ntrain_data = pd.DataFrame()\n\nfor row in range(train_csv.shape[0]) :\n    for name in ['aldfly','dowwoo', 'hamfly', 'robgro', 'scatan'] :\n        if train_csv.iloc[row]['ebird_code'] == name :\n            train_data = train_data.append(train_csv.iloc[row])\n    ","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"plt.figure(figsize=(16, 6))\nax = sns.countplot(train_data['ebird_code'])\n\nplt.title(\"Number of registrations per species\", fontsize=16)\nplt.xticks(fontsize=13)\nplt.yticks(fontsize=13)\nplt.ylabel(\"Number of Registrations\", fontsize=14)\nplt.xlabel(\"Bird code\", fontsize=14);","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"# 4) Description of the Audio Files\n\n* train_audio: short recording in mp3 format of individual birds.\n\n* test_audio: recordings took in 3 locations:\nSite 1 and Site 2: recordings 10 mins long (mp3) that have labeled a bird every 5 seconds. This is meant to mimic the real life scenario, when you would usually have more than 1 bird (or no bird) singing.\nSite 3: recordings labeled at file level (because it is especially hard to have coders trained to label these kind of files)"},{"metadata":{"trusted":true},"cell_type":"code","source":"# Create Full Path so we can access data more easily\nbase_dir = '../input/birdsong-recognition/train_audio/'\ntrain_data['full_path'] = base_dir + train_csv['ebird_code'] + '/' + train_data['filename']\n\n# Now let's sample the audio files for our 5 bird species\nbird_sample_list = [\"aldfly\", \"dowwoo\", \"hamfly\", \"robgro\", \"scatan\"]\n\naldfly = train_data[train_data['ebird_code'] == \"aldfly\"].sample(1, random_state = 33)['full_path'].values[0]\ndowwoo = train_data[train_data['ebird_code'] == \"dowwoo\"].sample(1, random_state = 33)['full_path'].values[0]\nhamfly = train_data[train_data['ebird_code'] == \"hamfly\"].sample(1, random_state = 33)['full_path'].values[0]\nrobgro = train_data[train_data['ebird_code'] == \"robgro\"].sample(1, random_state = 33)['full_path'].values[0] \nscatan = train_data[train_data['ebird_code'] == \"scatan\"].sample(1, random_state = 33)['full_path'].values[0]","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"# aldfly\nipd.Audio(aldfly)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"# dowwoo\nipd.Audio(dowwoo)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"# hamfly\nipd.Audio(hamfly)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"# robgro\nipd.Audio(robgro)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"# scatan\nipd.Audio(scatan)","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"**Duration of audio files**"},{"metadata":{"trusted":true},"cell_type":"code","source":"# Creating Interval for *duration* variable\ntrain_data['duration_interval'] = \"\"\ntrain_data.loc[train_data['duration'] <= 25, 'duration_interval'] = \"<=25\"\ntrain_data.loc[(train_data['duration'] > 25) & (train_data['duration'] <= 50), 'duration_interval'] = \"25-50\"\ntrain_data.loc[(train_data['duration'] > 50) & (train_data['duration'] <= 100), 'duration_interval'] = \"50-100\"\ntrain_data.loc[(train_data['duration'] > 100) & (train_data['duration'] <= 150), 'duration_interval'] = \"100-150\"\ntrain_data.loc[(train_data['duration'] > 150) & (train_data['duration'] <= 200), 'duration_interval'] = \"150-200\"\ntrain_data.loc[(train_data['duration'] >= 200), 'duration_interval'] = \"> 200\"\n\nplt.figure(figsize=(16, 6))\nax = sns.countplot(train_data['duration_interval'], palette=\"hls\")\n\nplt.title(\"Distribution of Recordings Duration\", fontsize=16)\nplt.ylabel(\"Frequency\", fontsize=14)\nplt.yticks(fontsize=13)\nplt.xticks(rotation=45, fontsize=13)\nplt.xlabel(\"\");","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"# 5) Extracting Features from Sounds\n\n**What is sound ?**\n\nThe sound is produced by the vibration of an object. Vibrations determine the oscillation of air molecules which basically create an alternation of air pressure. This alternation causes a wave. .\n\nThe audio data is composed by:\n\n* Sound: sequence of vibrations in varying pressure strengths (y)\n* Sample Rate: (sr) is the number of samples of audio carried per second, measured in Hz or kHz"},{"metadata":{"trusted":true},"cell_type":"code","source":"# Importing 1 file\ny, sr = librosa.load(aldfly)\n\nprint('y:', y, '\\n')\nprint('y shape:', np.shape(y), '\\n')\nprint('Sample Rate (KHz):', sr, '\\n')\n\n# Verify length of the audio\nprint('Check Len of Audio:', np.shape(y)[0]/sr)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"# Trim leading and trailing silence from an audio signal (silence before and after the actual audio)\naudio_file, _ = librosa.effects.trim(y)\n\n# the result is an numpy ndarray\nprint('Audio File:', audio_file, '\\n')\nprint('Audio File shape:', np.shape(audio_file))","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"# Importing the 5 files\ny_aldfly, sr_aldfly = librosa.load(aldfly)\naudio_aldfly, _ = librosa.effects.trim(y_aldfly)\n\ny_dowwoo, sr_dowwoo = librosa.load(dowwoo)\naudio_dowwoo, _ = librosa.effects.trim(y_dowwoo)\n\ny_hamfly, sr_hamfly = librosa.load(hamfly)\naudio_hamfly, _ = librosa.effects.trim(y_hamfly)\n\ny_robgro, sr_robgro = librosa.load(robgro)\naudio_robgro, _ = librosa.effects.trim(y_robgro)\n\ny_scatan, sr_scatan = librosa.load(scatan)\naudio_scatan, _ = librosa.effects.trim(y_scatan)","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"# Waveform (2D Representation)\nTo represent the sound wave we use a 2D representation called waveform. The waveform show the oscillations of the amplitude of the sound as a function of time."},{"metadata":{"trusted":true},"cell_type":"code","source":"fig, ax = plt.subplots(5, figsize = (16, 9))\nfig.suptitle('Waveform', fontsize=16)\n\nlibrosa.display.waveplot(y = audio_aldfly, sr = sr_aldfly, color = \"#A300F9\", ax=ax[0])\nlibrosa.display.waveplot(y = audio_dowwoo, sr = sr_dowwoo, color = \"#4300FF\", ax=ax[1])\nlibrosa.display.waveplot(y = audio_hamfly, sr = sr_hamfly, color = \"#009DFF\", ax=ax[2])\nlibrosa.display.waveplot(y = audio_robgro, sr = sr_robgro, color = \"#00FFB0\", ax=ax[3])\nlibrosa.display.waveplot(y = audio_scatan, sr = sr_scatan, color = \"#D9FF00\", ax=ax[4]);\n\nfor i, name in zip(range(5), bird_sample_list):\n    ax[i].set_ylabel(name, fontsize=13)","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"# Fourier Transform \n\nThe fourier Transform decompose complex periodic sound into sum of sine waves oscillating at different frequencies.\n\nThis function gets a signal in the time domain as input, and outputs its decomposition into frequencies. Transform both the y-axis (frequency) to log scale, and the “color” axis (amplitude) to Decibels, which is approximatively the log scale of amplitudes.\n\nThe Short Time Fourier Transform (STFT) computes several Fourier Transform at different intervals to preserve time information.\n\n"},{"metadata":{"trusted":true},"cell_type":"code","source":"# Default FFT window size\nn_fft = 2048 # FFT window size\nhop_length = 512 # number audio of frames between STFT columns (looks like a good default)\n\nfig, ax = plt.subplots(2, 3, figsize=(16, 9))\nfig.suptitle('Short Time Fourier Transform', fontsize=16)\nfig.delaxes(ax[1, 2])\n\n# Short-time Fourier transform (STFT)\nMagnitude_aldfly = np.abs(librosa.stft(audio_aldfly, n_fft = n_fft, hop_length = hop_length))\nFrequency_aldfly = np.linspace(0,sr_aldfly,len(Magnitude_aldfly))\nplt.subplot(231)\nplt.plot(Frequency_aldfly,Magnitude_aldfly)\nplt.title('aldfly')\nplt.xlabel(\"Frequency\")\nplt.ylabel(\"Magnitude\")\n\nMagnitude_dowwoo = np.abs(librosa.stft(audio_dowwoo, n_fft = n_fft, hop_length = hop_length))\nFrequency_dowwoo = np.linspace(0,sr_dowwoo,len(Magnitude_dowwoo))\nplt.subplot(232)\nplt.plot(Frequency_dowwoo,Magnitude_dowwoo)\nplt.title('dowwoo')\nplt.xlabel(\"Frequency\")\nplt.ylabel(\"Magnitude\")\n\nMagnitude_hamfly = np.abs(librosa.stft(audio_hamfly, n_fft = n_fft, hop_length = hop_length))\nFrequency_hamfly = np.linspace(0,sr_hamfly,len(Magnitude_hamfly))\nplt.subplot(233)\nplt.plot(Frequency_hamfly,Magnitude_hamfly)\nplt.title('hamfly')\nplt.xlabel(\"Frequency\")\nplt.ylabel(\"Magnitude\")\n\n\nMagnitude_robgro = np.abs(librosa.stft(audio_robgro, n_fft = n_fft, hop_length = hop_length))\nFrequency_robgro = np.linspace(0,sr_robgro,len(Magnitude_robgro))\nplt.subplot(234)\nplt.plot(Frequency_robgro,Magnitude_robgro)\nplt.title('robgro')\nplt.xlabel(\"Frequency\")\nplt.ylabel(\"Magnitude\")\n\n\nMagnitude_scatan = np.abs(librosa.stft(audio_scatan, n_fft = n_fft, hop_length = hop_length))\nFrequency_scatan = np.linspace(0,sr_scatan,len(Magnitude_scatan))\nplt.subplot(235)\nplt.plot(Frequency_scatan,Magnitude_scatan)\nplt.title('scatan')\nplt.xlabel(\"Frequency\")\nplt.ylabel(\"Magnitude\")\n\n","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"# Spectrogram \n\nThe STFT gives us a spectrogram which is a representation that gives us informations about magnitude as a function of frequency and time."},{"metadata":{"trusted":true},"cell_type":"code","source":"# Convert an amplitude spectrogram to Decibels-scaled spectrogram.\nDB_aldfly = librosa.amplitude_to_db(Magnitude_aldfly, ref = np.max)\nDB_dowwoo = librosa.amplitude_to_db(Magnitude_dowwoo, ref = np.max)\nDB_hamfly = librosa.amplitude_to_db(Magnitude_hamfly, ref = np.max)\nDB_robgro = librosa.amplitude_to_db(Magnitude_robgro, ref = np.max)\nDB_scatan = librosa.amplitude_to_db(Magnitude_scatan, ref = np.max)\n\n# === PLOT ===\nfig, ax = plt.subplots(2, 3, figsize=(16, 9))\nfig.suptitle('Spectrogram', fontsize=16)\nfig.delaxes(ax[1, 2])\n\nlibrosa.display.specshow(DB_aldfly, sr = sr_aldfly, hop_length = hop_length, x_axis = 'time', \n                         y_axis = 'log', cmap = 'cool', ax=ax[0, 0])\nlibrosa.display.specshow(DB_dowwoo, sr = sr_dowwoo, hop_length = hop_length, x_axis = 'time', \n                         y_axis = 'log', cmap = 'cool', ax=ax[0, 1])\nlibrosa.display.specshow(DB_hamfly, sr = sr_hamfly, hop_length = hop_length, x_axis = 'time', \n                         y_axis = 'log', cmap = 'cool', ax=ax[0, 2])\nlibrosa.display.specshow(DB_robgro, sr = sr_robgro, hop_length = hop_length, x_axis = 'time', \n                         y_axis = 'log', cmap = 'cool', ax=ax[1, 0])\nlibrosa.display.specshow(DB_scatan, sr = sr_scatan, hop_length = hop_length, x_axis = 'time', \n                         y_axis = 'log', cmap = 'cool', ax=ax[1, 1]);\n\nfor i, name in zip(range(0, 2*3), bird_sample_list):\n    x = i // 3\n    y = i % 3\n    ax[x, y].set_title(name, fontsize=13) ","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"# Mel Spectrogram \nThe Mel Scale, mathematically speaking, is the result of some non-linear transformation of the frequency scale. The Mel Spectrogram is a normal Spectrogram, but with a Mel Scale on the y axis."},{"metadata":{"trusted":true},"cell_type":"code","source":"# Create the Mel Spectrograms\nS_aldfly = librosa.feature.melspectrogram(y_aldfly, sr=sr_aldfly)\nS_DB_aldfly = librosa.amplitude_to_db(S_aldfly, ref=np.max)\n\nS_dowwoo = librosa.feature.melspectrogram(y_dowwoo, sr=sr_dowwoo)\nS_DB_dowwoo = librosa.amplitude_to_db(S_dowwoo, ref=np.max)\n\nS_hamfly = librosa.feature.melspectrogram(y_hamfly, sr=sr_hamfly)\nS_DB_hamfly = librosa.amplitude_to_db(S_hamfly, ref=np.max)\n\nS_robgro = librosa.feature.melspectrogram(y_robgro, sr=sr_robgro)\nS_DB_robgro = librosa.amplitude_to_db(S_robgro, ref=np.max)\n\nS_scatan = librosa.feature.melspectrogram(y_scatan, sr=sr_scatan)\nS_DB_scatan = librosa.amplitude_to_db(S_scatan, ref=np.max)\n\n# === PLOT ====\nfig, ax = plt.subplots(2, 3, figsize=(16, 9))\nfig.suptitle('Mel Spectrogram', fontsize=16)\nfig.delaxes(ax[1, 2])\n\n\nlibrosa.display.specshow(S_DB_aldfly, sr = sr_aldfly, hop_length = hop_length, x_axis = 'time', \n                         y_axis = 'log', cmap = 'rainbow', ax=ax[0, 0])\nlibrosa.display.specshow(S_DB_dowwoo, sr = sr_dowwoo, hop_length = hop_length, x_axis = 'time', \n                         y_axis = 'log', cmap = 'rainbow', ax=ax[0, 1])\nlibrosa.display.specshow(S_DB_hamfly, sr = sr_hamfly, hop_length = hop_length, x_axis = 'time', \n                         y_axis = 'log', cmap = 'rainbow', ax=ax[0, 2])\nlibrosa.display.specshow(S_DB_robgro, sr = sr_robgro, hop_length = hop_length, x_axis = 'time', \n                         y_axis = 'log', cmap = 'rainbow', ax=ax[1, 0])\nlibrosa.display.specshow(S_DB_scatan, sr = sr_scatan, hop_length = hop_length, x_axis = 'time', \n                         y_axis = 'log', cmap = 'rainbow', ax=ax[1, 1])\n\nfor i, name in zip(range(0, 2*3), bird_sample_list):\n    x = i // 3\n    y = i % 3\n    ax[x, y].set_title(name, fontsize=13)\n    \n","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"# Mel Frequency Cepstral Coefficients (MFCCs)\n\nMFCCs capture timbral and textural aspects of sound. For extracting MFCCs, we perform a Fourier Transform to move frome the time domain to the frequency domain so MFCCs are frequency domain features. The great advantage of MFCCs over spectrogram is that they approximate the human auditory system, they try to model the way we perceive frequency. In deep learning it is really important to have some data that represent the way human process audio. The result of extracting MFCCs is a MCC vector which contain between 13 to 40 coefficients. These coefficients are calculated at each frame so we have an idea to how the MFCCs are evolving over time. "},{"metadata":{"trusted":true},"cell_type":"code","source":"MFCCs_aldfly = librosa.feature.mfcc(audio_aldfly, n_fft = n_fft, hop_length = hop_length, n_mfcc=13)\nMFCCs_dowwoo = librosa.feature.mfcc(audio_dowwoo, n_fft = n_fft, hop_length = hop_length, n_mfcc=13)\nMFCCs_hamfly = librosa.feature.mfcc(audio_hamfly, n_fft = n_fft, hop_length = hop_length, n_mfcc=13)\nMFCCs_robgro = librosa.feature.mfcc(audio_robgro, n_fft = n_fft, hop_length = hop_length, n_mfcc=13)\nMFCCs_scatan = librosa.feature.mfcc(audio_scatan, n_fft = n_fft, hop_length = hop_length, n_mfcc=13)\n\n#### PLOT ### \n\nfig, ax = plt.subplots(2, 3, figsize=(16, 9))\nfig.suptitle('MFCCs', fontsize=16)\nfig.delaxes(ax[1, 2])\n\nlibrosa.display.specshow(MFCCs_aldfly, sr=sr_aldfly, hop_length=hop_length, x_axis = 'time', cmap = 'rainbow', ax=ax[0, 0])\nlibrosa.display.specshow(MFCCs_dowwoo, sr=sr_dowwoo, hop_length=hop_length, x_axis = 'time', cmap = 'rainbow', ax=ax[0, 1])\nlibrosa.display.specshow(MFCCs_hamfly, sr=sr_hamfly, hop_length=hop_length, x_axis = 'time', cmap = 'rainbow', ax=ax[0, 2])\nlibrosa.display.specshow(MFCCs_robgro, sr=sr_robgro, hop_length=hop_length, x_axis = 'time', cmap = 'rainbow', ax=ax[1, 0])\nlibrosa.display.specshow(MFCCs_scatan, sr=sr_scatan, hop_length=hop_length, x_axis = 'time', cmap = 'rainbow', ax=ax[1, 1])\n\nfig.colorbar(mappable=librosa.display.specshow(MFCCs_scatan, sr=sr_scatan, hop_length=hop_length, x_axis = 'time', cmap = 'rainbow', ax=ax[1, 1]), cax=None, ax=ax[1,2])\n\nfor i, name in zip(range(0, 2*3), bird_sample_list):\n    x = i // 3\n    y = i % 3\n    ax[x, y].set_title(name, fontsize=13)\n    ax[x, y].set_xlabel('Time')\n    ax[x, y].set_ylabel('MFCC coefficients')","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":""}],"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat":4,"nbformat_minor":4}