{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"# Waveform Images of Bengali Sound","metadata":{"papermill":{"duration":0.005036,"end_time":"2023-02-04T06:54:41.146198","exception":false,"start_time":"2023-02-04T06:54:41.141162","status":"completed"},"tags":[]}},{"cell_type":"markdown","source":"https://www.kaggle.com/code/stpeteishii/visualization-methods-of-mp3-sound<br/>\nhttps://github.com/jiaaro/pydub","metadata":{}},{"cell_type":"code","source":"import os\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport librosa\nimport pydub\nfrom pydub import AudioSegment","metadata":{"papermill":{"duration":2.63141,"end_time":"2023-02-04T06:54:43.790471","exception":false,"start_time":"2023-02-04T06:54:41.159061","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-08-17T16:11:59.276376Z","iopub.execute_input":"2023-08-17T16:11:59.277849Z","iopub.status.idle":"2023-08-17T16:12:02.442085Z","shell.execute_reply.started":"2023-08-17T16:11:59.277660Z","shell.execute_reply":"2023-08-17T16:12:02.439858Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!mkdir train\n!mkdir test","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"for dirname, _, filenames in os.walk('/kaggle/input/bengaliai-speech/test_mp3s'):    \n    for i,filename in enumerate(filenames):\n        path=os.path.join(dirname, filename)\n        y, sr = librosa.load(path)\n        file=path.split('/')[-1][0:-4]\n        plt.plot(y)\n        plt.savefig('./test/'+file+'.png', bbox_inches='tight', pad_inches=0)\n        plt.show()","metadata":{"execution":{"iopub.status.busy":"2023-08-17T16:12:02.446401Z","iopub.execute_input":"2023-08-17T16:12:02.447088Z","iopub.status.idle":"2023-08-17T16:27:47.199529Z","shell.execute_reply.started":"2023-08-17T16:12:02.447023Z","shell.execute_reply":"2023-08-17T16:27:47.198300Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"for dirname, _, filenames in os.walk('/kaggle/input/bengaliai-speech/train_mp3s'):    \n    for i,filename in enumerate(filenames):\n        if i<1000:\n            path=os.path.join(dirname, filename)\n            y, sr = librosa.load(path)\n            file=path.split('/')[-1][0:-4]\n            plt.plot(y)\n            plt.savefig('./train/'+file+'.png', bbox_inches='tight', pad_inches=0)\n            plt.close()","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}