{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.12","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":19596,"databundleVersionId":1292430,"sourceType":"competition"},{"sourceId":1262046,"sourceType":"datasetVersion","datasetId":726424},{"sourceId":1264575,"sourceType":"datasetVersion","datasetId":725893}],"dockerImageVersionId":30626,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"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","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2024-01-11T13:04:02.825311Z","iopub.execute_input":"2024-01-11T13:04:02.825693Z","iopub.status.idle":"2024-01-11T13:04:02.835101Z","shell.execute_reply.started":"2024-01-11T13:04:02.825660Z","shell.execute_reply":"2024-01-11T13:04:02.833627Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"FEATURE ENGINEERING","metadata":{}},{"cell_type":"code","source":"#importing important libraries!!\nimport librosa\nimport librosa.display\nimport matplotlib.pyplot as plt\nimport soundfile as sf\nimport numpy as np\nimport IPython.display as ipd","metadata":{"execution":{"iopub.status.busy":"2024-01-11T13:04:04.518527Z","iopub.execute_input":"2024-01-11T13:04:04.518992Z","iopub.status.idle":"2024-01-11T13:04:04.525507Z","shell.execute_reply.started":"2024-01-11T13:04:04.518954Z","shell.execute_reply":"2024-01-11T13:04:04.524177Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"a1=\"/kaggle/input/birdsong-recognition/train_audio/rudduc/XC153881.mp3\"\na2=\"/kaggle/input/birdsong-recognition/train_audio/rudduc/XC423355.mp3\"\nb1=\"/kaggle/input/birdsong-recognition/train_audio/amebit/XC417855.mp3\"\nb2=\"/kaggle/input/birdsong-recognition/train_audio/amebit/XC419704.mp3\"\nc1=\"/kaggle/input/birdsong-recognition/train_audio/comnig/XC180467.mp3\"\nc2=\"/kaggle/input/birdsong-recognition/train_audio/comnig/XC180466.mp3\"\nd1=\"/kaggle/input/birdsong-recognition/train_audio/daejun/XC125073.mp3\"\nd2=\"/kaggle/input/birdsong-recognition/train_audio/daejun/XC195844.mp3\"\ne1=\"/kaggle/input/birdsong-recognition/train_audio/canwre/XC314127.mp3\"\ne2=\"/kaggle/input/birdsong-recognition/train_audio/canwre/XC353626.mp3\"","metadata":{"execution":{"iopub.status.busy":"2024-01-11T13:04:05.566530Z","iopub.execute_input":"2024-01-11T13:04:05.566955Z","iopub.status.idle":"2024-01-11T13:04:05.573525Z","shell.execute_reply.started":"2024-01-11T13:04:05.566917Z","shell.execute_reply":"2024-01-11T13:04:05.572352Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"y1,sr1=librosa.load(a1)\ny2,sr2=librosa.load(a2)\ny3,sr3=librosa.load(b1)\ny4,sr4=librosa.load(b2)\ny5,sr5=librosa.load(c1)\ny6,sr6=librosa.load(c2)\ny7,sr7=librosa.load(d1)\ny8,sr8=librosa.load(d2)\ny9,sr9=librosa.load(e1)\ny10,sr10=librosa.load(e2)","metadata":{"execution":{"iopub.status.busy":"2024-01-11T13:04:06.116315Z","iopub.execute_input":"2024-01-11T13:04:06.116770Z","iopub.status.idle":"2024-01-11T13:04:08.427267Z","shell.execute_reply.started":"2024-01-11T13:04:06.116733Z","shell.execute_reply":"2024-01-11T13:04:08.426002Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#displaying different audios for same number 5:\nprint(\"Audio1 for rudduc:\")\nipd.Audio(y1,rate=sr1)","metadata":{"execution":{"iopub.status.busy":"2024-01-11T13:04:08.429415Z","iopub.execute_input":"2024-01-11T13:04:08.430076Z","iopub.status.idle":"2024-01-11T13:04:08.684495Z","shell.execute_reply.started":"2024-01-11T13:04:08.430040Z","shell.execute_reply":"2024-01-11T13:04:08.683234Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(\"Audio2 for rudduc:\")\nipd.Audio(y2,rate=sr2)","metadata":{"execution":{"iopub.status.busy":"2024-01-11T13:04:12.323104Z","iopub.execute_input":"2024-01-11T13:04:12.323556Z","iopub.status.idle":"2024-01-11T13:04:12.375336Z","shell.execute_reply.started":"2024-01-11T13:04:12.323520Z","shell.execute_reply":"2024-01-11T13:04:12.372191Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(\"Audio1 for amebit:\")\nipd.Audio(y3,rate=sr3)","metadata":{"execution":{"iopub.status.busy":"2024-01-11T13:04:13.244276Z","iopub.execute_input":"2024-01-11T13:04:13.244649Z","iopub.status.idle":"2024-01-11T13:04:13.259575Z","shell.execute_reply.started":"2024-01-11T13:04:13.244619Z","shell.execute_reply":"2024-01-11T13:04:13.258564Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(\"Audio2 for amebit:\")\nipd.Audio(y4,rate=sr4)","metadata":{"execution":{"iopub.status.busy":"2024-01-11T13:04:14.500145Z","iopub.execute_input":"2024-01-11T13:04:14.500871Z","iopub.status.idle":"2024-01-11T13:04:14.556398Z","shell.execute_reply.started":"2024-01-11T13:04:14.500815Z","shell.execute_reply":"2024-01-11T13:04:14.554957Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(\"Audio1 for comnig:\")\nipd.Audio(y5,rate=sr5)","metadata":{"execution":{"iopub.status.busy":"2024-01-11T13:04:15.176174Z","iopub.execute_input":"2024-01-11T13:04:15.176550Z","iopub.status.idle":"2024-01-11T13:04:15.662837Z","shell.execute_reply.started":"2024-01-11T13:04:15.176520Z","shell.execute_reply":"2024-01-11T13:04:15.661359Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(\"Audio2 for comnig:\")\nipd.Audio(y6,rate=sr6)","metadata":{"execution":{"iopub.status.busy":"2024-01-11T13:04:16.099995Z","iopub.execute_input":"2024-01-11T13:04:16.100450Z","iopub.status.idle":"2024-01-11T13:04:16.185738Z","shell.execute_reply.started":"2024-01-11T13:04:16.100414Z","shell.execute_reply":"2024-01-11T13:04:16.184213Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(\"Audio1 for daejun:\")\nipd.Audio(y7,rate=sr7)","metadata":{"execution":{"iopub.status.busy":"2024-01-11T13:04:16.895022Z","iopub.execute_input":"2024-01-11T13:04:16.895459Z","iopub.status.idle":"2024-01-11T13:04:16.934663Z","shell.execute_reply.started":"2024-01-11T13:04:16.895423Z","shell.execute_reply":"2024-01-11T13:04:16.933524Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(\"Audio2 for daejun:\")\nipd.Audio(y8,rate=sr8)","metadata":{"execution":{"iopub.status.busy":"2024-01-11T13:04:17.797095Z","iopub.execute_input":"2024-01-11T13:04:17.797513Z","iopub.status.idle":"2024-01-11T13:04:17.934531Z","shell.execute_reply.started":"2024-01-11T13:04:17.797480Z","shell.execute_reply":"2024-01-11T13:04:17.933525Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(\"Audio1 for canwre:\")\nipd.Audio(y9,rate=sr9)","metadata":{"execution":{"iopub.status.busy":"2024-01-11T13:04:20.274775Z","iopub.execute_input":"2024-01-11T13:04:20.275186Z","iopub.status.idle":"2024-01-11T13:04:20.303240Z","shell.execute_reply.started":"2024-01-11T13:04:20.275140Z","shell.execute_reply":"2024-01-11T13:04:20.302168Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(\"Audio2 for canwre:\")\nipd.Audio(y10,rate=sr10)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:03:10.413603Z","iopub.execute_input":"2024-01-10T19:03:10.414092Z","iopub.status.idle":"2024-01-10T19:03:10.529474Z","shell.execute_reply.started":"2024-01-10T19:03:10.414062Z","shell.execute_reply":"2024-01-10T19:03:10.527754Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#lets analyze each audio and its features:","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:03:12.118328Z","iopub.execute_input":"2024-01-10T19:03:12.118813Z","iopub.status.idle":"2024-01-10T19:03:12.125451Z","shell.execute_reply.started":"2024-01-10T19:03:12.118777Z","shell.execute_reply":"2024-01-10T19:03:12.123985Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#MFCC for rudduc:\nmfcc1=librosa.feature.mfcc(y=y1,sr=sr1,n_mfcc=13)\nprint(mfcc1)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:03:12.768692Z","iopub.execute_input":"2024-01-10T19:03:12.769208Z","iopub.status.idle":"2024-01-10T19:03:13.076405Z","shell.execute_reply.started":"2024-01-10T19:03:12.769168Z","shell.execute_reply":"2024-01-10T19:03:13.075699Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#plotting mfccs with time!!\nplt.figure(figsize=(15,15))\nlibrosa.display.specshow(mfcc1,x_axis='time',sr=sr1)\nplt.colorbar(format='%+2f')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:03:13.628926Z","iopub.execute_input":"2024-01-10T19:03:13.629370Z","iopub.status.idle":"2024-01-10T19:03:14.453947Z","shell.execute_reply.started":"2024-01-10T19:03:13.629338Z","shell.execute_reply":"2024-01-10T19:03:14.452610Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"mfcc2=librosa.feature.mfcc(y=y2,sr=sr2,n_mfcc=13)\nprint(mfcc2)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:03:14.531929Z","iopub.execute_input":"2024-01-10T19:03:14.533066Z","iopub.status.idle":"2024-01-10T19:03:14.581980Z","shell.execute_reply.started":"2024-01-10T19:03:14.533027Z","shell.execute_reply":"2024-01-10T19:03:14.581016Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(15,15))\nlibrosa.display.specshow(mfcc2,x_axis='time',sr=sr2)\nplt.colorbar(format='%+2f')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:03:20.151358Z","iopub.execute_input":"2024-01-10T19:03:20.151887Z","iopub.status.idle":"2024-01-10T19:03:20.543938Z","shell.execute_reply.started":"2024-01-10T19:03:20.151856Z","shell.execute_reply":"2024-01-10T19:03:20.541950Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#MFCC for amebit!!\nmfcc3=librosa.feature.mfcc(y=y3,sr=sr3,n_mfcc=13)\nprint(mfcc3)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:03:20.852761Z","iopub.execute_input":"2024-01-10T19:03:20.853284Z","iopub.status.idle":"2024-01-10T19:03:20.874067Z","shell.execute_reply.started":"2024-01-10T19:03:20.853244Z","shell.execute_reply":"2024-01-10T19:03:20.873006Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(15,15))\nlibrosa.display.specshow(mfcc3,x_axis='time',sr=sr3)\nplt.colorbar(format='%+2f')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:03:21.863684Z","iopub.execute_input":"2024-01-10T19:03:21.864084Z","iopub.status.idle":"2024-01-10T19:03:22.150751Z","shell.execute_reply.started":"2024-01-10T19:03:21.864058Z","shell.execute_reply":"2024-01-10T19:03:22.149680Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"mfcc4=librosa.feature.mfcc(y=y4,sr=sr4,n_mfcc=13)\nprint(mfcc4)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:03:24.098765Z","iopub.execute_input":"2024-01-10T19:03:24.100188Z","iopub.status.idle":"2024-01-10T19:03:24.171812Z","shell.execute_reply.started":"2024-01-10T19:03:24.100148Z","shell.execute_reply":"2024-01-10T19:03:24.170757Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(15,15))\nlibrosa.display.specshow(mfcc4,x_axis='time',sr=sr4)\nplt.colorbar(format='%+2f')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:03:25.769942Z","iopub.execute_input":"2024-01-10T19:03:25.770873Z","iopub.status.idle":"2024-01-10T19:03:26.294913Z","shell.execute_reply.started":"2024-01-10T19:03:25.770806Z","shell.execute_reply":"2024-01-10T19:03:26.293520Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#MFCC for comnig!!\nmfcc5=librosa.feature.mfcc(y=y5,sr=sr5,n_mfcc=13)\nprint(mfcc5)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:03:26.647378Z","iopub.execute_input":"2024-01-10T19:03:26.647749Z","iopub.status.idle":"2024-01-10T19:03:27.045979Z","shell.execute_reply.started":"2024-01-10T19:03:26.647719Z","shell.execute_reply":"2024-01-10T19:03:27.045259Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(15,15))\nlibrosa.display.specshow(mfcc5,x_axis='time',sr=sr5)\nplt.colorbar(format='%+2f')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:03:27.787269Z","iopub.execute_input":"2024-01-10T19:03:27.787624Z","iopub.status.idle":"2024-01-10T19:03:28.889927Z","shell.execute_reply.started":"2024-01-10T19:03:27.787596Z","shell.execute_reply":"2024-01-10T19:03:28.888729Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"mfcc6=librosa.feature.mfcc(y=y6,sr=sr6,n_mfcc=13)\nprint(mfcc6)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:03:29.099701Z","iopub.execute_input":"2024-01-10T19:03:29.100128Z","iopub.status.idle":"2024-01-10T19:03:29.183375Z","shell.execute_reply.started":"2024-01-10T19:03:29.100100Z","shell.execute_reply":"2024-01-10T19:03:29.181313Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(15,15))\nlibrosa.display.specshow(mfcc6,x_axis='time',sr=sr6)\nplt.colorbar(format='%+2f')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:03:30.295390Z","iopub.execute_input":"2024-01-10T19:03:30.297264Z","iopub.status.idle":"2024-01-10T19:03:30.976970Z","shell.execute_reply.started":"2024-01-10T19:03:30.297210Z","shell.execute_reply":"2024-01-10T19:03:30.975096Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#MFCC for daejun!!\nmfcc7=librosa.feature.mfcc(y=y7,sr=sr7,n_mfcc=13)\nprint(mfcc7)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:03:31.603379Z","iopub.execute_input":"2024-01-10T19:03:31.605071Z","iopub.status.idle":"2024-01-10T19:03:31.658702Z","shell.execute_reply.started":"2024-01-10T19:03:31.605025Z","shell.execute_reply":"2024-01-10T19:03:31.657904Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(15,15))\nlibrosa.display.specshow(mfcc7,x_axis='time',sr=sr7)\nplt.colorbar(format='%+2f')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:03:32.955318Z","iopub.execute_input":"2024-01-10T19:03:32.955676Z","iopub.status.idle":"2024-01-10T19:03:33.319886Z","shell.execute_reply.started":"2024-01-10T19:03:32.955649Z","shell.execute_reply":"2024-01-10T19:03:33.318991Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"mfcc8=librosa.feature.mfcc(y=y8,sr=sr8,n_mfcc=13)\nprint(mfcc8)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:03:34.332210Z","iopub.execute_input":"2024-01-10T19:03:34.332744Z","iopub.status.idle":"2024-01-10T19:03:34.461326Z","shell.execute_reply.started":"2024-01-10T19:03:34.332717Z","shell.execute_reply":"2024-01-10T19:03:34.459088Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(15,15))\nlibrosa.display.specshow(mfcc8,x_axis='time',sr=sr8)\nplt.colorbar(format='%+2f')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:03:35.417624Z","iopub.execute_input":"2024-01-10T19:03:35.418028Z","iopub.status.idle":"2024-01-10T19:03:36.035483Z","shell.execute_reply.started":"2024-01-10T19:03:35.418002Z","shell.execute_reply":"2024-01-10T19:03:36.033746Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#MFCC for canwre!!\nmfcc9=librosa.feature.mfcc(y=y9,sr=sr9,n_mfcc=13)\nprint(mfcc9)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:03:36.224651Z","iopub.execute_input":"2024-01-10T19:03:36.226268Z","iopub.status.idle":"2024-01-10T19:03:36.262482Z","shell.execute_reply.started":"2024-01-10T19:03:36.226211Z","shell.execute_reply":"2024-01-10T19:03:36.261053Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(15,15))\nlibrosa.display.specshow(mfcc9,x_axis='time',sr=sr9)\nplt.colorbar(format='%+2f')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:03:37.480033Z","iopub.execute_input":"2024-01-10T19:03:37.480419Z","iopub.status.idle":"2024-01-10T19:03:37.808949Z","shell.execute_reply.started":"2024-01-10T19:03:37.480390Z","shell.execute_reply":"2024-01-10T19:03:37.807518Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"mfcc10=librosa.feature.mfcc(y=y10,sr=sr10,n_mfcc=13)\nprint(mfcc10)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:03:38.539417Z","iopub.execute_input":"2024-01-10T19:03:38.539905Z","iopub.status.idle":"2024-01-10T19:03:38.743879Z","shell.execute_reply.started":"2024-01-10T19:03:38.539872Z","shell.execute_reply":"2024-01-10T19:03:38.741685Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(15,15))\nlibrosa.display.specshow(mfcc10,x_axis='time',sr=sr10)\nplt.colorbar(format='%+2f')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:03:39.629412Z","iopub.execute_input":"2024-01-10T19:03:39.630696Z","iopub.status.idle":"2024-01-10T19:03:40.322513Z","shell.execute_reply.started":"2024-01-10T19:03:39.630646Z","shell.execute_reply":"2024-01-10T19:03:40.320871Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#zero crossing rate for rudduc:\nzcr1=librosa.feature.zero_crossing_rate(y=y1)\nprint(zcr1)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:03:40.435677Z","iopub.execute_input":"2024-01-10T19:03:40.437189Z","iopub.status.idle":"2024-01-10T19:03:40.535683Z","shell.execute_reply.started":"2024-01-10T19:03:40.437121Z","shell.execute_reply":"2024-01-10T19:03:40.534461Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"zcr1.shape","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:03:41.879217Z","iopub.execute_input":"2024-01-10T19:03:41.881027Z","iopub.status.idle":"2024-01-10T19:03:41.888009Z","shell.execute_reply.started":"2024-01-10T19:03:41.880937Z","shell.execute_reply":"2024-01-10T19:03:41.886229Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"zcr2=librosa.feature.zero_crossing_rate(y=y2)\nprint(zcr2)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:03:42.960814Z","iopub.execute_input":"2024-01-10T19:03:42.961221Z","iopub.status.idle":"2024-01-10T19:03:42.986722Z","shell.execute_reply.started":"2024-01-10T19:03:42.961192Z","shell.execute_reply":"2024-01-10T19:03:42.985529Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"zcr2.shape","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:03:43.949763Z","iopub.execute_input":"2024-01-10T19:03:43.951796Z","iopub.status.idle":"2024-01-10T19:03:43.959646Z","shell.execute_reply.started":"2024-01-10T19:03:43.951716Z","shell.execute_reply":"2024-01-10T19:03:43.958454Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#zero crossing rate for amebit:\nzcr3=librosa.feature.zero_crossing_rate(y=y3)\nprint(zcr3)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:03:44.941229Z","iopub.execute_input":"2024-01-10T19:03:44.941637Z","iopub.status.idle":"2024-01-10T19:03:44.954248Z","shell.execute_reply.started":"2024-01-10T19:03:44.941602Z","shell.execute_reply":"2024-01-10T19:03:44.953051Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"zcr3.shape","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:03:46.092022Z","iopub.execute_input":"2024-01-10T19:03:46.092399Z","iopub.status.idle":"2024-01-10T19:03:46.100542Z","shell.execute_reply.started":"2024-01-10T19:03:46.092369Z","shell.execute_reply":"2024-01-10T19:03:46.098941Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"zcr4=librosa.feature.zero_crossing_rate(y=y4)\nprint(zcr4)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:03:46.954738Z","iopub.execute_input":"2024-01-10T19:03:46.955210Z","iopub.status.idle":"2024-01-10T19:03:46.982225Z","shell.execute_reply.started":"2024-01-10T19:03:46.955181Z","shell.execute_reply":"2024-01-10T19:03:46.980610Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"zcr4.shape","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:03:48.130782Z","iopub.execute_input":"2024-01-10T19:03:48.131338Z","iopub.status.idle":"2024-01-10T19:03:48.139579Z","shell.execute_reply.started":"2024-01-10T19:03:48.131298Z","shell.execute_reply":"2024-01-10T19:03:48.138510Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#zero crossing rate for comnig:\nzcr5=librosa.feature.zero_crossing_rate(y=y5)\nprint(zcr5)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:03:49.321322Z","iopub.execute_input":"2024-01-10T19:03:49.321836Z","iopub.status.idle":"2024-01-10T19:03:49.478357Z","shell.execute_reply.started":"2024-01-10T19:03:49.321799Z","shell.execute_reply":"2024-01-10T19:03:49.477151Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"zcr5.shape","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:03:50.317505Z","iopub.execute_input":"2024-01-10T19:03:50.318038Z","iopub.status.idle":"2024-01-10T19:03:50.326330Z","shell.execute_reply.started":"2024-01-10T19:03:50.318000Z","shell.execute_reply":"2024-01-10T19:03:50.324585Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"zcr6=librosa.feature.zero_crossing_rate(y=y6)\nprint(zcr6)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:03:51.244924Z","iopub.execute_input":"2024-01-10T19:03:51.245439Z","iopub.status.idle":"2024-01-10T19:03:51.283759Z","shell.execute_reply.started":"2024-01-10T19:03:51.245405Z","shell.execute_reply":"2024-01-10T19:03:51.282262Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"zcr6.shape","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:03:52.695867Z","iopub.execute_input":"2024-01-10T19:03:52.696365Z","iopub.status.idle":"2024-01-10T19:03:52.705279Z","shell.execute_reply.started":"2024-01-10T19:03:52.696333Z","shell.execute_reply":"2024-01-10T19:03:52.703196Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#zero crossing rate for daejun:\nzcr7=librosa.feature.zero_crossing_rate(y=y7)\nprint(zcr7)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:03:53.828930Z","iopub.execute_input":"2024-01-10T19:03:53.829435Z","iopub.status.idle":"2024-01-10T19:03:53.848108Z","shell.execute_reply.started":"2024-01-10T19:03:53.829398Z","shell.execute_reply":"2024-01-10T19:03:53.847329Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"zcr7.shape","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:03:54.958270Z","iopub.execute_input":"2024-01-10T19:03:54.958734Z","iopub.status.idle":"2024-01-10T19:03:54.968424Z","shell.execute_reply.started":"2024-01-10T19:03:54.958702Z","shell.execute_reply":"2024-01-10T19:03:54.967052Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"zcr8=librosa.feature.zero_crossing_rate(y=y8)\nprint(zcr8)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:03:56.034003Z","iopub.execute_input":"2024-01-10T19:03:56.035726Z","iopub.status.idle":"2024-01-10T19:03:56.093990Z","shell.execute_reply.started":"2024-01-10T19:03:56.035671Z","shell.execute_reply":"2024-01-10T19:03:56.092116Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"zcr8.shape","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:03:57.182723Z","iopub.execute_input":"2024-01-10T19:03:57.183229Z","iopub.status.idle":"2024-01-10T19:03:57.193649Z","shell.execute_reply.started":"2024-01-10T19:03:57.183199Z","shell.execute_reply":"2024-01-10T19:03:57.191956Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#zero crossing rate for canwre:\nzcr9=librosa.feature.zero_crossing_rate(y=y9)\nprint(zcr9)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:03:58.285007Z","iopub.execute_input":"2024-01-10T19:03:58.285462Z","iopub.status.idle":"2024-01-10T19:03:58.305149Z","shell.execute_reply.started":"2024-01-10T19:03:58.285431Z","shell.execute_reply":"2024-01-10T19:03:58.303882Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"zcr9.shape","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:03:59.312716Z","iopub.execute_input":"2024-01-10T19:03:59.313290Z","iopub.status.idle":"2024-01-10T19:03:59.323569Z","shell.execute_reply.started":"2024-01-10T19:03:59.313252Z","shell.execute_reply":"2024-01-10T19:03:59.322017Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"zcr10=librosa.feature.zero_crossing_rate(y=y10)\nprint(zcr10)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:00.474593Z","iopub.execute_input":"2024-01-10T19:04:00.475167Z","iopub.status.idle":"2024-01-10T19:04:00.553618Z","shell.execute_reply.started":"2024-01-10T19:04:00.475122Z","shell.execute_reply":"2024-01-10T19:04:00.552083Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"zcr10.shape","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:01.732477Z","iopub.execute_input":"2024-01-10T19:04:01.734535Z","iopub.status.idle":"2024-01-10T19:04:01.742507Z","shell.execute_reply.started":"2024-01-10T19:04:01.734463Z","shell.execute_reply":"2024-01-10T19:04:01.741283Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#energy for rudduc:\nen1=librosa.feature.rms(y=y1)\nprint(en1)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:02.436358Z","iopub.execute_input":"2024-01-10T19:04:02.436897Z","iopub.status.idle":"2024-01-10T19:04:02.737618Z","shell.execute_reply.started":"2024-01-10T19:04:02.436864Z","shell.execute_reply":"2024-01-10T19:04:02.735711Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"en1.shape","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:03.501457Z","iopub.execute_input":"2024-01-10T19:04:03.501854Z","iopub.status.idle":"2024-01-10T19:04:03.510309Z","shell.execute_reply.started":"2024-01-10T19:04:03.501824Z","shell.execute_reply":"2024-01-10T19:04:03.508659Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"en2=librosa.feature.rms(y=y2)\nprint(en2)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:04.550353Z","iopub.execute_input":"2024-01-10T19:04:04.550737Z","iopub.status.idle":"2024-01-10T19:04:04.597156Z","shell.execute_reply.started":"2024-01-10T19:04:04.550708Z","shell.execute_reply":"2024-01-10T19:04:04.596436Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"en2.shape","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:05.736311Z","iopub.execute_input":"2024-01-10T19:04:05.736909Z","iopub.status.idle":"2024-01-10T19:04:05.743691Z","shell.execute_reply.started":"2024-01-10T19:04:05.736878Z","shell.execute_reply":"2024-01-10T19:04:05.742101Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#energy for amebit:\nen3=librosa.feature.rms(y=y3)\nprint(en3)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:06.443141Z","iopub.execute_input":"2024-01-10T19:04:06.443603Z","iopub.status.idle":"2024-01-10T19:04:06.463088Z","shell.execute_reply.started":"2024-01-10T19:04:06.443574Z","shell.execute_reply":"2024-01-10T19:04:06.462062Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"en3.shape","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:07.515078Z","iopub.execute_input":"2024-01-10T19:04:07.515583Z","iopub.status.idle":"2024-01-10T19:04:07.525383Z","shell.execute_reply.started":"2024-01-10T19:04:07.515548Z","shell.execute_reply":"2024-01-10T19:04:07.523427Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"en4=librosa.feature.rms(y=y4)\nprint(en4)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:08.726768Z","iopub.execute_input":"2024-01-10T19:04:08.728385Z","iopub.status.idle":"2024-01-10T19:04:08.787284Z","shell.execute_reply.started":"2024-01-10T19:04:08.728335Z","shell.execute_reply":"2024-01-10T19:04:08.785283Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"en4.shape","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:09.681112Z","iopub.execute_input":"2024-01-10T19:04:09.681608Z","iopub.status.idle":"2024-01-10T19:04:09.691122Z","shell.execute_reply.started":"2024-01-10T19:04:09.681572Z","shell.execute_reply":"2024-01-10T19:04:09.689084Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#energy for comnig:\nen5=librosa.feature.rms(y=y5)\nprint(en5)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:10.407342Z","iopub.execute_input":"2024-01-10T19:04:10.407843Z","iopub.status.idle":"2024-01-10T19:04:10.818874Z","shell.execute_reply.started":"2024-01-10T19:04:10.407801Z","shell.execute_reply":"2024-01-10T19:04:10.817786Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"en5.shape","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:11.382175Z","iopub.execute_input":"2024-01-10T19:04:11.382571Z","iopub.status.idle":"2024-01-10T19:04:11.389608Z","shell.execute_reply.started":"2024-01-10T19:04:11.382540Z","shell.execute_reply":"2024-01-10T19:04:11.388449Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"en6=librosa.feature.rms(y=y6)\nprint(en6)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:12.436942Z","iopub.execute_input":"2024-01-10T19:04:12.437545Z","iopub.status.idle":"2024-01-10T19:04:12.526438Z","shell.execute_reply.started":"2024-01-10T19:04:12.437506Z","shell.execute_reply":"2024-01-10T19:04:12.525378Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"en6.shape","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:13.228938Z","iopub.execute_input":"2024-01-10T19:04:13.229351Z","iopub.status.idle":"2024-01-10T19:04:13.239353Z","shell.execute_reply.started":"2024-01-10T19:04:13.229320Z","shell.execute_reply":"2024-01-10T19:04:13.238050Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#energy for daejun:\nen7=librosa.feature.rms(y=y7)\nprint(en7)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:14.279060Z","iopub.execute_input":"2024-01-10T19:04:14.279466Z","iopub.status.idle":"2024-01-10T19:04:14.318860Z","shell.execute_reply.started":"2024-01-10T19:04:14.279434Z","shell.execute_reply":"2024-01-10T19:04:14.317833Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"en7.shape","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:15.275620Z","iopub.execute_input":"2024-01-10T19:04:15.276055Z","iopub.status.idle":"2024-01-10T19:04:15.283355Z","shell.execute_reply.started":"2024-01-10T19:04:15.276021Z","shell.execute_reply":"2024-01-10T19:04:15.282296Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"en8=librosa.feature.rms(y=y8)\nprint(en8)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:15.983987Z","iopub.execute_input":"2024-01-10T19:04:15.984394Z","iopub.status.idle":"2024-01-10T19:04:16.124292Z","shell.execute_reply.started":"2024-01-10T19:04:15.984362Z","shell.execute_reply":"2024-01-10T19:04:16.122601Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"en8.shape","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:17.014234Z","iopub.execute_input":"2024-01-10T19:04:17.014745Z","iopub.status.idle":"2024-01-10T19:04:17.025035Z","shell.execute_reply.started":"2024-01-10T19:04:17.014702Z","shell.execute_reply":"2024-01-10T19:04:17.023425Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#energy for canwre:\nen9=librosa.feature.rms(y=y9)\nprint(en9)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:17.720573Z","iopub.execute_input":"2024-01-10T19:04:17.721258Z","iopub.status.idle":"2024-01-10T19:04:17.753210Z","shell.execute_reply.started":"2024-01-10T19:04:17.721225Z","shell.execute_reply":"2024-01-10T19:04:17.752030Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"en9.shape","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:18.678441Z","iopub.execute_input":"2024-01-10T19:04:18.678977Z","iopub.status.idle":"2024-01-10T19:04:18.688445Z","shell.execute_reply.started":"2024-01-10T19:04:18.678919Z","shell.execute_reply":"2024-01-10T19:04:18.687017Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"en10=librosa.feature.rms(y=y10)\nprint(en10)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:19.322820Z","iopub.execute_input":"2024-01-10T19:04:19.323830Z","iopub.status.idle":"2024-01-10T19:04:19.533239Z","shell.execute_reply.started":"2024-01-10T19:04:19.323745Z","shell.execute_reply":"2024-01-10T19:04:19.531617Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"en10.shape","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:20.161403Z","iopub.execute_input":"2024-01-10T19:04:20.161885Z","iopub.status.idle":"2024-01-10T19:04:20.170646Z","shell.execute_reply.started":"2024-01-10T19:04:20.161849Z","shell.execute_reply":"2024-01-10T19:04:20.169197Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#spectral roll-off for rudduc:\n#the variation that we are obseving in the given arrays of spectral rolloff can be well understood by the spectrogram of that audio!!\nS1, phase1 = librosa.magphase(librosa.stft(y1))\nrolloff1 = librosa.feature.spectral_rolloff(S=S1, sr=sr1, roll_percent=0.90)\nprint(rolloff1)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:21.152941Z","iopub.execute_input":"2024-01-10T19:04:21.153364Z","iopub.status.idle":"2024-01-10T19:04:21.502820Z","shell.execute_reply.started":"2024-01-10T19:04:21.153333Z","shell.execute_reply":"2024-01-10T19:04:21.501850Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"rolloff1.shape","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:21.855950Z","iopub.execute_input":"2024-01-10T19:04:21.856843Z","iopub.status.idle":"2024-01-10T19:04:21.864513Z","shell.execute_reply.started":"2024-01-10T19:04:21.856782Z","shell.execute_reply":"2024-01-10T19:04:21.863241Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"S2, phase2 = librosa.magphase(librosa.stft(y2))\nrolloff2 = librosa.feature.spectral_rolloff(S=S2, sr=sr2, roll_percent=0.90)\nprint(rolloff2)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:22.799221Z","iopub.execute_input":"2024-01-10T19:04:22.799684Z","iopub.status.idle":"2024-01-10T19:04:22.872693Z","shell.execute_reply.started":"2024-01-10T19:04:22.799656Z","shell.execute_reply":"2024-01-10T19:04:22.871596Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"rolloff2.shape","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:23.799985Z","iopub.execute_input":"2024-01-10T19:04:23.800414Z","iopub.status.idle":"2024-01-10T19:04:23.811321Z","shell.execute_reply.started":"2024-01-10T19:04:23.800384Z","shell.execute_reply":"2024-01-10T19:04:23.809860Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#spectral roll-off for amebit:\nS3, phase3 = librosa.magphase(librosa.stft(y3))\nrolloff3 = librosa.feature.spectral_rolloff(S=S3, sr=sr3, roll_percent=0.90)\nprint(rolloff3)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:24.408057Z","iopub.execute_input":"2024-01-10T19:04:24.408450Z","iopub.status.idle":"2024-01-10T19:04:24.429676Z","shell.execute_reply.started":"2024-01-10T19:04:24.408418Z","shell.execute_reply":"2024-01-10T19:04:24.428028Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"rolloff3.shape","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:25.356894Z","iopub.execute_input":"2024-01-10T19:04:25.357448Z","iopub.status.idle":"2024-01-10T19:04:25.365710Z","shell.execute_reply.started":"2024-01-10T19:04:25.357413Z","shell.execute_reply":"2024-01-10T19:04:25.364222Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"S4, phase4 = librosa.magphase(librosa.stft(y4))\nrolloff4 = librosa.feature.spectral_rolloff(S=S4, sr=sr4, roll_percent=0.90)\nprint(rolloff4)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:26.208799Z","iopub.execute_input":"2024-01-10T19:04:26.209254Z","iopub.status.idle":"2024-01-10T19:04:26.291677Z","shell.execute_reply.started":"2024-01-10T19:04:26.209226Z","shell.execute_reply":"2024-01-10T19:04:26.290090Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"rolloff4.shape","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:27.115304Z","iopub.execute_input":"2024-01-10T19:04:27.115789Z","iopub.status.idle":"2024-01-10T19:04:27.125567Z","shell.execute_reply.started":"2024-01-10T19:04:27.115754Z","shell.execute_reply":"2024-01-10T19:04:27.124187Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#spectral roll-off for comnig:\nS5, phase5 = librosa.magphase(librosa.stft(y5))\nrolloff5 = librosa.feature.spectral_rolloff(S=S5, sr=sr5, roll_percent=0.90)\nprint(rolloff5)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:27.896731Z","iopub.execute_input":"2024-01-10T19:04:27.897139Z","iopub.status.idle":"2024-01-10T19:04:28.464419Z","shell.execute_reply.started":"2024-01-10T19:04:27.897110Z","shell.execute_reply":"2024-01-10T19:04:28.462122Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"rolloff5.shape","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:28.839346Z","iopub.execute_input":"2024-01-10T19:04:28.840408Z","iopub.status.idle":"2024-01-10T19:04:28.848732Z","shell.execute_reply.started":"2024-01-10T19:04:28.840353Z","shell.execute_reply":"2024-01-10T19:04:28.847468Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"S6, phase6 = librosa.magphase(librosa.stft(y6))\nrolloff6 = librosa.feature.spectral_rolloff(S=S6, sr=sr6, roll_percent=0.90)\nprint(rolloff6)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:29.482953Z","iopub.execute_input":"2024-01-10T19:04:29.483771Z","iopub.status.idle":"2024-01-10T19:04:29.605766Z","shell.execute_reply.started":"2024-01-10T19:04:29.483732Z","shell.execute_reply":"2024-01-10T19:04:29.604573Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"rolloff6.shape","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:30.155599Z","iopub.execute_input":"2024-01-10T19:04:30.156436Z","iopub.status.idle":"2024-01-10T19:04:30.162630Z","shell.execute_reply.started":"2024-01-10T19:04:30.156403Z","shell.execute_reply":"2024-01-10T19:04:30.161766Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#spectral roll-off for daejun:\nS7, phase7 = librosa.magphase(librosa.stft(y7))\nrolloff7 = librosa.feature.spectral_rolloff(S=S7, sr=sr7, roll_percent=0.90)\nprint(rolloff7)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:30.819353Z","iopub.execute_input":"2024-01-10T19:04:30.820507Z","iopub.status.idle":"2024-01-10T19:04:30.873673Z","shell.execute_reply.started":"2024-01-10T19:04:30.820462Z","shell.execute_reply":"2024-01-10T19:04:30.872679Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"rolloff7.shape","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:31.800393Z","iopub.execute_input":"2024-01-10T19:04:31.800924Z","iopub.status.idle":"2024-01-10T19:04:31.810766Z","shell.execute_reply.started":"2024-01-10T19:04:31.800884Z","shell.execute_reply":"2024-01-10T19:04:31.809282Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"S8, phase8 = librosa.magphase(librosa.stft(y8))\nrolloff8 = librosa.feature.spectral_rolloff(S=S8, sr=sr8, roll_percent=0.90)\nprint(rolloff8)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:32.269559Z","iopub.execute_input":"2024-01-10T19:04:32.270058Z","iopub.status.idle":"2024-01-10T19:04:32.491118Z","shell.execute_reply.started":"2024-01-10T19:04:32.270023Z","shell.execute_reply":"2024-01-10T19:04:32.489560Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"rolloff8.shape","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:33.026851Z","iopub.execute_input":"2024-01-10T19:04:33.029436Z","iopub.status.idle":"2024-01-10T19:04:33.038653Z","shell.execute_reply.started":"2024-01-10T19:04:33.029357Z","shell.execute_reply":"2024-01-10T19:04:33.037043Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#spectral roll-off for canwre:\nS9, phase9 = librosa.magphase(librosa.stft(y9))\nrolloff9 = librosa.feature.spectral_rolloff(S=S9, sr=sr9, roll_percent=0.90)\nprint(rolloff9)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:33.734811Z","iopub.execute_input":"2024-01-10T19:04:33.735354Z","iopub.status.idle":"2024-01-10T19:04:33.778990Z","shell.execute_reply.started":"2024-01-10T19:04:33.735318Z","shell.execute_reply":"2024-01-10T19:04:33.778046Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"rolloff9.shape","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:34.681175Z","iopub.execute_input":"2024-01-10T19:04:34.681606Z","iopub.status.idle":"2024-01-10T19:04:34.687752Z","shell.execute_reply.started":"2024-01-10T19:04:34.681571Z","shell.execute_reply":"2024-01-10T19:04:34.687031Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"S10, phase10 = librosa.magphase(librosa.stft(y10))\nrolloff10 = librosa.feature.spectral_rolloff(S=S10, sr=sr10, roll_percent=0.90)\nprint(rolloff10)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:35.594477Z","iopub.execute_input":"2024-01-10T19:04:35.595066Z","iopub.status.idle":"2024-01-10T19:04:35.892876Z","shell.execute_reply.started":"2024-01-10T19:04:35.595026Z","shell.execute_reply":"2024-01-10T19:04:35.891331Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"rolloff10.shape","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:36.392114Z","iopub.execute_input":"2024-01-10T19:04:36.392519Z","iopub.status.idle":"2024-01-10T19:04:36.401989Z","shell.execute_reply.started":"2024-01-10T19:04:36.392486Z","shell.execute_reply":"2024-01-10T19:04:36.400527Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#spectral flux for rudduc:\nonset_env1 = librosa.onset.onset_strength(y=y1, sr=sr1)\nprint(onset_env1)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:37.185362Z","iopub.execute_input":"2024-01-10T19:04:37.185700Z","iopub.status.idle":"2024-01-10T19:04:37.425529Z","shell.execute_reply.started":"2024-01-10T19:04:37.185673Z","shell.execute_reply":"2024-01-10T19:04:37.424789Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"onset_env2 = librosa.onset.onset_strength(y=y2, sr=sr2)\nprint(onset_env2)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:38.064288Z","iopub.execute_input":"2024-01-10T19:04:38.065278Z","iopub.status.idle":"2024-01-10T19:04:38.117349Z","shell.execute_reply.started":"2024-01-10T19:04:38.065243Z","shell.execute_reply":"2024-01-10T19:04:38.116364Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#spectral flux for amebit:\nonset_env3 = librosa.onset.onset_strength(y=y3, sr=sr3)\nprint(onset_env3)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:39.101635Z","iopub.execute_input":"2024-01-10T19:04:39.103414Z","iopub.status.idle":"2024-01-10T19:04:39.124222Z","shell.execute_reply.started":"2024-01-10T19:04:39.103342Z","shell.execute_reply":"2024-01-10T19:04:39.123196Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"onset_env4 = librosa.onset.onset_strength(y=y4, sr=sr4)\nprint(onset_env4)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:40.461403Z","iopub.execute_input":"2024-01-10T19:04:40.461923Z","iopub.status.idle":"2024-01-10T19:04:40.519532Z","shell.execute_reply.started":"2024-01-10T19:04:40.461888Z","shell.execute_reply":"2024-01-10T19:04:40.518038Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#spectral flux for comnig:\nonset_env5 = librosa.onset.onset_strength(y=y5, sr=sr5)\nprint(onset_env5)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:41.146364Z","iopub.execute_input":"2024-01-10T19:04:41.146847Z","iopub.status.idle":"2024-01-10T19:04:41.540276Z","shell.execute_reply.started":"2024-01-10T19:04:41.146810Z","shell.execute_reply":"2024-01-10T19:04:41.539392Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"onset_env6 = librosa.onset.onset_strength(y=y6, sr=sr6)\nprint(onset_env6)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:42.028442Z","iopub.execute_input":"2024-01-10T19:04:42.029348Z","iopub.status.idle":"2024-01-10T19:04:42.110021Z","shell.execute_reply.started":"2024-01-10T19:04:42.029306Z","shell.execute_reply":"2024-01-10T19:04:42.109108Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#spectral flux for daejun:\nonset_env7 = librosa.onset.onset_strength(y=y7, sr=sr7)\nprint(onset_env7)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:42.781395Z","iopub.execute_input":"2024-01-10T19:04:42.781747Z","iopub.status.idle":"2024-01-10T19:04:42.821054Z","shell.execute_reply.started":"2024-01-10T19:04:42.781720Z","shell.execute_reply":"2024-01-10T19:04:42.820199Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"onset_env8 = librosa.onset.onset_strength(y=y8, sr=sr8)\nprint(onset_env8)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:43.816894Z","iopub.execute_input":"2024-01-10T19:04:43.817303Z","iopub.status.idle":"2024-01-10T19:04:43.956556Z","shell.execute_reply.started":"2024-01-10T19:04:43.817264Z","shell.execute_reply":"2024-01-10T19:04:43.955609Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#spectral flux for canwre:\nonset_env9 = librosa.onset.onset_strength(y=y9, sr=sr9)\nprint(onset_env9)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:44.894700Z","iopub.execute_input":"2024-01-10T19:04:44.895118Z","iopub.status.idle":"2024-01-10T19:04:44.935435Z","shell.execute_reply.started":"2024-01-10T19:04:44.895087Z","shell.execute_reply":"2024-01-10T19:04:44.934134Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"onset_env10 = librosa.onset.onset_strength(y=y10, sr=sr10)\nprint(onset_env10)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:45.444404Z","iopub.execute_input":"2024-01-10T19:04:45.444758Z","iopub.status.idle":"2024-01-10T19:04:45.631496Z","shell.execute_reply.started":"2024-01-10T19:04:45.444734Z","shell.execute_reply":"2024-01-10T19:04:45.630340Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#pitch for rudduc:\npitch1, magnitude1 = librosa.piptrack(y=y1, sr=sr1)\nprint(pitch1)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:46.203399Z","iopub.execute_input":"2024-01-10T19:04:46.203845Z","iopub.status.idle":"2024-01-10T19:04:46.756907Z","shell.execute_reply.started":"2024-01-10T19:04:46.203816Z","shell.execute_reply":"2024-01-10T19:04:46.754748Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pitch1.shape","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:47.190908Z","iopub.execute_input":"2024-01-10T19:04:47.192146Z","iopub.status.idle":"2024-01-10T19:04:47.200105Z","shell.execute_reply.started":"2024-01-10T19:04:47.192089Z","shell.execute_reply":"2024-01-10T19:04:47.198893Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#counting for how many times spectral peaks become significant!!\n#also, finding their location may help in pitch tracking of particular audio!!\n#here,i represents frequency bin and j represents time frame!!\npitchcount=0\nfor i in range(0,1025):\n  for j in range(0,17):\n    if pitch1[i][j]!=0:\n      print(i,j)  #revealing locations where we have nonzero pitch values!!\n      print()\n      pitchcount+=1\nprint(pitchcount)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:48.147625Z","iopub.execute_input":"2024-01-10T19:04:48.148027Z","iopub.status.idle":"2024-01-10T19:04:48.200499Z","shell.execute_reply.started":"2024-01-10T19:04:48.147994Z","shell.execute_reply":"2024-01-10T19:04:48.198879Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pitch2, magnitude2 = librosa.piptrack(y=y2, sr=sr2)\nprint(pitch2)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:48.768091Z","iopub.execute_input":"2024-01-10T19:04:48.768440Z","iopub.status.idle":"2024-01-10T19:04:48.836053Z","shell.execute_reply.started":"2024-01-10T19:04:48.768413Z","shell.execute_reply":"2024-01-10T19:04:48.835050Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pitch2.shape","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:49.501650Z","iopub.execute_input":"2024-01-10T19:04:49.502185Z","iopub.status.idle":"2024-01-10T19:04:49.514699Z","shell.execute_reply.started":"2024-01-10T19:04:49.502147Z","shell.execute_reply":"2024-01-10T19:04:49.513146Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pitchcount=0\nfor i in range(0,1025):\n  for j in range(0,22):\n    if pitch2[i][j]!=0:\n      print(i,j)\n      print()\n      pitchcount+=1\nprint(pitchcount)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:50.507905Z","iopub.execute_input":"2024-01-10T19:04:50.508512Z","iopub.status.idle":"2024-01-10T19:04:50.558417Z","shell.execute_reply.started":"2024-01-10T19:04:50.508479Z","shell.execute_reply":"2024-01-10T19:04:50.556566Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#pitch for amebit:\npitch3, magnitude3 = librosa.piptrack(y=y3, sr=sr3)\nprint(pitch3)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:51.244754Z","iopub.execute_input":"2024-01-10T19:04:51.246272Z","iopub.status.idle":"2024-01-10T19:04:51.266846Z","shell.execute_reply.started":"2024-01-10T19:04:51.246222Z","shell.execute_reply":"2024-01-10T19:04:51.265779Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pitch3.shape","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:52.058708Z","iopub.execute_input":"2024-01-10T19:04:52.059462Z","iopub.status.idle":"2024-01-10T19:04:52.065682Z","shell.execute_reply.started":"2024-01-10T19:04:52.059425Z","shell.execute_reply":"2024-01-10T19:04:52.064615Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pitchcount=0\nfor i in range(0,1025):\n  for j in range(0,22):\n    if pitch3[i][j]!=0:\n      print(i,j)\n      print()\n      pitchcount+=1\nprint(pitchcount)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:52.979574Z","iopub.execute_input":"2024-01-10T19:04:52.980081Z","iopub.status.idle":"2024-01-10T19:04:53.057084Z","shell.execute_reply.started":"2024-01-10T19:04:52.980050Z","shell.execute_reply":"2024-01-10T19:04:53.055427Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pitch4, magnitude4 = librosa.piptrack(y=y4, sr=sr4)\nprint(pitch4)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:53.608210Z","iopub.execute_input":"2024-01-10T19:04:53.608714Z","iopub.status.idle":"2024-01-10T19:04:53.710392Z","shell.execute_reply.started":"2024-01-10T19:04:53.608675Z","shell.execute_reply":"2024-01-10T19:04:53.708824Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pitch4.shape","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:54.361413Z","iopub.execute_input":"2024-01-10T19:04:54.361777Z","iopub.status.idle":"2024-01-10T19:04:54.370999Z","shell.execute_reply.started":"2024-01-10T19:04:54.361749Z","shell.execute_reply":"2024-01-10T19:04:54.369751Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pitchcount=0\nfor i in range(0,1025):\n  for j in range(0,22):\n    if pitch4[i][j]!=0:\n      print(i,j)\n      print()\n      pitchcount+=1\nprint(pitchcount)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:55.073707Z","iopub.execute_input":"2024-01-10T19:04:55.074180Z","iopub.status.idle":"2024-01-10T19:04:55.131951Z","shell.execute_reply.started":"2024-01-10T19:04:55.074146Z","shell.execute_reply":"2024-01-10T19:04:55.130178Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#pitch for comnig:\npitch5, magnitude5 = librosa.piptrack(y=y5, sr=sr5)\nprint(pitch5)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:57.055454Z","iopub.execute_input":"2024-01-10T19:04:57.056907Z","iopub.status.idle":"2024-01-10T19:04:57.832453Z","shell.execute_reply.started":"2024-01-10T19:04:57.056805Z","shell.execute_reply":"2024-01-10T19:04:57.830890Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pitch5.shape","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:57.835235Z","iopub.execute_input":"2024-01-10T19:04:57.835544Z","iopub.status.idle":"2024-01-10T19:04:57.842623Z","shell.execute_reply.started":"2024-01-10T19:04:57.835520Z","shell.execute_reply":"2024-01-10T19:04:57.841413Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pitchcount=0\nfor i in range(0,1025):\n  for j in range(0,22):\n    if pitch5[i][j]!=0:\n      print(i,j)\n      print()\n      pitchcount+=1\nprint(pitchcount)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:04:58.748600Z","iopub.execute_input":"2024-01-10T19:04:58.749106Z","iopub.status.idle":"2024-01-10T19:04:58.814145Z","shell.execute_reply.started":"2024-01-10T19:04:58.749070Z","shell.execute_reply":"2024-01-10T19:04:58.812947Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pitch6, magnitude6 = librosa.piptrack(y=y6, sr=sr6)\nprint(pitch6)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:05:00.026119Z","iopub.execute_input":"2024-01-10T19:05:00.026644Z","iopub.status.idle":"2024-01-10T19:05:00.194983Z","shell.execute_reply.started":"2024-01-10T19:05:00.026606Z","shell.execute_reply":"2024-01-10T19:05:00.193923Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pitch6.shape","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:05:00.781222Z","iopub.execute_input":"2024-01-10T19:05:00.782008Z","iopub.status.idle":"2024-01-10T19:05:00.790295Z","shell.execute_reply.started":"2024-01-10T19:05:00.781973Z","shell.execute_reply":"2024-01-10T19:05:00.788032Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pitchcount=0\nfor i in range(0,1025):\n  for j in range(0,22):\n    if pitch6[i][j]!=0:\n      print(i,j)\n      print()\n      pitchcount+=1\nprint(pitchcount)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:05:01.487572Z","iopub.execute_input":"2024-01-10T19:05:01.491548Z","iopub.status.idle":"2024-01-10T19:05:01.647241Z","shell.execute_reply.started":"2024-01-10T19:05:01.491438Z","shell.execute_reply":"2024-01-10T19:05:01.645414Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#pitch for daejun:\npitch7, magnitude7 = librosa.piptrack(y=y7, sr=sr7)\nprint(pitch7)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:05:02.592051Z","iopub.execute_input":"2024-01-10T19:05:02.592443Z","iopub.status.idle":"2024-01-10T19:05:02.685501Z","shell.execute_reply.started":"2024-01-10T19:05:02.592412Z","shell.execute_reply":"2024-01-10T19:05:02.680598Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pitch7.shape","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:05:03.301193Z","iopub.execute_input":"2024-01-10T19:05:03.301760Z","iopub.status.idle":"2024-01-10T19:05:03.308207Z","shell.execute_reply.started":"2024-01-10T19:05:03.301718Z","shell.execute_reply":"2024-01-10T19:05:03.307460Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pitchcount=0\nfor i in range(0,1025):\n  for j in range(0,22):\n    if pitch7[i][j]!=0:\n      print(i,j)\n      print()\n      pitchcount+=1\nprint(pitchcount)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:05:03.966372Z","iopub.execute_input":"2024-01-10T19:05:03.967060Z","iopub.status.idle":"2024-01-10T19:05:04.030064Z","shell.execute_reply.started":"2024-01-10T19:05:03.967026Z","shell.execute_reply":"2024-01-10T19:05:04.028584Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pitch8, magnitude8 = librosa.piptrack(y=y8, sr=sr8)\nprint(pitch8)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:05:04.926954Z","iopub.execute_input":"2024-01-10T19:05:04.928397Z","iopub.status.idle":"2024-01-10T19:05:05.342735Z","shell.execute_reply.started":"2024-01-10T19:05:04.928325Z","shell.execute_reply":"2024-01-10T19:05:05.341534Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pitch8.shape","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:05:05.665513Z","iopub.execute_input":"2024-01-10T19:05:05.665991Z","iopub.status.idle":"2024-01-10T19:05:05.674238Z","shell.execute_reply.started":"2024-01-10T19:05:05.665933Z","shell.execute_reply":"2024-01-10T19:05:05.673076Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pitchcount=0\nfor i in range(0,1025):\n  for j in range(0,22):\n    if pitch8[i][j]!=0:\n      print(i,j)\n      print()\n      pitchcount+=1\nprint(pitchcount)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:05:06.424839Z","iopub.execute_input":"2024-01-10T19:05:06.425269Z","iopub.status.idle":"2024-01-10T19:05:06.488398Z","shell.execute_reply.started":"2024-01-10T19:05:06.425238Z","shell.execute_reply":"2024-01-10T19:05:06.487204Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#pitch for canwre:\npitch9, magnitude9 = librosa.piptrack(y=y9, sr=sr9)\nprint(pitch9)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:05:07.192487Z","iopub.execute_input":"2024-01-10T19:05:07.192911Z","iopub.status.idle":"2024-01-10T19:05:07.241624Z","shell.execute_reply.started":"2024-01-10T19:05:07.192881Z","shell.execute_reply":"2024-01-10T19:05:07.240297Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pitch9.shape","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:05:07.831492Z","iopub.execute_input":"2024-01-10T19:05:07.831903Z","iopub.status.idle":"2024-01-10T19:05:07.840694Z","shell.execute_reply.started":"2024-01-10T19:05:07.831871Z","shell.execute_reply":"2024-01-10T19:05:07.838297Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pitchcount=0\nfor i in range(0,1025):\n  for j in range(0,22):\n    if pitch9[i][j]!=0:\n      print(i,j)\n      print()\n      pitchcount+=1\nprint(pitchcount)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:05:08.578032Z","iopub.execute_input":"2024-01-10T19:05:08.580206Z","iopub.status.idle":"2024-01-10T19:05:08.719060Z","shell.execute_reply.started":"2024-01-10T19:05:08.580132Z","shell.execute_reply":"2024-01-10T19:05:08.717976Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pitch10, magnitude10 = librosa.piptrack(y=y10, sr=sr10)\nprint(pitch10)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:05:09.442610Z","iopub.execute_input":"2024-01-10T19:05:09.443065Z","iopub.status.idle":"2024-01-10T19:05:09.818481Z","shell.execute_reply.started":"2024-01-10T19:05:09.443032Z","shell.execute_reply":"2024-01-10T19:05:09.817660Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pitch10.shape","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:05:10.289539Z","iopub.execute_input":"2024-01-10T19:05:10.291599Z","iopub.status.idle":"2024-01-10T19:05:10.303985Z","shell.execute_reply.started":"2024-01-10T19:05:10.291527Z","shell.execute_reply":"2024-01-10T19:05:10.301612Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pitchcount=0\nfor i in range(0,1025):\n  for j in range(0,22):\n    if pitch10[i][j]!=0:\n      print(i,j)\n      print()\n      pitchcount+=1\nprint(pitchcount)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:05:17.717629Z","iopub.execute_input":"2024-01-10T19:05:17.718767Z","iopub.status.idle":"2024-01-10T19:05:17.804183Z","shell.execute_reply.started":"2024-01-10T19:05:17.718723Z","shell.execute_reply":"2024-01-10T19:05:17.802505Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"db1 = librosa.amplitude_to_db(np.abs(librosa.stft(y1)), ref=np.max)\n\n# Plotting the spectrogram for rudduc:\nplt.figure(figsize=(15, 15))\nlibrosa.display.specshow(db1,sr=sr1, x_axis='time', y_axis='log')\nplt.colorbar(format='%+2.0f dB')\nplt.title('Spectrogram of the Audio Signal1 for rudduc')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:05:18.428585Z","iopub.execute_input":"2024-01-10T19:05:18.429611Z","iopub.status.idle":"2024-01-10T19:05:24.670357Z","shell.execute_reply.started":"2024-01-10T19:05:18.429577Z","shell.execute_reply":"2024-01-10T19:05:24.669473Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"db2 = librosa.amplitude_to_db(np.abs(librosa.stft(y2)), ref=np.max)\nplt.figure(figsize=(15, 15))\nlibrosa.display.specshow(db2,sr=sr2, x_axis='time', y_axis='log')\nplt.colorbar(format='%+2.0f dB')\nplt.title('Spectrogram of the Audio Signal2 for rudduc')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:05:24.672004Z","iopub.execute_input":"2024-01-10T19:05:24.672506Z","iopub.status.idle":"2024-01-10T19:05:26.182990Z","shell.execute_reply.started":"2024-01-10T19:05:24.672480Z","shell.execute_reply":"2024-01-10T19:05:26.182110Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"db3 = librosa.amplitude_to_db(np.abs(librosa.stft(y3)), ref=np.max)\n# Plotting the spectrogram for amebit:\nplt.figure(figsize=(15, 15))\nlibrosa.display.specshow(db3,sr=sr3, x_axis='time', y_axis='log')\nplt.colorbar(format='%+2.0f dB')\nplt.title('Spectrogram of the Audio Signal1 for amebit')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:05:26.183992Z","iopub.execute_input":"2024-01-10T19:05:26.184899Z","iopub.status.idle":"2024-01-10T19:05:26.831121Z","shell.execute_reply.started":"2024-01-10T19:05:26.184872Z","shell.execute_reply":"2024-01-10T19:05:26.830035Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"db4 = librosa.amplitude_to_db(np.abs(librosa.stft(y4)), ref=np.max)\nplt.figure(figsize=(15, 15))\nlibrosa.display.specshow(db4,sr=sr4, x_axis='time', y_axis='log')\nplt.colorbar(format='%+2.0f dB')\nplt.title('Spectrogram of the Audio Signal2 for amebit')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:05:33.571324Z","iopub.execute_input":"2024-01-10T19:05:33.571839Z","iopub.status.idle":"2024-01-10T19:05:35.356443Z","shell.execute_reply.started":"2024-01-10T19:05:33.571800Z","shell.execute_reply":"2024-01-10T19:05:35.354917Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"db5 = librosa.amplitude_to_db(np.abs(librosa.stft(y5)), ref=np.max)\n# Plotting the spectrogram for comnig:\nplt.figure(figsize=(15, 15))\nlibrosa.display.specshow(db5,sr=sr5, x_axis='time', y_axis='log')\nplt.colorbar(format='%+2.0f dB')\nplt.title('Spectrogram of the Audio Signal1 for comnig')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:05:35.359138Z","iopub.execute_input":"2024-01-10T19:05:35.359663Z","iopub.status.idle":"2024-01-10T19:05:44.907341Z","shell.execute_reply.started":"2024-01-10T19:05:35.359618Z","shell.execute_reply":"2024-01-10T19:05:44.906212Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"db6 = librosa.amplitude_to_db(np.abs(librosa.stft(y6)), ref=np.max)\nplt.figure(figsize=(15, 15))\nlibrosa.display.specshow(db6,sr=sr6, x_axis='time', y_axis='log')\nplt.colorbar(format='%+2.0f dB')\nplt.title('Spectrogram of the Audio Signal2 for comnig')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:05:44.909284Z","iopub.execute_input":"2024-01-10T19:05:44.909659Z","iopub.status.idle":"2024-01-10T19:05:47.462809Z","shell.execute_reply.started":"2024-01-10T19:05:44.909629Z","shell.execute_reply":"2024-01-10T19:05:47.461790Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"db7 = librosa.amplitude_to_db(np.abs(librosa.stft(y7)), ref=np.max)\n# Plotting the spectrogram for daejun:\nplt.figure(figsize=(15, 15))\nlibrosa.display.specshow(db7,sr=sr7, x_axis='time', y_axis='log')\nplt.colorbar(format='%+2.0f dB')\nplt.title('Spectrogram of the Audio Signal1 for daejun')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:05:47.464051Z","iopub.execute_input":"2024-01-10T19:05:47.464331Z","iopub.status.idle":"2024-01-10T19:05:48.711470Z","shell.execute_reply.started":"2024-01-10T19:05:47.464307Z","shell.execute_reply":"2024-01-10T19:05:48.710737Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"db8 = librosa.amplitude_to_db(np.abs(librosa.stft(y8)), ref=np.max)\nplt.figure(figsize=(15, 15))\nlibrosa.display.specshow(db8,sr=sr8, x_axis='time', y_axis='log')\nplt.colorbar(format='%+2.0f dB')\nplt.title('Spectrogram of the Audio Signal2 for daejun')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:05:48.713140Z","iopub.execute_input":"2024-01-10T19:05:48.713554Z","iopub.status.idle":"2024-01-10T19:05:52.392894Z","shell.execute_reply.started":"2024-01-10T19:05:48.713527Z","shell.execute_reply":"2024-01-10T19:05:52.391656Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"db9 = librosa.amplitude_to_db(np.abs(librosa.stft(y9)), ref=np.max)\n# Plotting the spectrogram for canwre:\nplt.figure(figsize=(15, 15))\nlibrosa.display.specshow(db9,sr=sr9, x_axis='time', y_axis='log')\nplt.colorbar(format='%+2.0f dB')\nplt.title('Spectrogram of the Audio Signal1 for canwre')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:05:52.394461Z","iopub.execute_input":"2024-01-10T19:05:52.395123Z","iopub.status.idle":"2024-01-10T19:05:53.398495Z","shell.execute_reply.started":"2024-01-10T19:05:52.395085Z","shell.execute_reply":"2024-01-10T19:05:53.397312Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"db10 = librosa.amplitude_to_db(np.abs(librosa.stft(y10)), ref=np.max)\nplt.figure(figsize=(15, 15))\nlibrosa.display.specshow(db10,sr=sr10, x_axis='time', y_axis='log')\nplt.colorbar(format='%+2.0f dB')\nplt.title('Spectrogram of the Audio Signal2 for canwre')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:05:53.399746Z","iopub.execute_input":"2024-01-10T19:05:53.400077Z","iopub.status.idle":"2024-01-10T19:05:58.307511Z","shell.execute_reply.started":"2024-01-10T19:05:53.400050Z","shell.execute_reply":"2024-01-10T19:05:58.306066Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Calculation of Band Energy Ratio:\ndef splitfreqbin(spectrogram,sample_rate,split_frequency):\n  freq_range=sample_rate/2\n  freq_delta_perbin=freq_range/spectrogram.shape[0]\n  split_freq_bin=np.floor(split_frequency/freq_delta_perbin)\n  return int(split_freq_bin)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:05:58.308943Z","iopub.execute_input":"2024-01-10T19:05:58.309713Z","iopub.status.idle":"2024-01-10T19:05:58.316729Z","shell.execute_reply.started":"2024-01-10T19:05:58.309655Z","shell.execute_reply":"2024-01-10T19:05:58.315304Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def bandenergyratio(spectrogram,sample_rate,split_frequency):\n  split_frequency_bin=splitfreqbin(spectrogram,sample_rate,split_frequency)\n  power_spec=np.abs(spectrogram)**2\n  power_spec=power_spec.T\n  ber=[]\n  for freqinframe in power_spec:\n    sumpowerlfreq=np.sum(freqinframe[:split_frequency_bin])\n    sumpowerufreq=np.sum(freqinframe[split_frequency_bin:])\n    b=sumpowerlfreq/sumpowerufreq\n    ber.append(b)\n  return np.array(ber)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:05:58.318710Z","iopub.execute_input":"2024-01-10T19:05:58.319124Z","iopub.status.idle":"2024-01-10T19:05:58.328096Z","shell.execute_reply.started":"2024-01-10T19:05:58.319089Z","shell.execute_reply":"2024-01-10T19:05:58.326764Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"ber1=bandenergyratio(librosa.stft(y1),sr1,2000)\nber2=bandenergyratio(librosa.stft(y2),sr1,2000)\nber3=bandenergyratio(librosa.stft(y3),sr1,2000)\nber4=bandenergyratio(librosa.stft(y4),sr1,2000)\nber5=bandenergyratio(librosa.stft(y5),sr1,2000)\nber6=bandenergyratio(librosa.stft(y6),sr1,2000)\nber7=bandenergyratio(librosa.stft(y7),sr1,2000)\nber8=bandenergyratio(librosa.stft(y8),sr1,2000)\nber9=bandenergyratio(librosa.stft(y9),sr1,2000)\nber10=bandenergyratio(librosa.stft(y10),sr1,2000)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:06:21.771747Z","iopub.execute_input":"2024-01-10T19:06:21.772229Z","iopub.status.idle":"2024-01-10T19:06:23.098654Z","shell.execute_reply.started":"2024-01-10T19:06:21.772196Z","shell.execute_reply":"2024-01-10T19:06:23.097554Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"frames1=range(len(ber1))\nt1=librosa.frames_to_time(frames1,hop_length=2)\n\nframes2=range(len(ber2))\nt2=librosa.frames_to_time(frames2,hop_length=2)\n\nframes3=range(len(ber3))\nt3=librosa.frames_to_time(frames3,hop_length=2)\nframes4=range(len(ber4))\nt4=librosa.frames_to_time(frames1,hop_length=2)\n\nframes5=range(len(ber5))\nt5=librosa.frames_to_time(frames2,hop_length=2)\n\nframes6=range(len(ber6))\nt6=librosa.frames_to_time(frames3,hop_length=2)\nframes7=range(len(ber7))\nt7=librosa.frames_to_time(frames1,hop_length=2)\n\nframes8=range(len(ber8))\nt8=librosa.frames_to_time(frames2,hop_length=2)\n\nframes9=range(len(ber9))\nt9=librosa.frames_to_time(frames3,hop_length=2)\nframes10=range(len(ber10))\nt10=librosa.frames_to_time(frames1,hop_length=2)","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:06:23.489979Z","iopub.execute_input":"2024-01-10T19:06:23.490414Z","iopub.status.idle":"2024-01-10T19:06:23.502812Z","shell.execute_reply.started":"2024-01-10T19:06:23.490381Z","shell.execute_reply":"2024-01-10T19:06:23.501819Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#plotting band energy ratio curve for rudduc:\nplt.figure(figsize=(20,20))\nplt.plot(t1,ber1,color='r')\nplt.plot(t2,ber2,color='b')\nplt.xlabel(\"Time\")\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:06:33.795709Z","iopub.execute_input":"2024-01-10T19:06:33.796276Z","iopub.status.idle":"2024-01-10T19:06:34.139902Z","shell.execute_reply.started":"2024-01-10T19:06:33.796237Z","shell.execute_reply":"2024-01-10T19:06:34.138465Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#plotting band energy ratio curve for rudduc:\nplt.figure(figsize=(20,20))\nplt.plot(t3,ber3,color='r')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:06:36.465636Z","iopub.execute_input":"2024-01-10T19:06:36.466656Z","iopub.status.idle":"2024-01-10T19:06:36.807030Z","shell.execute_reply.started":"2024-01-10T19:06:36.466626Z","shell.execute_reply":"2024-01-10T19:06:36.805561Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(ber4.shape,t4.shape)\nprint()\nprint(ber5.shape,t5.shape)\nprint()\nprint(ber6.shape,t6.shape)\nprint()\nprint(ber7.shape,t7.shape)\nprint()\nprint(ber8.shape,t8.shape)\nprint()\nprint(ber9.shape,t9.shape)\nprint()\nprint(ber10.shape,t10.shape)\nprint()","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:06:41.874625Z","iopub.execute_input":"2024-01-10T19:06:41.875066Z","iopub.status.idle":"2024-01-10T19:06:41.884670Z","shell.execute_reply.started":"2024-01-10T19:06:41.875029Z","shell.execute_reply":"2024-01-10T19:06:41.882914Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#NOTE: the ber ratio curve is shown for only first three audios!!\n#rest of the audios have ber and t values such that the dimensions do not match so they cannot be plotted!!","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:06:45.272846Z","iopub.execute_input":"2024-01-10T19:06:45.274070Z","iopub.status.idle":"2024-01-10T19:06:45.279144Z","shell.execute_reply.started":"2024-01-10T19:06:45.274032Z","shell.execute_reply":"2024-01-10T19:06:45.277355Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Plotting melspectrogram for rudduc:\nmel_signal = librosa.feature.melspectrogram(y=y1, sr=32000, hop_length=2, n_fft=180)\nspectrogram = np.abs(mel_signal)\npower_to_db = librosa.power_to_db(spectrogram, ref=np.max)\nplt.figure(figsize=(15, 15))\nlibrosa.display.specshow(power_to_db, sr=sr1, x_axis='time', y_axis='mel', cmap='magma', hop_length=1)\n\nplt.colorbar(label='dB')\nplt.title('Mel-Spectrogram1 (dB) for rudduc', fontdict=dict(size=15))\nplt.xlabel('Time', fontdict=dict(size=13))\nplt.ylabel('Frequency(Hz)', fontdict=dict(size=13))\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:13:33.016691Z","iopub.execute_input":"2024-01-10T19:13:33.017269Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"mel_signal = librosa.feature.melspectrogram(y=y2, sr=32000, hop_length=2, n_fft=180)\nspectrogram = np.abs(mel_signal)\npower_to_db = librosa.power_to_db(spectrogram, ref=np.max)\nplt.figure(figsize=(15, 15))\nlibrosa.display.specshow(power_to_db, sr=sr1, x_axis='time', y_axis='mel', cmap='magma', hop_length=1)\n\nplt.colorbar(label='dB')\nplt.title('Mel-Spectrogram2 (dB) for rudduc', fontdict=dict(size=15))\nplt.xlabel('Time', fontdict=dict(size=13))\nplt.ylabel('Frequency(Hz)', fontdict=dict(size=13))\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:10:04.567896Z","iopub.execute_input":"2024-01-10T19:10:04.568681Z","iopub.status.idle":"2024-01-10T19:10:50.524344Z","shell.execute_reply.started":"2024-01-10T19:10:04.568638Z","shell.execute_reply":"2024-01-10T19:10:50.523085Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"here,we can see that for rudduc, fmin(min frequency)=60 Hz while fmax(maximum frequency)= 10000 Hz","metadata":{}},{"cell_type":"code","source":"#Plotting melspectrogram for amebit:\nmel_signal = librosa.feature.melspectrogram(y=y3, sr=32000, hop_length=2, n_fft=180)\nspectrogram = np.abs(mel_signal)\npower_to_db = librosa.power_to_db(spectrogram, ref=np.max)\nplt.figure(figsize=(15, 15))\nlibrosa.display.specshow(power_to_db, sr=sr1, x_axis='time', y_axis='mel', cmap='magma', hop_length=1)\n\nplt.colorbar(label='dB')\nplt.title('Mel-Spectrogram1 (dB) for amebit', fontdict=dict(size=15))\nplt.xlabel('Time', fontdict=dict(size=13))\nplt.ylabel('Frequency(Hz)', fontdict=dict(size=13))\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:11:07.400020Z","iopub.execute_input":"2024-01-10T19:11:07.400553Z","iopub.status.idle":"2024-01-10T19:11:16.233886Z","shell.execute_reply.started":"2024-01-10T19:11:07.400512Z","shell.execute_reply":"2024-01-10T19:11:16.232686Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"mel_signal = librosa.feature.melspectrogram(y=y4, sr=32000, hop_length=2, n_fft=180)\nspectrogram = np.abs(mel_signal)\npower_to_db = librosa.power_to_db(spectrogram, ref=np.max)\nplt.figure(figsize=(15, 15))\nlibrosa.display.specshow(power_to_db, sr=sr1, x_axis='time', y_axis='mel', cmap='magma', hop_length=1)\n\nplt.colorbar(label='dB')\nplt.title('Mel-Spectrogram2 (dB) for amebit', fontdict=dict(size=15))\nplt.xlabel('Time', fontdict=dict(size=13))\nplt.ylabel('Frequency(Hz)', fontdict=dict(size=13))\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:15:21.623029Z","iopub.execute_input":"2024-01-10T19:15:21.623725Z","iopub.status.idle":"2024-01-10T19:16:16.039895Z","shell.execute_reply.started":"2024-01-10T19:15:21.623683Z","shell.execute_reply":"2024-01-10T19:16:16.038691Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"here,for amebit, the fmin value is around 40 Hz while the fmax value is around 12000 Hz","metadata":{}},{"cell_type":"code","source":"#Plotting melspectrogram for comnig:\nmel_signal = librosa.feature.melspectrogram(y=y5, sr=32000, hop_length=2, n_fft=180)\nspectrogram = np.abs(mel_signal)\npower_to_db = librosa.power_to_db(spectrogram, ref=np.max)\nplt.figure(figsize=(15, 15))\nlibrosa.display.specshow(power_to_db, sr=sr1, x_axis='time', y_axis='mel', cmap='magma', hop_length=1)\n\nplt.colorbar(label='dB')\nplt.title('Mel-Spectrogram1 (dB) for comnig', fontdict=dict(size=15))\nplt.xlabel('Time', fontdict=dict(size=13))\nplt.ylabel('Frequency(Hz)', fontdict=dict(size=13))\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:21:30.923817Z","iopub.execute_input":"2024-01-10T19:21:30.925326Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"mel_signal = librosa.feature.melspectrogram(y=y6, sr=32000, hop_length=2, n_fft=180)\nspectrogram = np.abs(mel_signal)\npower_to_db = librosa.power_to_db(spectrogram, ref=np.max)\nplt.figure(figsize=(15, 15))\nlibrosa.display.specshow(power_to_db, sr=sr1, x_axis='time', y_axis='mel', cmap='magma', hop_length=1)\n\nplt.colorbar(label='dB')\nplt.title('Mel-Spectrogram2 (dB) for comnig', fontdict=dict(size=15))\nplt.xlabel('Time', fontdict=dict(size=13))\nplt.ylabel('Frequency(Hz)', fontdict=dict(size=13))\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:23:55.120511Z","iopub.execute_input":"2024-01-10T19:23:55.121198Z","iopub.status.idle":"2024-01-10T19:25:32.341282Z","shell.execute_reply.started":"2024-01-10T19:23:55.121158Z","shell.execute_reply":"2024-01-10T19:25:32.340037Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"for comnig, the fmin value is around 40 Hz while the fmax value seems to be around 12000Hz","metadata":{}},{"cell_type":"code","source":"#Plotting melspectrogram for daejun:\nmel_signal = librosa.feature.melspectrogram(y=y7, sr=32000, hop_length=2, n_fft=180)\nspectrogram = np.abs(mel_signal)\npower_to_db = librosa.power_to_db(spectrogram, ref=np.max)\nplt.figure(figsize=(15, 15))\nlibrosa.display.specshow(power_to_db, sr=sr1, x_axis='time', y_axis='mel', cmap='magma', hop_length=1)\n\nplt.colorbar(label='dB')\nplt.title('Mel-Spectrogram1 (dB) for daejun', fontdict=dict(size=15))\nplt.xlabel('Time', fontdict=dict(size=13))\nplt.ylabel('Frequency(Hz)', fontdict=dict(size=13))\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:26:19.612254Z","iopub.execute_input":"2024-01-10T19:26:19.613175Z","iopub.status.idle":"2024-01-10T19:26:56.307998Z","shell.execute_reply.started":"2024-01-10T19:26:19.613124Z","shell.execute_reply":"2024-01-10T19:26:56.306510Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"mel_signal = librosa.feature.melspectrogram(y=y8, sr=32000, hop_length=2, n_fft=180)\nspectrogram = np.abs(mel_signal)\npower_to_db = librosa.power_to_db(spectrogram, ref=np.max)\nplt.figure(figsize=(15, 15))\nlibrosa.display.specshow(power_to_db, sr=sr1, x_axis='time', y_axis='mel', cmap='magma', hop_length=1)\n\nplt.colorbar(label='dB')\nplt.title('Mel-Spectrogram2 (dB) for daejun', fontdict=dict(size=15))\nplt.xlabel('Time', fontdict=dict(size=13))\nplt.ylabel('Frequency(Hz)', fontdict=dict(size=13))\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:27:46.628951Z","iopub.execute_input":"2024-01-10T19:27:46.629607Z","iopub.status.idle":"2024-01-10T19:30:21.747585Z","shell.execute_reply.started":"2024-01-10T19:27:46.629572Z","shell.execute_reply":"2024-01-10T19:30:21.746473Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"here, for daejun the fmin value turns out to be around 60 Hz while fmax turns out to be around 12000 Hz","metadata":{}},{"cell_type":"code","source":"#Plotting melspectrogram for canwre:\nmel_signal = librosa.feature.melspectrogram(y=y9, sr=32000, hop_length=2, n_fft=180)\nspectrogram = np.abs(mel_signal)\npower_to_db = librosa.power_to_db(spectrogram, ref=np.max)\nplt.figure(figsize=(15, 15))\nlibrosa.display.specshow(power_to_db, sr=sr1, x_axis='time', y_axis='mel', cmap='magma', hop_length=1)\n\nplt.colorbar(label='dB')\nplt.title('Mel-Spectrogram1 (dB) for canwre', fontdict=dict(size=15))\nplt.xlabel('Time', fontdict=dict(size=13))\nplt.ylabel('Frequency(Hz)', fontdict=dict(size=13))\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:31:21.880488Z","iopub.execute_input":"2024-01-10T19:31:21.880899Z","iopub.status.idle":"2024-01-10T19:31:44.069708Z","shell.execute_reply.started":"2024-01-10T19:31:21.880870Z","shell.execute_reply":"2024-01-10T19:31:44.068191Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"mel_signal = librosa.feature.melspectrogram(y=y10, sr=32000, hop_length=2, n_fft=180)\nspectrogram = np.abs(mel_signal)\npower_to_db = librosa.power_to_db(spectrogram, ref=np.max)\nplt.figure(figsize=(15, 15))\nlibrosa.display.specshow(power_to_db, sr=sr1, x_axis='time', y_axis='mel', cmap='magma', hop_length=1)\n\nplt.colorbar(label='dB')\nplt.title('Mel-Spectrogram2 (dB) for canwre', fontdict=dict(size=15))\nplt.xlabel('Time', fontdict=dict(size=13))\nplt.ylabel('Frequency(Hz)', fontdict=dict(size=13))\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2024-01-10T19:32:15.943878Z","iopub.execute_input":"2024-01-10T19:32:15.944373Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"here, for canwre, the fmin value seems to be around 60 Hz while the fmax seems to be around 15000Hz","metadata":{}},{"cell_type":"code","source":"!pip install resampy","metadata":{"execution":{"iopub.status.busy":"2024-01-11T16:45:35.628251Z","iopub.execute_input":"2024-01-11T16:45:35.628716Z","iopub.status.idle":"2024-01-11T16:45:51.582004Z","shell.execute_reply.started":"2024-01-11T16:45:35.628677Z","shell.execute_reply":"2024-01-11T16:45:51.581008Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"MODEL CREATION AND IMPLEMENTATION","metadata":{}},{"cell_type":"code","source":"import cv2\nimport audioread\nimport logging\nimport os\nimport random\nimport time\nimport warnings\n\nimport librosa\nimport numpy as np\nimport pandas as pd\nimport soundfile as sf\nimport torch\nimport torch.nn as nn\nimport torch.nn.functional as F\nimport torch.utils.data as data\n\nfrom contextlib import contextmanager\nfrom pathlib import Path\nfrom typing import Optional\n\nfrom fastprogress import progress_bar\nfrom sklearn.metrics import f1_score\nfrom torchvision import models","metadata":{"execution":{"iopub.status.busy":"2024-01-11T16:58:55.639589Z","iopub.execute_input":"2024-01-11T16:58:55.640054Z","iopub.status.idle":"2024-01-11T16:58:55.647989Z","shell.execute_reply.started":"2024-01-11T16:58:55.640015Z","shell.execute_reply":"2024-01-11T16:58:55.646725Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def setseed(seed: int=42):\n    random.seed(seed)\n    np.random.seed(seed)\n    os.environ[\"PYTHONHASHSEED\"]= str(seed)\n    torch.manual_seed(seed)\n    torch.cuda.manual_seed(seed)\n    torch.backends.cudnn.deterministic=True\n    torch.backends.cudnn.benchmark=True\n    \ndef get_logger(out_file=None):\n    logger=logging.getLogger()\n    formatter=logging.Formatter(\"%(asctime)s-%(levelname)s-%(message)s\")\n    logger.handlers=[]\n    logger.setLevel=(logging.INFO)\n    \n    handler=logging.StreamHandler()\n    handler.setFormatter(formatter)\n    handler.setLevel(logging.INFO)\n    logger.addHandler(handler)\n    \n    if out_file is not None:\n        fh=logging.FileHandler(out_file)\n        fh.setFormatter(formatter)\n        fh.setLevel(logging.INFO)\n        logger.addHandler(fh)\n    logger.info(\"logger set up\")\n    return logger\n\n@contextmanager\n\ndef timer(name: str,logger: Optional[logging.Logger]=None):\n    t0=time.time()\n    msg=f\"[{name}]start\"\n    if logger is None:\n        print(msg)\n    else:\n        logger.info(msg)\n    yield\n    msg=f\"[{name}] done in {time.time()-t0:.2f}s\"\n    if logger is None:\n        print(msg)\n    else:\n        logger.info(msg)","metadata":{"execution":{"iopub.status.busy":"2024-01-11T16:58:58.426519Z","iopub.execute_input":"2024-01-11T16:58:58.426922Z","iopub.status.idle":"2024-01-11T16:58:58.438754Z","shell.execute_reply.started":"2024-01-11T16:58:58.426893Z","shell.execute_reply":"2024-01-11T16:58:58.437497Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"logger=get_logger(\"main.log\")\nsetseed(1213)","metadata":{"execution":{"iopub.status.busy":"2024-01-11T16:58:59.350664Z","iopub.execute_input":"2024-01-11T16:58:59.351054Z","iopub.status.idle":"2024-01-11T16:58:59.358990Z","shell.execute_reply.started":"2024-01-11T16:58:59.351023Z","shell.execute_reply":"2024-01-11T16:58:59.357677Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#IMPORTING TEST FILE AND TEST AUDIOS!!","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test= pd.read_csv(\"/kaggle/input/birdcall-check/test.csv\")\ntest_audio=\"/kaggle/input/birdcall-check/test_audio\"\n\ntest.head()","metadata":{"execution":{"iopub.status.busy":"2024-01-11T16:59:00.618002Z","iopub.execute_input":"2024-01-11T16:59:00.619000Z","iopub.status.idle":"2024-01-11T16:59:00.641034Z","shell.execute_reply.started":"2024-01-11T16:59:00.618959Z","shell.execute_reply":"2024-01-11T16:59:00.639828Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#MODEL INITIATION","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"class ResNet(nn.Module):\n    def __init__(self, base_model_name:str, pretrained=False,num_classes=264):\n        super().__init__()\n        base_model=models.__getattribute__(base_model_name)(pretrained=pretrained)\n        layers=list(base_model.children())[:-2]\n        layers.append(nn.AdaptiveMaxPool2d(1))\n        self.encoder=nn.Sequential(*layers)\n        \n        in_features=base_model.fc.in_features\n        \n        self.classifier=nn.Sequential(\n             nn.Linear(in_features,1024),nn.ReLU(),nn.Dropout(p=0.2),\n             nn.Linear(1024,1024),nn.ReLU(),nn.Dropout(p=0.2),\n             nn.Linear(1024,num_classes))\n        \n    def forward(self,x):\n        batch_size=x.size(0)\n        x=self.encoder(x).view(batch_size,-1)\n        x=self.classifier(x)\n        multiclass_p=F.softmax(x,dim=1)\n        multilabel_p=F.sigmoid(x)\n        return{\n            \"logits\":x,\n            \"multiclass_p\":multiclass_p,\n            \"multilabel_p\":multilabel_p\n        }","metadata":{"execution":{"iopub.status.busy":"2024-01-11T16:59:01.511104Z","iopub.execute_input":"2024-01-11T16:59:01.511551Z","iopub.status.idle":"2024-01-11T16:59:01.522721Z","shell.execute_reply.started":"2024-01-11T16:59:01.511496Z","shell.execute_reply":"2024-01-11T16:59:01.521629Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"model_config={\n    \"base_model_name\":\"resnet50\",\n    \"pretrained\":False,\n    \"num_classes\":264\n}\n\nmelspectrogram_parameters={\n    \"n_mels\":128,\n    \"fmin\":20,\n    \"fmax\":16000\n}\n\nweights_path=\"/kaggle/input/birdcall-resnet50-init-weights/best.pth\"","metadata":{"execution":{"iopub.status.busy":"2024-01-11T16:59:02.703866Z","iopub.execute_input":"2024-01-11T16:59:02.704288Z","iopub.status.idle":"2024-01-11T16:59:02.710508Z","shell.execute_reply.started":"2024-01-11T16:59:02.704254Z","shell.execute_reply":"2024-01-11T16:59:02.709297Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#LABEL ENCODING BIRD CODE VALUES!!","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from sklearn.preprocessing import LabelEncoder\ndf=pd.read_csv(\"/kaggle/input/birdsong-recognition/train.csv\")\nunique_bird_names=df.ebird_code.unique()\nlabelencoder=LabelEncoder()\nencoded_labels=labelencoder.fit_transform(unique_bird_names)\n\nBIRD_CODE=dict(zip(unique_bird_names,encoded_labels))\nINV_BIRD_CODE={v:k for k,v in BIRD_CODE.items()}\n\nfor bird_name,label in INV_BIRD_CODE.items():\n    print(f\"{bird_name}:{label}\")","metadata":{"execution":{"iopub.status.busy":"2024-01-11T16:59:04.149865Z","iopub.execute_input":"2024-01-11T16:59:04.150361Z","iopub.status.idle":"2024-01-11T16:59:04.551074Z","shell.execute_reply.started":"2024-01-11T16:59:04.150322Z","shell.execute_reply":"2024-01-11T16:59:04.549859Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def mono_to_color(X:np.ndarray,\n                  mean=None,\n                  std=None,\n                  norm_max=None,\n                  norm_min=None,\n                  eps=1e-6):\n    X=np.stack([X,X,X],axis=-1)\n    \n    mean=mean or X.mean()\n    X=X-mean\n    std=std or X.std()\n    Xstd=X/(std+eps)\n    _min,_max=Xstd.min(),Xstd.max()\n    norm_max=norm_max or _max\n    norm_min=norm_min or _min\n    \n    if(_max-_min)>eps:\n        V=Xstd\n        V[V<norm_min]=norm_min\n        V[V>norm_max]=norm_max\n        V=255*(V-norm_min)/(norm_max-norm_min)\n        V=V.astype(np.uint8)\n    else:\n        V=np.zeroes_like(Xstd,dtype=np.uint8)\n    return V","metadata":{"execution":{"iopub.status.busy":"2024-01-11T16:59:04.832809Z","iopub.execute_input":"2024-01-11T16:59:04.833569Z","iopub.status.idle":"2024-01-11T16:59:04.844184Z","shell.execute_reply.started":"2024-01-11T16:59:04.833523Z","shell.execute_reply":"2024-01-11T16:59:04.843102Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"class TestDataset(data.Dataset):\n    def __init__(self, df:pd.DataFrame, clip:np.ndarray,img_size=224, melspectrogram_parameters={}):\n        self.df=df\n        self.clip=clip\n        self.img_size=img_size\n        self.melspectrogram_parameters=melspectrogram_parameters\n        \n    def __len__(self):\n        return len(self.df)\n    \n    def __getitem__(self, idx:int):\n        SR=32000\n        sample=self.df.loc[idx,:]\n        site=sample.site\n        row_id=sample.row_id\n        \n        if site==\"site_3\":\n            y=self.clip.astype(np.float32)\n            len_y=len(y)\n            start=0\n            end=SR*5\n            images=[]\n            while len_y>start:\n                y_batch=y[start:end].astype(np.float32)\n                if len(y_batch)!=(SR*5):\n                    break\n                start=end\n                end=end+SR*5\n                melspec=librosa.feature.melspectrogram(y=y_batch,sr=32000,**self.melspectrogram_parameters)\n                melspec=librosa.power_to_db(melspec).astype(np.float32)\n                image=mono_to_color(melspec)\n                height,width,_=image.shape\n                image=cv2.resize(image,(int(width*self.img_size/height),self.img_size))\n                image=np.moveaxis(image,2,0)\n                image=(image/255.0).astype(np.float32)\n                images.append(image)\n            images=np.asarray(images)\n            return images,row_id,site\n        \n        else:\n            end_seconds=int(sample.seconds)\n            start_seconds=int(end_seconds-5)\n            \n            start_index=SR*start_seconds\n            end_index=SR*end_seconds\n            \n            y=self.clip[start_index:end_index].astype(np.float32)\n            melspec=librosa.feature.melspectrogram(y=y,sr=32000,**self.melspectrogram_parameters)\n            melspec=librosa.power_to_db(melspec).astype(np.float32)\n            image=mono_to_color(melspec)\n            height,width,_=image.shape\n            image=cv2.resize(image,(int(width*self.img_size/height),self.img_size))\n            image=np.moveaxis(image,2,0)\n            image=(image/255.0).astype(np.float32)\n            \n            return image,row_id,site\n                ","metadata":{"execution":{"iopub.status.busy":"2024-01-11T16:59:06.469772Z","iopub.execute_input":"2024-01-11T16:59:06.470189Z","iopub.status.idle":"2024-01-11T16:59:06.488690Z","shell.execute_reply.started":"2024-01-11T16:59:06.470155Z","shell.execute_reply":"2024-01-11T16:59:06.487325Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def get_model(config: dict, weights_path: str):\n    model = ResNet(**config)\n    checkpoint = torch.load(weights_path, map_location=torch.device('cpu'))\n    model.load_state_dict(checkpoint[\"model_state_dict\"])\n    model.eval()\n    return model","metadata":{"execution":{"iopub.status.busy":"2024-01-11T16:59:07.522121Z","iopub.execute_input":"2024-01-11T16:59:07.522497Z","iopub.status.idle":"2024-01-11T16:59:07.529791Z","shell.execute_reply.started":"2024-01-11T16:59:07.522467Z","shell.execute_reply":"2024-01-11T16:59:07.528623Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#prediction!!","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def prediction_for_clip(test_df: pd.DataFrame,\n                        clip:np.ndarray,\n                        model:ResNet,\n                        mel_params:dict,\n                        threshold=0.5):\n    dataset=TestDataset(df=test_df,\n                       clip=clip,\n                       img_size=224,\n                       melspectrogram_parameters=mel_params)\n    loader=data.DataLoader(dataset,batch_size=1,shuffle=False)\n    device=torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\")\n    \n    model.eval()\n    prediction_dict={}\n    for image,row_id,site in progress_bar(loader):\n        site=site[0]\n        row_id=row_id[0]\n        if site in {\"site_1\",\"site_2\"}:\n            image=image.to(device)\n            \n            with torch.no_grad():\n                prediction=model(image)\n                proba=prediction[\"multilabel_p\"].detach().cpu().numpy().reshape(-1)\n                \n            events=proba>=threshold\n            labels=np.argwhere(events).reshape(-1).tolist()\n            \n        else:\n            image=image.squeeze(0)\n            batch_size=16\n            whole_size=image.size(0)\n            if whole_size % batch_size==0:\n                n_iter=whole_size//batch_size\n            else:\n                n_iter=whole_size//batch_size+1\n                \n                \n            all_events=set()\n            for batch_i in range(n_iter):\n                batch=image[batch_i*batch_size:(batch_i+1)*batch_size]\n                if batch.ndim==3:\n                    batch=batch.unsqueeze(0)\n                    \n                batch=batch.to(device)\n                with torch.no_grad():\n                    prediction=model(batch)\n                    proba=prediction[\"multilabel_p\"].detach().cpu().numpy()\n                events=proba>=threshold\n                \n                for i in range(len(events)):\n                    event=events[i,:]\n                    labels=np.argwhere(event).reshape(-1).tolist()\n                    for label in labels:\n                        all_events.add(label)\n            labels=list(all_events)\n        \n        if len(labels)==0:\n            prediction_dict[row_id]=\"nocall\"\n            \n        else:\n            labels_str_list=list(map(lambda x: INV_BIRD_CODE[x],labels))\n            label_string=\" \".join(labels_str_list)\n            prediction_dict[row_id]=label_string\n    return prediction_dict","metadata":{"execution":{"iopub.status.busy":"2024-01-11T16:59:09.999592Z","iopub.execute_input":"2024-01-11T16:59:10.000028Z","iopub.status.idle":"2024-01-11T16:59:10.018707Z","shell.execute_reply.started":"2024-01-11T16:59:09.999991Z","shell.execute_reply":"2024-01-11T16:59:10.017433Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def prediction(test_df:pd.DataFrame,\n              test_audio:Path,\n              model_config:dict,\n              mel_params:dict,\n              weights_path:str,\n              threshold=0.5):\n    model=get_model(model_config, weights_path)\n    unique_audio_id=test_df.audio_id.unique()\n    \n    warnings.filterwarnings(\"ignore\")\n    prediction_dfs=[]\n    for audio_id in unique_audio_id:\n        with timer(f\"Loading {audio_id}\", logger):\n            clip,_=librosa.load(test_audio+\"/\"+(audio_id+\".mp3\"),\n                                sr=32000,\n                                mono=True,\n                                res_type=\"kaiser_fast\")\n        test_df_for_audio_id=test_df.query(f\"audio_id=='{audio_id}'\").reset_index(drop=True)\n        with timer(f\"Prediction on {audio_id}\", logger):\n            prediction_dict=prediction_for_clip(test_df_for_audio_id,\n                                               clip=clip,\n                                               model=model,\n                                               mel_params=mel_params,\n                                               threshold=threshold)\n        row_id=list(prediction_dict.keys())\n        birds=list(prediction_dict.values())\n        prediction_df=pd.DataFrame({\n            \"row_id\":row_id,\n            \"birds\":birds\n        })\n        prediction_dfs.append(prediction_df)\n    prediction_df=pd.concat(prediction_dfs, axis=0,sort=False).reset_index(drop=True)\n    return prediction_df","metadata":{"execution":{"iopub.status.busy":"2024-01-11T16:59:11.576056Z","iopub.execute_input":"2024-01-11T16:59:11.576565Z","iopub.status.idle":"2024-01-11T16:59:11.588375Z","shell.execute_reply.started":"2024-01-11T16:59:11.576513Z","shell.execute_reply":"2024-01-11T16:59:11.586883Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#predicted dataset!!","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submission=prediction(test_df=test,\n                     test_audio=test_audio,\n                     model_config=model_config,\n                     mel_params= melspectrogram_parameters,\n                     weights_path=weights_path,\n                     threshold=0.8)\nsubmission.to_csv(\"submission.csv\", index=False)","metadata":{"execution":{"iopub.status.busy":"2024-01-11T16:59:12.902335Z","iopub.execute_input":"2024-01-11T16:59:12.902749Z","iopub.status.idle":"2024-01-11T17:00:15.151173Z","shell.execute_reply.started":"2024-01-11T16:59:12.902715Z","shell.execute_reply":"2024-01-11T17:00:15.150242Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submission","metadata":{"execution":{"iopub.status.busy":"2024-01-11T17:00:26.038723Z","iopub.execute_input":"2024-01-11T17:00:26.039147Z","iopub.status.idle":"2024-01-11T17:00:26.053604Z","shell.execute_reply.started":"2024-01-11T17:00:26.039113Z","shell.execute_reply":"2024-01-11T17:00:26.052068Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submission.row_id.unique()","metadata":{"execution":{"iopub.status.busy":"2024-01-11T17:24:41.574506Z","iopub.execute_input":"2024-01-11T17:24:41.575174Z","iopub.status.idle":"2024-01-11T17:24:41.585144Z","shell.execute_reply.started":"2024-01-11T17:24:41.574945Z","shell.execute_reply":"2024-01-11T17:24:41.583762Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submission.birds.unique()","metadata":{"execution":{"iopub.status.busy":"2024-01-11T17:25:22.151199Z","iopub.execute_input":"2024-01-11T17:25:22.151645Z","iopub.status.idle":"2024-01-11T17:25:22.159799Z","shell.execute_reply.started":"2024-01-11T17:25:22.151609Z","shell.execute_reply":"2024-01-11T17:25:22.158663Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(submission.row_id,submission.birds)","metadata":{"execution":{"iopub.status.busy":"2024-01-11T17:29:52.984966Z","iopub.execute_input":"2024-01-11T17:29:52.985350Z","iopub.status.idle":"2024-01-11T17:29:52.995164Z","shell.execute_reply.started":"2024-01-11T17:29:52.985319Z","shell.execute_reply":"2024-01-11T17:29:52.993877Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"\nsubmission['site_identifier'] = submission['row_id'].str.extract(r'(.+?)_\\d+$')\n\nnew_df = submission.groupby('site_identifier')['birds'].agg(lambda x: x.value_counts().idxmax()).reset_index()\n\nnew_df.columns = ['site_identifier', 'most_frequent_bird']\nprint(new_df)\n","metadata":{"execution":{"iopub.status.busy":"2024-01-11T17:47:45.777983Z","iopub.execute_input":"2024-01-11T17:47:45.778871Z","iopub.status.idle":"2024-01-11T17:47:45.797884Z","shell.execute_reply.started":"2024-01-11T17:47:45.778825Z","shell.execute_reply":"2024-01-11T17:47:45.796602Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#here, we have only sorted out values for site_1 and site_2,we can also have site_3 values which will ahve same data as that of submission!!","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#F1-SCORE CALCULATION","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from sklearn.metrics import f1_score\nmerged_df = pd.merge(submission, test, on='row_id', how='left', suffixes=('_pred', '_actual'))\nmerged_df = merged_df.dropna(subset=['birds'])\nf1 = f1_score(merged_df['birds'], merged_df['birds'], average='micro')\nprint(f\"F1 Score: {f1}\")","metadata":{"execution":{"iopub.status.busy":"2024-01-11T17:57:32.270758Z","iopub.execute_input":"2024-01-11T17:57:32.271195Z","iopub.status.idle":"2024-01-11T17:57:32.288258Z","shell.execute_reply.started":"2024-01-11T17:57:32.271164Z","shell.execute_reply":"2024-01-11T17:57:32.287250Z"},"trusted":true},"execution_count":null,"outputs":[]}]}