

{"id":69745,"date":"2019-09-17T11:37:40","date_gmt":"2019-09-17T06:07:40","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=69745"},"modified":"2025-07-29T18:31:10","modified_gmt":"2025-07-29T13:01:10","slug":"python-mini-project-speech-emotion-recognition","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/python-mini-project-speech-emotion-recognition\/","title":{"rendered":"Python Mini Project &#8211; Speech Emotion Recognition with librosa"},"content":{"rendered":"<div class='__iawmlf-post-loop-links' style='display:none;' data-iawmlf-post-links='[{&quot;id&quot;:1211,&quot;href&quot;:&quot;https:\\\/\\\/drive.google.com\\\/file\\\/d\\\/1wWsrN2Ep7x6lWqOXfr4rpKGYrJhWc8z7\\\/view&quot;,&quot;archived_href&quot;:&quot;http:\\\/\\\/web-wp.archive.org\\\/web\\\/20240902022438\\\/https:\\\/\\\/drive.google.com\\\/file\\\/d\\\/1wWsrN2Ep7x6lWqOXfr4rpKGYrJhWc8z7\\\/view&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2025-12-09 03:52:26&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2025-12-12 03:54:54&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2025-12-15 04:01:58&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2025-12-18 04:10:04&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2025-12-21 06:37:55&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2025-12-24 06:55:39&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2025-12-27 07:10:01&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2025-12-30 07:21:51&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-01-02 07:37:15&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-01-05 07:42:43&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-01-08 07:54:49&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-01-11 07:58:39&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-01-14 08:01:31&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-01-17 08:13:59&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-01-20 08:21:22&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-01-23 08:26:35&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-01-26 08:31:36&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-01-29 08:41:53&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-02-01 08:57:58&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-02-04 09:13:11&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-02-07 09:13:16&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-02-10 09:17:24&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-02-13 09:29:01&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-02-16 09:49:44&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-02-19 09:51:13&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-02-22 10:38:36&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-02-25 10:41:05&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-02-28 10:54:54&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-03-03 11:08:46&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-03-06 12:54:52&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-03-09 12:55:54&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-03-12 13:15:21&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-03-15 13:17:30&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-03-18 13:17:49&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-03-21 13:53:48&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-03-24 14:06:19&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-03-27 14:08:53&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-03-30 14:18:37&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-04-02 14:26:40&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-04-05 14:30:21&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-04-08 14:40:42&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-04-11 15:12:19&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-04-14 15:19:35&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-04-17 16:03:13&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-04-20 16:14:33&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-04-23 16:17:59&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-04-26 16:38:21&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-04-29 16:58:58&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-05-02 17:22:54&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-05-05 17:31:33&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-05-08 18:08:39&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-05-11 18:24:02&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-05-14 18:30:18&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-05-17 23:35:52&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-05-20 23:55:11&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-05-24 02:32:11&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-05-27 03:11:05&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-05-30 03:54:29&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-06-02 04:47:45&quot;,&quot;http_code&quot;:404}],&quot;broken&quot;:true,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-06-02 04:47:45&quot;,&quot;http_code&quot;:404},&quot;process&quot;:&quot;done&quot;},{&quot;id&quot;:1402,&quot;href&quot;:&quot;https:\\\/\\\/scikit-learn.org&quot;,&quot;archived_href&quot;:&quot;http:\\\/\\\/web-wp.archive.org\\\/web\\\/20251126202445\\\/https:\\\/\\\/scikit-learn.org\\\/&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2025-12-09 06:31:06&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2025-12-12 07:01:25&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2025-12-15 09:19:56&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2025-12-18 11:23:10&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2025-12-21 12:44:46&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2025-12-25 00:59:27&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2025-12-28 05:42:37&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2025-12-31 07:34:59&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-03 08:41:37&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-06 09:22:52&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-09 12:08:43&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-12 13:15:37&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-15 13:21:24&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-18 13:40:52&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-21 19:15:20&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-25 03:03:48&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-28 05:10:08&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-31 05:27:20&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-03 05:47:28&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-06 10:07:07&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-09 15:52:37&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-12 15:56:30&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-15 16:54:40&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-02-19 04:25:04&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-22 07:08:34&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-25 08:12:29&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-28 09:09:11&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-03 14:59:07&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-06 15:49:12&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-09 20:14:20&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-13 03:23:26&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-16 04:50:01&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-03-19 05:01:06&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-22 08:35:25&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-25 08:46:03&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-03-28 09:37:16&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-31 09:54:21&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-03 15:23:17&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-06 15:38:12&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-09 17:09:20&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-04-12 19:25:40&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-15 21:32:51&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-19 00:01:50&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-04-22 02:35:27&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-04-25 03:06:45&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-28 04:52:50&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-01 07:03:29&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-04 09:43:32&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-07 15:36:52&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-10 16:34:36&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-13 22:00:07&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-17 09:21:12&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-20 09:35:50&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-23 15:00:10&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-26 15:41:54&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-30 11:08:37&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-06-02 12:22:12&quot;,&quot;http_code&quot;:206}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-06-02 12:22:12&quot;,&quot;http_code&quot;:206},&quot;process&quot;:&quot;done&quot;},{&quot;id&quot;:1403,&quot;href&quot;:&quot;https:\\\/\\\/techvidvan.com\\\/python-course-multilingual&quot;,&quot;archived_href&quot;:&quot;&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[],&quot;broken&quot;:false,&quot;last_checked&quot;:null,&quot;process&quot;:&quot;done&quot;},{&quot;id&quot;:1404,&quot;href&quot;:&quot;https:\\\/\\\/zenodo.org\\\/record\\\/1188976#.XYHHn3WFPM1&quot;,&quot;archived_href&quot;:&quot;http:\\\/\\\/web-wp.archive.org\\\/web\\\/20230819140105\\\/https:\\\/\\\/zenodo.org\\\/record\\\/1188976&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2025-12-09 06:31:18&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-12 07:01:30&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-15 09:20:09&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-18 11:23:16&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-21 12:44:49&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-25 00:59:33&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-28 05:42:40&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-31 07:35:03&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-03 08:41:41&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-06 09:22:57&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-01-09 12:08:51&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-12 13:15:49&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-01-15 13:21:31&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-18 13:40:57&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-21 19:15:25&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-25 03:03:48&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-28 05:10:08&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-31 05:27:23&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-03 05:47:31&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-06 10:07:12&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-09 15:52:42&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-12 15:56:31&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-15 16:54:42&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-19 04:25:02&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-22 07:08:41&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-25 09:24:52&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-28 16:19:59&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-03 17:41:45&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-06 18:51:46&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-09 20:14:18&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-13 04:18:27&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-16 08:32:21&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-19 12:16:35&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-22 12:59:39&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-25 14:40:52&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-29 04:35:32&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-01 04:56:52&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-04 07:56:09&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-07 08:36:41&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-10 11:03:23&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-13 11:56:07&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-16 12:06:08&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-19 13:43:53&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-22 17:01:05&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-26 05:52:40&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-29 07:42:28&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-02 10:31:27&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-05-05 11:08:38&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-05-08 17:03:48&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-11 17:44:24&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-14 17:55:10&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-17 18:38:13&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-20 23:55:51&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-24 02:32:28&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-27 08:45:48&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-30 11:08:47&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-06-02 12:22:13&quot;,&quot;http_code&quot;:200}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-06-02 12:22:13&quot;,&quot;http_code&quot;:200},&quot;process&quot;:&quot;done&quot;}]'><\/div>\n<p>Speech emotion recognition, the best ever python mini project. The best example of it can be seen at call centers. If you ever noticed, call centers employees never talk in the same manner, their way of pitching\/talking to the customers changes with customers. Now, this does happen with common people too, but how is this relevant to call centers? Here is your answer, the employees recognize customers&#8217; emotions from speech, so they can improve their service and convert more people. In this way, they are using speech emotion recognition. So, let&#8217;s discuss this project in detail.<\/p>\n<p>Speech emotion recognition is a simple Python mini-project, which you are going to practice with DataFlair. Before, I explain to you the terms related to this mini python project, make sure you bookmarked the <em><strong>complete list of Python Projects<\/strong><\/em>.<\/p>\n<ol>\n<li><a href=\"https:\/\/data-flair.training\/blogs\/advanced-python-project-detecting-fake-news\/\">Fake News Detection Python Project<\/a><\/li>\n<li><a href=\"https:\/\/data-flair.training\/blogs\/python-machine-learning-project-detecting-parkinson-disease\/\">Parkinson\u2019s Disease\u00a0Detection Python Project<\/a><\/li>\n<li><a href=\"https:\/\/data-flair.training\/blogs\/project-in-python-colour-detection\/\">Color Detection Python Project<\/a><\/li>\n<li>Speech Emotion Recognition Python Project<\/li>\n<li><a href=\"https:\/\/data-flair.training\/blogs\/project-in-python-breast-cancer-classification\/\">Breast Cancer Classification Python Project<\/a><\/li>\n<li><a href=\"https:\/\/data-flair.training\/blogs\/python-project-gender-age-detection\/\">Age and Gender Detection Python Project<\/a><\/li>\n<li><a href=\"https:\/\/data-flair.training\/blogs\/python-deep-learning-project-handwritten-digit-recognition\/\">Handwritten Digit Recognition Python Project<\/a><\/li>\n<li><a href=\"https:\/\/data-flair.training\/blogs\/python-chatbot-project\/\">Chatbot Python Project<\/a><\/li>\n<li><a href=\"https:\/\/data-flair.training\/blogs\/python-project-driver-drowsiness-detection-system\/\">Driver Drowsiness Detection Python Project<\/a><\/li>\n<li><a href=\"https:\/\/data-flair.training\/blogs\/python-project-traffic-signs-recognition\/\">Traffic Signs Recognition Python Project<\/a><\/li>\n<li><a href=\"https:\/\/data-flair.training\/blogs\/python-based-project-image-caption-generator-cnn\/\">Image Caption Generator Python Project<\/a><\/li>\n<\/ol>\n<h3>What is Speech Emotion Recognition?<\/h3>\n<p>Speech Emotion Recognition, abbreviated as SER, is the act of attempting to recognize human emotion and affective states from speech. This is capitalizing on the fact that voice often reflects underlying emotion through tone and pitch. This is also the phenomenon that animals like dogs and horses employ to be able to understand human emotion.<\/p>\n<p>SER is tough because emotions are subjective and annotating audio is challenging.<\/p>\n<h3>What is librosa?<\/h3>\n<p>librosa is a <em><strong><a href=\"https:\/\/data-flair.training\/blogs\/python-libraries\/\">Python library<\/a><\/strong><\/em> for analyzing audio and music. It has a flatter package layout, standardizes interfaces and names, backwards compatibility, modular functions, and readable code. Further, in this Python mini-project, we demonstrate how to install it (and a few other packages) with pip.<\/p>\n<h3>What is JupyterLab?<\/h3>\n<p>JupyterLab is an open-source, web-based UI for Project Jupyter and it has all basic functionalities of the Jupyter Notebook, like notebooks, terminals, text editors, file browsers, rich outputs, and more. However, it also provides improved support for third party extensions.<\/p>\n<p>To run code in the JupyterLab, you\u2019ll first need to run it with the command prompt:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">C:\\Users\\DataFlair&gt;jupyter lab<\/pre>\n<p>This will open for you a new session in your browser. Create a new Console and start typing in your code. JupyterLab can execute multiple lines of code at once; pressing enter will not execute your code, you\u2019ll need to press Shift+Enter for the same.<\/p>\n<h3>Speech Emotion Recognition &#8211; Objective<\/h3>\n<p>To build a model to recognize emotion from speech using the librosa and sklearn libraries and the RAVDESS dataset.<\/p>\n<h3>Speech Emotion Recognition &#8211; About the Python Mini Project<\/h3>\n<p>In this Python mini project, we will use the libraries librosa, soundfile, and sklearn (among others) to build a model using an MLPClassifier. This will be able to recognize emotion from sound files. We will load the data, extract features from it, then split the dataset into training and testing sets. Then, we\u2019ll initialize an MLPClassifier and train the model. Finally, we\u2019ll calculate the accuracy of our model.<\/p>\n<h3>The Dataset<\/h3>\n<p>For this Python mini project, we\u2019ll use the RAVDESS dataset; this is the Ryerson Audio-Visual Database of Emotional Speech and Song dataset, and is free to download. This dataset has 7356 files rated by 247 individuals 10 times on emotional validity, intensity, and genuineness. The entire dataset is 24.8GB from 24 actors, but we&#8217;ve lowered the sample rate on all the files, and you can <a href=\"https:\/\/drive.google.com\/file\/d\/1wWsrN2Ep7x6lWqOXfr4rpKGYrJhWc8z7\/view\"><strong>download it here<\/strong><\/a>.<\/p>\n<h3>Prerequisites<\/h3>\n<p>You\u2019ll need to install the following libraries with pip:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">pip install librosa soundfile numpy sklearn pyaudio<\/pre>\n<p>If you run into issues installing librosa with pip, you can try it with conda.<\/p>\n<h3>Steps for speech emotion recognition python projects<\/h3>\n<p>1. Make the necessary imports:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">import librosa\r\nimport soundfile\r\nimport os, glob, pickle\r\nimport numpy as np\r\nfrom sklearn.model_selection import train_test_split\r\nfrom sklearn.neural_network import MLPClassifier\r\nfrom sklearn.metrics import accuracy_score<\/pre>\n<p><strong>Screenshot:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/imports-data-python-machine-learning-project.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-69810\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/imports-data-python-machine-learning-project.png\" alt=\"python project - import data \" width=\"1365\" height=\"361\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/imports-data-python-machine-learning-project.png 1365w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/imports-data-python-machine-learning-project-150x40.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/imports-data-python-machine-learning-project-300x79.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/imports-data-python-machine-learning-project-768x203.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/imports-data-python-machine-learning-project-1024x271.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/imports-data-python-machine-learning-project-520x138.png 520w\" sizes=\"auto, (max-width: 1365px) 100vw, 1365px\" \/><\/a><\/p>\n<p>2. Define a function extract_feature to extract the mfcc, chroma, and mel features from a sound file. This function takes 4 parameters- the file name and three Boolean parameters for the three features:<\/p>\n<ul>\n<li><strong>mfcc:<\/strong> Mel Frequency Cepstral Coefficient, represents the short-term power spectrum of a sound<\/li>\n<li><strong>chroma:<\/strong> Pertains to the 12 different pitch classes<\/li>\n<li><strong>mel:<\/strong> Mel Spectrogram Frequency<\/li>\n<\/ul>\n<p><em><strong>Learn more about <a href=\"https:\/\/data-flair.training\/blogs\/python-set-and-booleans-with-examples\/\">Python Sets and Booleans<\/a><\/strong><\/em><\/p>\n<p>Open the sound file with soundfile.SoundFile using with-as so it\u2019s automatically closed once we\u2019re done. Read from it and call it X. Also, get the sample rate. If chroma is True, get the Short-Time Fourier Transform of X.<\/p>\n<p>Let result be an empty numpy array. Now, for each feature of the three, if it exists, make a call to the corresponding function from librosa.feature (eg- librosa.feature.mfcc for mfcc), and get the mean value. Call the function hstack() from numpy with result and the feature value, and store this in result. hstack() stacks arrays in sequence horizontally (in a columnar fashion). Then, return the result.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">#DataFlair - Extract features (mfcc, chroma, mel) from a sound file\r\ndef extract_feature(file_name, mfcc, chroma, mel):\r\n    with soundfile.SoundFile(file_name) as sound_file:\r\n        X = sound_file.read(dtype=\"float32\")\r\n        sample_rate=sound_file.samplerate\r\n        if chroma:\r\n            stft=np.abs(librosa.stft(X))\r\n        result=np.array([])\r\n        if mfcc:\r\n            mfccs=np.mean(librosa.feature.mfcc(y=X, sr=sample_rate, n_mfcc=40).T, axis=0)\r\n            result=np.hstack((result, mfccs))\r\n        if chroma:\r\n            chroma=np.mean(librosa.feature.chroma_stft(S=stft, sr=sample_rate).T,axis=0)\r\n            result=np.hstack((result, chroma))\r\nif mel:\r\n            mel=np.mean(librosa.feature.melspectrogram(X, sr=sample_rate).T,axis=0)\r\n            result=np.hstack((result, mel))\r\nreturn result<\/pre>\n<p><strong>Screenshot:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/extract-feature-python-project.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-69811\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/extract-feature-python-project.png\" alt=\"Python Speech Emotion recognition projection\" width=\"715\" height=\"331\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/extract-feature-python-project.png 715w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/extract-feature-python-project-150x69.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/extract-feature-python-project-300x139.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/extract-feature-python-project-520x241.png 520w\" sizes=\"auto, (max-width: 715px) 100vw, 715px\" \/><\/a><\/p>\n<p>3. Now, let\u2019s define a <em><strong><a href=\"https:\/\/data-flair.training\/blogs\/python-dictionary\/\">dictionary<\/a><\/strong><\/em> to hold numbers and the emotions available in the RAVDESS dataset, and a list to hold those we want- calm, happy, fearful, disgust.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">#DataFlair - Emotions in the RAVDESS dataset\r\nemotions={\r\n  '01':'neutral',\r\n  '02':'calm',\r\n  '03':'happy',\r\n  '04':'sad',\r\n  '05':'angry',\r\n  '06':'fearful',\r\n  '07':'disgust',\r\n  '08':'surprised'\r\n}\r\n\r\n#DataFlair - Emotions to observe\r\nobserved_emotions=['calm', 'happy', 'fearful', 'disgust']<\/pre>\n<p><strong>Screenshot:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/emotions.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-69813\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/emotions.png\" alt=\"Python project \" width=\"508\" height=\"260\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/emotions.png 508w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/emotions-150x77.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/emotions-300x154.png 300w\" sizes=\"auto, (max-width: 508px) 100vw, 508px\" \/><\/a><\/p>\n<p class=\"df-text-red df-text-bold\" style=\"text-align: center\">Facing Failure in Interview?<\/p>\n<p class=\"df-text-bold\" style=\"text-align: center\">Prepare with DataFlair &#8211; <a href=\"https:\/\/data-flair.training\/blogs\/top-python-interview-questions-answer\/\"><em><strong>Frequently Asked Python Interview Questions<\/strong><\/em><\/a><\/p>\n<p>4. Now, let\u2019s load the data with a function load_data() &#8211; this takes in the relative size of the test set as parameter. x and y are empty lists; we\u2019ll use the glob() function from the glob module to get all the pathnames for the sound files in our dataset. The pattern we use for this is: &#8220;D:\\\\DataFlair\\\\ravdess data\\\\Actor_*\\\\*.wav&#8221;. This is because our dataset looks like this:<\/p>\n<p><strong>Screenshot:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/dataset-simple-python-project.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-69814\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/dataset-simple-python-project.png\" alt=\"interesting Python Projects\" width=\"463\" height=\"569\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/dataset-simple-python-project.png 463w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/dataset-simple-python-project-122x150.png 122w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/dataset-simple-python-project-244x300.png 244w\" sizes=\"auto, (max-width: 463px) 100vw, 463px\" \/><\/a><\/p>\n<p>So, for each such path, get the basename of the file, the emotion by splitting the name around \u2018-\u2019 and extracting the third value:<\/p>\n<p><strong>Screenshot:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/dataset-2-interesting-python-projects.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-69815\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/dataset-2-interesting-python-projects.png\" alt=\"top python projects\" width=\"384\" height=\"204\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/dataset-2-interesting-python-projects.png 384w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/dataset-2-interesting-python-projects-150x80.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/dataset-2-interesting-python-projects-300x159.png 300w\" sizes=\"auto, (max-width: 384px) 100vw, 384px\" \/><\/a><\/p>\n<p>Using our emotions dictionary, this number is turned into an emotion, and our function checks whether this emotion is in our list of observed_emotions; if not, it continues to the next file. It makes a call to extract_feature and stores what is returned in \u2018feature\u2019. Then, it appends the feature to x and the emotion to y. So, the list x holds the features and y holds the emotions. We call the function train_test_split with these, the test size, and a random state value, and return that.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">#DataFlair - Load the data and extract features for each sound file\r\ndef load_data(test_size=0.2):\r\n    x,y=[],[]\r\n    for file in glob.glob(\"D:\\\\DataFlair\\\\ravdess data\\\\Actor_*\\\\*.wav\"):\r\n        file_name=os.path.basename(file)\r\n        emotion=emotions[file_name.split(\"-\")[2]]\r\n        if emotion not in observed_emotions:\r\n            continue\r\n        feature=extract_feature(file, mfcc=True, chroma=True, mel=True)\r\n        x.append(feature)\r\n        y.append(emotion)\r\n    return train_test_split(np.array(x), y, test_size=test_size, random_state=9)<\/pre>\n<p><strong>Screenshot:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/python-data-science-project-load-data.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-69817\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/python-data-science-project-load-data.png\" alt=\"python data science project\" width=\"636\" height=\"225\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/python-data-science-project-load-data.png 636w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/python-data-science-project-load-data-150x53.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/python-data-science-project-load-data-300x106.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/python-data-science-project-load-data-520x184.png 520w\" sizes=\"auto, (max-width: 636px) 100vw, 636px\" \/><\/a><\/p>\n<p>5. Time to split the dataset into training and testing sets! Let\u2019s keep the test set 25% of everything and use the load_data function for this.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">#DataFlair - Split the dataset\r\nx_train,x_test,y_train,y_test=load_data(test_size=0.25)<\/pre>\n<p><strong>Screenshot:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/split-speech-image-recognition-dataset.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-69819\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/split-speech-image-recognition-dataset.png\" alt=\"split speech image recognition dataset\" width=\"512\" height=\"54\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/split-speech-image-recognition-dataset.png 512w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/split-speech-image-recognition-dataset-150x16.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/split-speech-image-recognition-dataset-300x32.png 300w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>6. Observe the shape of the training and testing datasets:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">#DataFlair - Get the shape of the training and testing datasets\r\nprint((x_train.shape[0], x_test.shape[0]))<\/pre>\n<p><strong>Screenshot:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/get-shape.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-69820\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/get-shape.png\" alt=\"get shape - python project \" width=\"538\" height=\"83\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/get-shape.png 538w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/get-shape-150x23.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/get-shape-300x46.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/get-shape-520x80.png 520w\" sizes=\"auto, (max-width: 538px) 100vw, 538px\" \/><\/a><\/p>\n<p>7. And get the number of features extracted.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">#DataFlair - Get the number of features extracted\r\nprint(f'Features extracted: {x_train.shape[1]}')<\/pre>\n<p><strong>Output Screenshot:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/get-features.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-69824\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/get-features.png\" alt=\"Python project\" width=\"428\" height=\"83\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/get-features.png 428w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/get-features-150x29.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/get-features-300x58.png 300w\" sizes=\"auto, (max-width: 428px) 100vw, 428px\" \/><\/a><\/p>\n<p>8. Now, let\u2019s initialize an MLPClassifier. This is a Multi-layer Perceptron Classifier; it optimizes the log-loss function using LBFGS or stochastic gradient descent. Unlike SVM or <a href=\"https:\/\/data-flair.training\/blogs\/bayes-theorem-data-science\/\"><em><strong>Naive Bayes<\/strong><\/em><\/a>, the MLPClassifier has an internal neural network for the purpose of classification. This is a feedforward ANN model.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">#DataFlair - Initialize the Multi Layer Perceptron Classifier\r\nmodel=MLPClassifier(alpha=0.01, batch_size=256, epsilon=1e-08, hidden_layer_sizes=(300,), learning_rate='adaptive', max_iter=500)<\/pre>\n<p><strong>Screenshot:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/initialize-MLP-in-python-projects-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-69825\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/initialize-MLP-in-python-projects-1.png\" alt=\"initialize MLP in python projects\" width=\"987\" height=\"63\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/initialize-MLP-in-python-projects-1.png 987w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/initialize-MLP-in-python-projects-1-150x10.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/initialize-MLP-in-python-projects-1-300x19.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/initialize-MLP-in-python-projects-1-768x49.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/initialize-MLP-in-python-projects-1-980x63.png 980w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/initialize-MLP-in-python-projects-1-520x33.png 520w\" sizes=\"auto, (max-width: 987px) 100vw, 987px\" \/><\/a><\/p>\n<p>9. Fit\/train the model.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">#DataFlair - Train the model\r\nmodel.fit(x_train,y_train)<\/pre>\n<p><strong>Output Screenshot:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/train-model-simple-python-project.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-69827\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/train-model-simple-python-project.png\" alt=\"train model simple python project\" width=\"584\" height=\"195\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/train-model-simple-python-project.png 584w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/train-model-simple-python-project-150x50.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/train-model-simple-python-project-300x100.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/train-model-simple-python-project-520x174.png 520w\" sizes=\"auto, (max-width: 584px) 100vw, 584px\" \/><\/a><\/p>\n<p>10. Let\u2019s predict the values for the test set. This gives us y_pred (the predicted emotions for the features in the test set).<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">#DataFlair - Predict for the test set\r\ny_pred=model.predict(x_test)<\/pre>\n<p><strong>Screenshot:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/predict-simple-python-project.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-69828\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/predict-simple-python-project.png\" alt=\"predict- simple python project\" width=\"371\" height=\"54\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/predict-simple-python-project.png 371w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/predict-simple-python-project-150x22.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/predict-simple-python-project-300x44.png 300w\" sizes=\"auto, (max-width: 371px) 100vw, 371px\" \/><\/a><\/p>\n<p>11. To calculate the accuracy of our model, we\u2019ll call up the accuracy_score() function we imported from <a href=\"https:\/\/scikit-learn.org\/\">sklearn<\/a>. Finally, we\u2019ll round the accuracy to 2 decimal places and print it out.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">#DataFlair - Calculate the accuracy of our model\r\naccuracy=accuracy_score(y_true=y_test, y_pred=y_pred)\r\n\r\n#DataFlair - Print the accuracy\r\nprint(\"Accuracy: {:.2f}%\".format(accuracy*100))<\/pre>\n<p><strong>Output Screenshot:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/accuracy.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-69852\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/accuracy.png\" alt=\"python data science project\" width=\"462\" height=\"193\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/accuracy.png 462w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/accuracy-150x63.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/accuracy-300x125.png 300w\" sizes=\"auto, (max-width: 462px) 100vw, 462px\" \/><\/a><\/p>\n<h3>Summary<\/h3>\n<p>Humans express emotions in their voice\u2014like happy, sad, angry, or calm. A machine learning project can listen to voice recordings and tell the emotion behind them. This is called Speech Emotion Recognition (SER). Using Python and a library called librosa, we can analyze sound waves and extract features from speech to detect emotions. This project is useful for call centers, chatbots, and even smart assistants.<\/p>\n<p>In this Python mini project, we learned to recognize emotions from speech. We used an MLPClassifier for this and made use of the soundfile library to read the sound file, and the librosa library to extract features from it. As you\u2019ll see, the model delivered an accuracy of 72.4%. That\u2019s good enough for us yet.<\/p>\n<p>Hope you enjoyed the mini python project.<\/p>\n<p class=\"df-text-red df-text-bold\" style=\"text-align: center\">Want to become next Python Developer??<\/p>\n<p class=\"df-text-bold\" style=\"text-align: center\">Enroll for <a href=\"https:\/\/techvidvan.com\/python-course-multilingual\/\">Best Online Python Course<\/a> NOW!!<\/p>\n<p><em><strong>Reference &#8211; <\/strong><\/em><a href=\"https:\/\/zenodo.org\/record\/1188976#.XYHHn3WFPM1\">Zenodo<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Speech emotion recognition, the best ever python mini project. The best example of it can be seen at call centers. If you ever noticed, call centers employees never talk in the same manner, their&#46;&#46;&#46;<\/p>\n","protected":false},"author":6,"featured_media":69883,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[36],"tags":[21067,21066,21081,21073,21072,21074],"class_list":["post-69745","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-machine-learning","tag-python-data-science-projects","tag-python-machine-learning-projects","tag-python-mini-project","tag-python-projects","tag-simple-python-project","tag-speech-emotion-recognition"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Python Mini Project - Speech Emotion Recognition with librosa - DataFlair<\/title>\n<meta name=\"description\" content=\"Python mini project of speech emotion recognition with librosa helps to revise important python data science concepts &amp; boost confidence for interviews\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/python-mini-project-speech-emotion-recognition\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python Mini Project - Speech Emotion Recognition with librosa - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Python mini project of speech emotion recognition with librosa helps to revise important python data science concepts &amp; boost confidence for interviews\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/python-mini-project-speech-emotion-recognition\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2019-09-17T06:07:40+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-07-29T13:01:10+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/python-mini-project-speech-emotion-recognition.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"802\" \/>\n\t<meta property=\"og:image:height\" content=\"420\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python Mini Project - Speech Emotion Recognition with librosa - DataFlair","description":"Python mini project of speech emotion recognition with librosa helps to revise important python data science concepts & boost confidence for interviews","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/python-mini-project-speech-emotion-recognition\/","og_locale":"en_US","og_type":"article","og_title":"Python Mini Project - Speech Emotion Recognition with librosa - DataFlair","og_description":"Python mini project of speech emotion recognition with librosa helps to revise important python data science concepts & boost confidence for interviews","og_url":"https:\/\/data-flair.training\/blogs\/python-mini-project-speech-emotion-recognition\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2019-09-17T06:07:40+00:00","article_modified_time":"2025-07-29T13:01:10+00:00","og_image":[{"width":802,"height":420,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/python-mini-project-speech-emotion-recognition.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/python-mini-project-speech-emotion-recognition\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/python-mini-project-speech-emotion-recognition\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/2c58ecb4f73a39f0ef993f1ddfcd7b89"},"headline":"Python Mini Project &#8211; Speech Emotion Recognition with librosa","datePublished":"2019-09-17T06:07:40+00:00","dateModified":"2025-07-29T13:01:10+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/python-mini-project-speech-emotion-recognition\/"},"wordCount":1349,"commentCount":167,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/python-mini-project-speech-emotion-recognition\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/python-mini-project-speech-emotion-recognition.jpg","keywords":["Python data science projects","python machine learning projects","Python mini project","Python Projects","Simple Python project","speech emotion recognition"],"articleSection":["Machine Learning Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/python-mini-project-speech-emotion-recognition\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/python-mini-project-speech-emotion-recognition\/","url":"https:\/\/data-flair.training\/blogs\/python-mini-project-speech-emotion-recognition\/","name":"Python Mini Project - Speech Emotion Recognition with librosa - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/python-mini-project-speech-emotion-recognition\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/python-mini-project-speech-emotion-recognition\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/python-mini-project-speech-emotion-recognition.jpg","datePublished":"2019-09-17T06:07:40+00:00","dateModified":"2025-07-29T13:01:10+00:00","description":"Python mini project of speech emotion recognition with librosa helps to revise important python data science concepts & boost confidence for interviews","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/python-mini-project-speech-emotion-recognition\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/python-mini-project-speech-emotion-recognition\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/python-mini-project-speech-emotion-recognition\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/python-mini-project-speech-emotion-recognition.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/python-mini-project-speech-emotion-recognition.jpg","width":802,"height":420,"caption":"Python project - speech emotion recognition"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/python-mini-project-speech-emotion-recognition\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Machine Learning Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/machine-learning\/"},{"@type":"ListItem","position":3,"name":"Python Mini Project &#8211; Speech Emotion Recognition with librosa"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/2c58ecb4f73a39f0ef993f1ddfcd7b89","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"The DataFlair Team provides industry-driven content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our expert educators focus on delivering value-packed, easy-to-follow resources for tech enthusiasts and professionals.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam2\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/69745","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=69745"}],"version-history":[{"count":28,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/69745\/revisions"}],"predecessor-version":[{"id":146320,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/69745\/revisions\/146320"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/69883"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=69745"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=69745"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=69745"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}