{"id":343578,"date":"2023-01-06T15:03:06","date_gmt":"2023-01-06T15:03:06","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=343578"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=343578","title":{"rendered":"<span>\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043c\u0443\u0437\u044b\u043a\u0438 \u0438\u0437 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Python<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\"><a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/708890\/\"><\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/fb\/cw\/ek\/fbcwekpnjhxtaumdjuk1vp_b1pq.png\" data-src=\"https:\/\/habrastorage.org\/webt\/fb\/cw\/ek\/fbcwekpnjhxtaumdjuk1vp_b1pq.png\"\/><\/div>\n<p><\/a><br \/>  \u0421\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u043c\u0443\u0437\u044b\u043a\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0430\u0441\u0442\u044c\u044e \u043c\u043e\u0435\u0439 \u0436\u0438\u0437\u043d\u0438, \u0431\u0443\u0434\u0435\u0442 \u0441\u0435\u0440\u044c\u0451\u0437\u043d\u044b\u043c \u043f\u0440\u0435\u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u0435\u043c. \u042f \u0431\u043e\u043b\u0435\u0435 20 \u043b\u0435\u0442 \u0438\u0433\u0440\u0430\u044e \u043d\u0430 \u0433\u0438\u0442\u0430\u0440\u0435, \u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u0434\u0435\u043d\u044c \u0441\u043b\u0443\u0448\u0430\u044e \u0434\u0440\u0443\u0433\u0438\u0445 \u0433\u0438\u0442\u0430\u0440\u0438\u0441\u0442\u043e\u0432. \u041f\u043e \u043f\u0440\u0430\u0432\u0434\u0435 \u0433\u043e\u0432\u043e\u0440\u044f, \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043d\u0430\u0447\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0430\u043a\u0430\u0434\u0435\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0443\u0442\u044c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0444\u0438\u0437\u0445\u0438\u043c\u0438\u043a\u0430 \u0434\u0432\u0435\u043d\u0430\u0434\u0446\u0430\u0442\u044c \u043b\u0435\u0442 \u043d\u0430\u0437\u0430\u0434, \u044f \u0431\u044b\u043b \u043d\u0430\u043c\u0435\u0440\u0435\u043d \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043c\u0443\u0437\u044b\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u043a\u0430\u0440\u044c\u0435\u0440\u0443.<\/p>\n<p>  \u0418 \u0445\u043e\u0442\u044f \u044d\u0442\u0438\u043c \u043c\u043e\u0438\u043c \u043f\u043b\u0430\u043d\u0430\u043c \u043d\u0443 \u0431\u044b\u043b\u043e \u0441\u0443\u0436\u0434\u0435\u043d\u043e \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0438\u0442\u044c\u0441\u044f, \u044f \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u044e \u043d\u0430\u0441\u043b\u0430\u0436\u0434\u0430\u0442\u044c\u0441\u044f \u043c\u0443\u0437\u044b\u043a\u043e\u0439 \u0438 \u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u0435\u0451 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u0441\u044f\u043a\u0438\u0435 \u043a\u0440\u0443\u0442\u044b\u0435 \u0448\u0442\u0443\u043a\u0438. \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0435\u043a\u0442 \u0432\u043e\u0437\u043d\u0438\u043a \u0438\u0437 \u0438\u0434\u0435\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b\u0430 \u043c\u0443\u0437\u044b\u043a\u0443 \u0438\u0437 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439. \u0412 \u043f\u0440\u043e\u0448\u043b\u043e\u043c \u0443\u0436\u0435 \u0431\u044b\u043b\u0438 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u043f\u043e\u043f\u044b\u0442\u043a\u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435\u0447\u0442\u043e \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0435, \u043d\u043e \u0432\u043e\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u043b\u0438\u0441\u044c \u043d\u0435 \u043e\u0441\u043e\u0431\u043e \u043c\u0443\u0437\u044b\u043a\u0430\u043b\u044c\u043d\u044b\u043c\u0438.<\/p>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e \u0441\u0432\u043e\u0451\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0435 \u043a \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0438\u0437 \u043a\u0430\u0440\u0442\u0438\u043d\u043e\u043a \u0430\u0443\u0434\u0438\u043e\u0442\u0440\u0435\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435, \u0438\u043c\u0445\u043e, \u0437\u0432\u0443\u0447\u0430\u0442 \u0432\u0435\u0441\u044c\u043c\u0430 \u043d\u0435\u043f\u043b\u043e\u0445\u043e. \u0417\u0434\u0435\u0441\u044c \u044f \u043e\u043f\u0438\u0448\u0443 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0438 \u043f\u043e\u043a\u0430\u0436\u0443 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u0434\u0430\u0447\u043d\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b. \u0415\u0441\u043b\u0438 \u0432\u044b \u0437\u0430\u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432\u0435\u0441\u044c \u043a\u043e\u0434, \u0442\u043e \u043e\u043d \u043b\u0435\u0436\u0438\u0442 \u043d\u0430 \u043c\u043e\u0451\u043c <a href=\"https:\/\/victormurcia.github.io\/Making-Music-From-Images-in-Python\/\">\u0441\u0430\u0439\u0442\u0435<\/a> \u0438 \u0432 <a href=\"https:\/\/github.com\/victormurcia\/Making-Music-From-Images\">\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 GitHub<\/a>. \u042f \u0442\u0430\u043a\u0436\u0435 \u0441\u043e\u0437\u0434\u0430\u043b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Streamlit \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/victormurcia-making-music-from-images-music-to-images-ce4ydi.streamlitapp.com\/\">\u0437\u0434\u0435\u0441\u044c<\/a>.<a name=\"habracut\"><\/a><\/p>\n<h2><font color=\"#3AC1EF\">\u258d \u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0438\u0434\u0435\u044f<\/font><\/h2>\n<p>  \u0412\u043e\u0442 \u043c\u043e\u044f \u0446\u0435\u043f\u043e\u0447\u043a\u0430 \u0440\u0430\u0441\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u0439:<\/p>\n<ul>\n<li>\u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u0442 \u0438\u0437 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439;<\/li>\n<li>\u043f\u0438\u043a\u0441\u0435\u043b\u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u0442 \u0438\u0437 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u0447\u0438\u0441\u0435\u043b, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0449\u0438\u0445 \u0446\u0432\u0435\u0442;<\/li>\n<li>\u0446\u0432\u0435\u0442 \u0432\u044b\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u0446\u0432\u0435\u0442\u043e\u0432\u044b\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 RGB, BGR \u043b\u0438\u0431\u043e HSV;<\/li>\n<li>\u0441\u0430\u043c\u043e \u0446\u0432\u0435\u0442\u043e\u0432\u043e\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0437\u0431\u0438\u0442\u044c \u043d\u0430 \u0440\u0430\u0437\u0434\u0435\u043b\u044b;<\/li>\n<li>\u043c\u0443\u0437\u044b\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0433\u0430\u043c\u043c\u044b \u0447\u0435\u0440\u0435\u0437 \u0437\u0432\u0443\u043a\u043e\u0432\u044b\u0435 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u044b \u043f\u043e\u0434\u0440\u0430\u0437\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u043d\u0430 \u043d\u043e\u0442\u044b;<\/li>\n<li>\u0437\u0432\u0443\u043a \u2013 \u044d\u0442\u043e \u0432\u0438\u0431\u0440\u0430\u0446\u0438\u044f, \u0432 \u0441\u0432\u044f\u0437\u0438 \u0441 \u0447\u0435\u043c \u043a\u0430\u0436\u0434\u0430\u044f \u043d\u043e\u0442\u0430 \u0430\u0441\u0441\u043e\u0446\u0438\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0441 \u0447\u0430\u0441\u0442\u043e\u0442\u043e\u0439;<\/li>\n<li>\u0438\u0437 \u0432\u0441\u0435\u0433\u043e \u044d\u0442\u043e\u0433\u043e \u0441\u043b\u0435\u0434\u0443\u0435\u0442, \u0447\u0442\u043e \u043f\u043e\u0434\u0440\u0430\u0437\u0434\u0435\u043b\u044b \u0446\u0432\u0435\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0441 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u043c\u0438 \u043d\u043e\u0442\u0430\u043c\u0438 \u0432 \u043c\u0443\u0437\u044b\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0433\u0430\u043c\u043c\u0435, \u0438\u043c\u0435\u044e\u0449\u0438\u043c\u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u0447\u0430\u0441\u0442\u043e\u0442\u0443.<\/li>\n<\/ul>\n<p>  \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c!<\/p>\n<h2><font color=\"#3AC1EF\">\u258d \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0446\u0432\u0435\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 HSV<\/font><\/h2>\n<p>  HSV \u0438\u043b\u0438 HSB \u2013 \u044d\u0442\u043e \u0446\u0432\u0435\u0442\u043e\u0432\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c, \u0440\u0435\u0433\u0443\u043b\u0438\u0440\u0443\u0435\u043c\u0430\u044f \u0442\u0440\u0435\u043c\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u2013 \u0442\u043e\u043d\u043e\u043c, \u043d\u0430\u0441\u044b\u0449\u0435\u043d\u043d\u043e\u0441\u0442\u044c\u044e \u0438 \u044f\u0440\u043a\u043e\u0441\u0442\u044c\u044e.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/yn\/qc\/0m\/ynqc0mh2vwhab1awa-a-monovke.png\" data-src=\"https:\/\/habrastorage.org\/webt\/yn\/qc\/0m\/ynqc0mh2vwhab1awa-a-monovke.png\"\/><br \/>  <i><font color=\"#999999\">\u0426\u0438\u043b\u0438\u043d\u0434\u0440 HSV<\/font><\/i><\/p>\n<p>  <i>\u0422\u043e\u043d<\/i> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u00ab\u0441\u0442\u0435\u043f\u0435\u043d\u044c\u044e, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u0442\u0438\u043c\u0443\u043b \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u0445\u043e\u0436\u0438\u043c \u0438\u043b\u0438 \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0449\u0438\u043c\u0441\u044f \u043e\u0442 \u0441\u0442\u0438\u043c\u0443\u043b\u043e\u0432, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c\u044b\u0445 \u043a\u0430\u043a \u043a\u0440\u0430\u0441\u043d\u044b\u0439, \u043e\u0440\u0430\u043d\u0436\u0435\u0432\u044b\u0439, \u0436\u0451\u043b\u0442\u044b\u0439, \u0437\u0435\u043b\u0451\u043d\u044b\u0439, \u0441\u0438\u043d\u0438\u0439, \u0444\u0438\u043e\u043b\u0435\u0442\u043e\u0432\u044b\u0439\u00bb. \u0418\u043d\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u0442\u043e\u043d \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0446\u0432\u0435\u0442.<\/p>\n<p>  <i>\u041d\u0430\u0441\u044b\u0449\u0435\u043d\u043d\u043e\u0441\u0442\u044c<\/i> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u00ab\u0446\u0432\u0435\u0442\u043d\u043e\u0441\u0442\u044c \u043e\u0431\u043b\u0430\u0441\u0442\u0438, \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u0435\u043c\u0430\u044f \u043f\u0440\u043e\u043f\u043e\u0440\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e \u0435\u0451 \u044f\u0440\u043a\u043e\u0441\u0442\u0438\u00bb. \u0422\u043e \u0435\u0441\u0442\u044c \u043d\u0430\u0441\u044b\u0449\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u043e\u0442\u0440\u0430\u0436\u0430\u0435\u0442 \u0441\u0442\u0435\u043f\u0435\u043d\u044c, \u0434\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0446\u0432\u0435\u0442 \u0441\u043c\u0435\u0448\u0430\u043d \u0441 \u0431\u0435\u043b\u044b\u043c.<\/p>\n<p>  <i>\u042f\u0440\u043a\u043e\u0441\u0442\u044c<\/i> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u00ab\u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u043e\u0431\u0443\u0441\u043b\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0435 \u0441\u0442\u0435\u043f\u0435\u043d\u044c\u044e \u0435\u0433\u043e \u043e\u0441\u0432\u0435\u0449\u0451\u043d\u043d\u043e\u0441\u0442\u0438\u00bb. \u0418\u043d\u0430\u0447\u0435 \u0433\u043e\u0432\u043e\u0440\u044f, \u044f\u0440\u043a\u043e\u0441\u0442\u044c \u043e\u0442\u0440\u0430\u0436\u0430\u0435\u0442 \u0441\u0442\u0435\u043f\u0435\u043d\u044c, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0446\u0432\u0435\u0442 \u0441\u043c\u0435\u0448\u0430\u043d \u0441 \u0447\u0451\u0440\u043d\u044b\u043c.<\/p>\n<p>  \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0442\u043e\u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0446\u0432\u0435\u0442\u043e\u0432:<\/p>\n<ul>\n<li>\u043e\u0440\u0430\u043d\u0436\u0435\u0432\u044b\u0439: 0\u201344<\/li>\n<li>\u0436\u0451\u043b\u0442\u044b\u0439: 44- 76<\/li>\n<li>\u0437\u0435\u043b\u0451\u043d\u044b\u0439: 76\u2013150<\/li>\n<li>\u0441\u0438\u043d\u0438\u0439: 150\u2013260<\/li>\n<li>\u0444\u0438\u043e\u043b\u0435\u0442\u043e\u0432\u044b\u0439: 260\u2013320<\/li>\n<li>\u043a\u0440\u0430\u0441\u043d\u044b\u0439: 320\u2013360<\/li>\n<\/ul>\n<p>  \u042f \u0431\u0443\u0434\u0443 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 \u0446\u0432\u0435\u0442\u043e\u0432\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 HSV, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d\u043e \u0443\u0436\u0435 \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u043e, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441 \u0447\u0430\u0441\u0442\u043e\u0442\u0430\u043c\u0438 \u0431\u043e\u043b\u0435\u0435 \u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u044b\u043c. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043a\u0430\u043d\u0430\u043b \u0442\u043e\u043d\u0430 (\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432 \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0446\u0432\u0435\u0442 \u0432 \u044d\u0442\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438) \u043e\u0442\u0434\u0435\u043b\u0451\u043d \u043e\u0442 \u0434\u0432\u0443\u0445 \u0434\u0440\u0443\u0433\u0438\u0445 \u043a\u0430\u043d\u0430\u043b\u043e\u0432, \u0447\u0442\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432\u0441\u0451 \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442.<\/p>\n<p>  \u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0446\u0432\u0435\u0442\u043e\u0432\u044b\u0445 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438 \u043a\u043e\u0434 \u0434\u043b\u044f \u0438\u0445 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438:<\/p>\n<pre><code class=\"python\"># \u043d\u0443\u0436\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u044e\u0449\u0430\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0442\u043e\u043d\u0430 \u043f\u0438\u043a\u0441\u0435\u043b\u044f hsv = cv2.cvtColor(ori_img, cv2.COLOR_BGR2HSV) # \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f fig, axs = plt.subplots(1, 3, figsize = (15,15)) names = ['BGR','RGB','HSV'] imgs  = [ori_img, img, hsv] i = 0 for elem in imgs:     axs[i].title.set_text(names[i])     axs[i].imshow(elem)     axs[i].grid(False)     i += 1 plt.show()<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/mc\/tu\/qd\/mctuqd1j4p9ihuxshycsakaaigo.png\" data-src=\"https:\/\/habrastorage.org\/webt\/mc\/tu\/qd\/mctuqd1j4p9ihuxshycsakaaigo.png\"\/><br \/>  <i><font color=\"#999999\">\u0426\u0432\u0435\u0442\u043e\u0432\u044b\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430. \u0410\u0432\u0442\u043e\u0440 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f RGB \u2014 <a href=\"https:\/\/stock.adobe.com\/contributor\/201652684\/agsandrew?load_type=author&amp;prev_url=detail\">agsandrew<\/a><\/font><\/i><\/p>\n<h2><font color=\"#3AC1EF\">\u258d \u0418\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u0435 \u043a\u0430\u043d\u0430\u043b\u0430 \u0442\u043e\u043d\u0430<\/font><\/h2>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0438\u0432 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432 HSV, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0442\u043e\u043d\u0430 (h) \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0438\u043a\u0441\u0435\u043b\u044f. \u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 <code>for<\/code>, \u043f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u044e\u0449\u0435\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043f\u043e \u0432\u044b\u0441\u043e\u0442\u0435 \u0438 \u0448\u0438\u0440\u0438\u043d\u0435.<\/p>\n<pre><code class=\"python\">i=0 ; j=0 # \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0433\u043e \u0442\u043e\u043d \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0438\u043a\u0441\u0435\u043b\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f hues = [] for i in range(height):     for j in range(width):         hue = hsv[i][j][0] # \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0442\u043e\u043d\u0430 \u043f\u0438\u043a\u0441\u0435\u043b\u044f \u043f\u043e \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c (i,j)         hues.append(hue)<\/code><\/pre>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0438\u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 <code>h<\/code> \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439, \u044f \u043f\u043e\u043c\u0435\u0449\u0430\u044e \u0435\u0433\u043e \u0432 \u0434\u0430\u0442\u0430\u0444\u0440\u0435\u0439\u043c Pandas.<\/p>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u0434\u0430\u0442\u0430\u0444\u0440\u0435\u0439\u043c\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f \u043d\u0430\u0437\u0432\u0430\u043b <code>pixels_df<\/code>, \u0441\u043b\u0435\u0432\u0430 \u0443\u043a\u0430\u0437\u0430\u043d \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u043f\u0438\u043a\u0441\u0435\u043b\u044f, \u0430 \u0441\u043f\u0440\u0430\u0432\u0430 \u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0442\u043e\u043d\u0430.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/6t\/mb\/y2\/6tmby2gouevihmxwbvw8dtqjkvi.png\" data-src=\"https:\/\/habrastorage.org\/webt\/6t\/mb\/y2\/6tmby2gouevihmxwbvw8dtqjkvi.png\"\/><br \/>  <i><font color=\"#999999\">\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 <code>pixels_df<\/code> \u0438\u0437 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 h \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f<\/font><\/i><\/p>\n<p>  \u0421\u0435\u0439\u0447\u0430\u0441 \u0434\u0430\u0442\u0430\u0444\u0440\u0435\u0439\u043c \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u0441\u0442\u043e\u043b\u0431\u0446\u0430 <code>hues<\/code>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043a\u0430\u0436\u0434\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043a\u0430\u043d\u0430\u043b <code>h<\/code> \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0438\u043a\u0441\u0435\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f.<\/p>\n<h2><font color=\"#3AC1EF\">\u258d \u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u043e\u043d\u043e\u0432 \u0432 \u0447\u0430\u0441\u0442\u043e\u0442\u044b<\/font><\/h2>\n<p>  \u041c\u043e\u0439 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0439 \u0437\u0430\u043c\u044b\u0441\u0435\u043b \u043f\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0442\u043e\u043d\u0430 \u0432 \u0447\u0430\u0441\u0442\u043e\u0442\u0443 \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u043b \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u0435\u0434\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u0447\u0430\u0441\u0442\u043e\u0442 \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c <code>h<\/code>. \u0412\u043e\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f:<\/p>\n<pre><code class=\"python\"># \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0447\u0430\u0441\u0442\u043e\u0442, \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0445 \u0433\u0430\u043c\u043c\u0443 \u043b\u044f \u043c\u0438\u043d\u043e\u0440 \u0433\u0430\u0440\u043c\u043e\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0439 scale_freqs = [220.00, 246.94 ,261.63, 293.66, 329.63, 349.23, 415.30] def hue2freq(h,scale_freqs):     thresholds = [26 , 52 , 78 , 104,  128 , 154 , 180]     note = scale_freqs[0]     if (h &lt;= thresholds[0]):          note = scale_freqs[0]     elif (h > thresholds[0]) &amp; (h &lt;= thresholds[1]):         note = scale_freqs[1]     elif (h > thresholds[1]) &amp; (h &lt;= thresholds[2]):         note = scale_freqs[2]     elif (h > thresholds[2]) &amp; (h &lt;= thresholds[3]):         note = scale_freqs[3]     elif (h > thresholds[3]) &amp; (h &lt;= thresholds[4]):             note = scale_freqs[4]     elif (h > thresholds[4]) &amp; (h &lt;= thresholds[5]):         note = scale_freqs[5]     elif (h > thresholds[5]) &amp; (h &lt;= thresholds[6]):         note = scale_freqs[6]     else:         note = scale_freqs[0]          return note<\/code><\/pre>\n<p>  \u041e\u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>h<\/code> \u0438 \u043c\u0430\u0441\u0441\u0438\u0432 \u0447\u0430\u0441\u0442\u043e\u0442. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0447\u0430\u0441\u0442\u043e\u0442 \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u0442\u0441\u044f \u043c\u0430\u0441\u0441\u0438\u0432 <code>scale_freqs.<\/code> \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u0432 \u044d\u0442\u043e\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u0447\u0430\u0441\u0442\u043e\u0442\u044b \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u0433\u0430\u043c\u043c\u0435 \u043b\u044f \u043c\u0438\u043d\u043e\u0440 \u0433\u0430\u0440\u043c\u043e\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0439.<\/p>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e \u043c\u0430\u0441\u0441\u0438\u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043f\u043e\u0440\u043e\u0433\u0430 <code>thresholds<\/code> \u0434\u043b\u044f <code>h<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f <code>h<\/code> \u0432 \u0447\u0430\u0441\u0442\u043e\u0442\u0443 \u0438\u0437 <code>scale_freqs<\/code> \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043b\u044f\u043c\u0431\u0434\u0430-\u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<pre><code class=\"python\">pixels_df['notes'] = pixels_df.apply(lambda row : hue2freq(row['hues'],scale_freqs), axis = 1) <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/fj\/bb\/sj\/fjbbsjoouwqy9aytst-uzhzxms0.png\" data-src=\"https:\/\/habrastorage.org\/webt\/fj\/bb\/sj\/fjbbsjoouwqy9aytst-uzhzxms0.png\"\/><br \/>  <i><font color=\"#999999\">\u0414\u0430\u0442\u0430\u0444\u0440\u0435\u0439\u043c <code>pixels_df<\/code>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0447\u0430\u0441\u0442\u043e\u0442\u044b \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u0441 \u043a\u0430\u0436\u0434\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u0442\u043e\u043d\u0430<\/font><\/i><\/p>\n<h2><font color=\"#3AC1EF\">\u258d \u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 NumPy \u0432 \u0430\u0443\u0434\u0438\u043e<\/font><\/h2>\n<p>  \u041a\u0440\u0443\u0442\u043e! \u0422\u0435\u043f\u0435\u0440\u044c, \u0438\u043c\u0435\u044f \u043c\u0430\u0441\u0441\u0438\u0432 \u0447\u0430\u0441\u0442\u043e\u0442, \u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u044e \u0441\u0442\u043e\u043b\u0431\u0435\u0446 <code>notes<\/code> \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 NumPy <code>frequencies<\/code>, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0441\u043c\u043e\u0433\u0443 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0430\u0443\u0434\u0438\u043e. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e SciPy \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>wavfile.write<\/code> \u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u0432\u0438\u0434 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0442\u0438\u043f\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 (\u0434\u043b\u044f \u043e\u0434\u043d\u043e\u043c\u0435\u0440\u043d\u044b\u0445 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u044d\u0442\u043e <code>np.float32<\/code>).<\/p>\n<pre><code class=\"python\">frequencies = pixels_df['notes'].to_numpy()  song = np.array([]) sr = 22050 # \u0447\u0430\u0441\u0442\u043e\u0442\u0430 \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u0438\u0437\u0430\u0446\u0438\u0438 T = 0.1    # \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c 0.1 \u0441\u0435\u043a\u0443\u043d\u0434\u044b t = np.linspace(0, T, int(T*sr), endpoint=False) # \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u0438 #\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0442\u0440\u0435\u043a\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 NumPy :] #nPixels = int(len(frequencies))# \u0432\u0441\u0435 \u043f\u0438\u043a\u0441\u0435\u043b\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f nPixels = 60 for i in range(nPixels):       val = frequencies[i]     note  = 0.5*np.sin(2*np.pi*val*t) # \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043a\u0430\u0436\u0434\u0443\u044e \u043d\u043e\u0442\u0443 \u0432 \u0432\u0438\u0434\u0435 \u0441\u0438\u043d\u0443\u0441\u043e\u0438\u0434\u044b     song  = np.concatenate([song, note]) # \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u043e\u0442\u044b \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 song \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0442\u0440\u0435\u043a\u0430      ipd.Audio(song, rate=sr) # \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 NumPy \u0432 \u0432\u0438\u0434\u0435 \u0430\u0443\u0434\u0438\u043e<\/code><\/pre>\n<p>  \u0412\u043e\u0442 \u0442\u0440\u0435\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f \u0441\u043e\u0437\u0434\u0430\u043b, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043f\u0435\u0440\u0432\u044b\u0435 60 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u0438\u0436\u0435. \u041c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 230,400 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439, \u043d\u043e \u0442\u043e\u0433\u0434\u0430 \u0442\u0440\u0435\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0431\u044b \u0434\u043b\u0438\u043d\u043e\u0439 \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0447\u0430\u0441\u043e\u0432.<\/p>\n<div class=\"oembed\">\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/63b295c13afabae0664b1a42\" data-style=\"\" id=\"63b295c13afabae0664b1a42\" width=\"\"><\/div>\n<\/div>\n<p>  \u0417\u0432\u0443\u0447\u0438\u0442 \u0432\u0435\u0441\u044c\u043c\u0430 \u043d\u0435\u0434\u0443\u0440\u043d\u043e, \u043d\u043e \u043c\u043d\u0435 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0435\u0449\u0451 \u043d\u0430\u0434 \u044d\u0442\u0438\u043c \u043f\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c.<\/p>\n<h2><font color=\"#3AC1EF\">\u258d \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432\u0430\u0440\u0438\u0430\u0446\u0438\u0438 \u043f\u043e \u043e\u043a\u0442\u0430\u0432\u0430\u043c<\/font><\/h2>\n<p>  \u042f \u0440\u0435\u0448\u0438\u043b \u0432\u043d\u0435\u0441\u0442\u0438 \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u044d\u0444\u0444\u0435\u043a\u0442 \u0441\u0434\u0432\u0438\u0433\u0430 \u043e\u043a\u0442\u0430\u0432 (\u0442\u043e \u0435\u0441\u0442\u044c \u043f\u043e\u043d\u0438\u0436\u0435\u043d\u0438\u0435 \u0438\u043b\u0438 \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u0435 \u0437\u0432\u0443\u043a\u0430). \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0430\u044f \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u043d\u043e\u0442\u044b \u043e\u043a\u0442\u0430\u0432\u0430 \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u0438\u0437 \u043c\u0430\u0441\u0441\u0438\u0432\u0430.<\/p>\n<pre><code class=\"python\">song = np.array([]) octaves = np.array([0.5,1,2]) sr = 22050 # \u0447\u0430\u0441\u0442\u043e\u0442\u0430 \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u0438\u0437\u0430\u0446\u0438\u0438 T = 0.1    # \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c 0.1 \u0441\u0435\u043a\u0443\u043d\u0434\u044b t = np.linspace(0, T, int(T*sr), endpoint=False) # \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u0438 # \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0442\u0440\u0435\u043a\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 NumPy :] #nPixels = int(len(frequencies))# \u0432\u0441\u0435 \u043f\u0438\u043a\u0441\u0435\u043b\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f nPixels = 60 for i in range(nPixels):     octave = random.choice(octaves)     val =  octave * frequencies[i]     note  = 0.5*np.sin(2*np.pi*val*t)     song  = np.concatenate([song, note]) ipd.Audio(song, rate=sr) # \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 NumPy<\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0443\u0448\u0430\u0435\u043c!<\/p>\n<div class=\"oembed\">\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/63b2b7a7200df56fc17b6504\" data-style=\"\" id=\"63b2b7a7200df56fc17b6504\" width=\"\"><\/div>\n<\/div>\n<p>  \u041f\u0440\u0435\u0432\u043e\u0441\u0445\u043e\u0434\u043d\u043e! \u041c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0440\u0430\u0437\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u0438\u0435. \u041d\u043e \u0432\u0441\u0435 \u0436\u0435 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439, \u0442\u0430\u043a \u043f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u0445 \u043f\u0443\u0442\u0451\u043c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e \u0432\u044b\u0431\u043e\u0440\u0430?<\/p>\n<pre><code class=\"python\">song = np.array([]) octaves = np.array([1\/2,1,2]) sr = 22050 # \u0447\u0430\u0441\u0442\u043e\u0442\u0430 \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u0438\u0437\u0430\u0446\u0438\u0438 T = 0.1    # \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c 0.1 \u0441\u0435\u043a\u0443\u043d\u0434\u044b t = np.linspace(0, T, int(T*sr), endpoint=False) # \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u0438 # \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0442\u0440\u0435\u043a\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 NumPy :] #nPixels = int(len(frequencies))# \u0432\u0441\u0435 \u043f\u0438\u043a\u0441\u0435\u043b\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f nPixels = 60 for i in range(nPixels):     octave = random.choice(octaves)     val =  octave * random.choice(frequencies)     note  = 0.5*np.sin(2*np.pi*val*t)     song  = np.concatenate([song, note]) ipd.Audio(song, rate=sr) # \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 NumPy<\/code><\/pre>\n<p>  <\/p>\n<div class=\"oembed\">\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/63b2b7a761f0ac6fb2477297\" data-style=\"\" id=\"63b2b7a761f0ac6fb2477297\" width=\"\"><\/div>\n<\/div>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0442\u0438\u043f\u0430 Calcucore! \u0422\u0435\u043f\u0435\u0440\u044c \u0443 \u043d\u0430\u0441, \u043f\u043e \u0441\u0443\u0442\u0438, \u0435\u0441\u0442\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0442\u0440\u0435\u043a\u043e\u0432, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043c\u043e\u0436\u043d\u043e \u0432\u0434\u043e\u0432\u043e\u043b\u044c \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/p>\n<p>  \u042f \u043f\u043e\u043d\u0438\u043c\u0430\u044e, \u043f\u0440\u043e\u0437\u0432\u0443\u0447\u0438\u0442 \u043f\u043e\u0447\u0442\u0438 \u043a\u0430\u043a \u043c\u0435\u043c, \u043d\u043e \u00ab\u0440\u0430\u0437\u0432\u0435 \u044d\u0442\u043e \u043d\u0435 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0440\u043e\u043a?\u00bb<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/_n\/8i\/ok\/_n8iokbk7iieyb4ec-nsy8pz3_8.png\" data-src=\"https:\/\/habrastorage.org\/webt\/_n\/8i\/ok\/_n8iokbk7iieyb4ec-nsy8pz3_8.png\"\/><\/div>\n<p>  <\/p>\n<h2><font color=\"#3AC1EF\">\u258d \u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0434\u0440\u0443\u0433\u0438\u0445 \u0433\u0430\u043c\u043c<\/font><\/h2>\n<p>  \u041f\u043e\u043a\u0430 \u0447\u0442\u043e \u044f \u043f\u043e\u043a\u0430\u0437\u0430\u043b, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0443\u0437\u044b\u043a\u0443 \u0438\u0437 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0433\u0430\u043c\u043c\u0443 \u043b\u044f \u043c\u0438\u043d\u043e\u0440 \u0433\u0430\u0440\u043c\u043e\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0439. \u041d\u043e, \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0432\u0441\u044e \u043a\u0440\u0443\u0442\u043e\u0441\u0442\u044c \u044d\u0442\u043e\u0439 \u0433\u0430\u043c\u043c\u044b, \u0431\u044b\u043b\u043e \u0431\u044b \u043d\u0435\u043f\u043b\u043e\u0445\u043e \u0432\u043d\u0435\u0441\u0442\u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u0438\u044f \u0432 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0443\u044e \u043d\u043e\u0442\u0443 (\u0442\u043e\u043d\u0438\u043a\u0443) \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u044b, \u043f\u043e\u043c\u0438\u043c\u043e \u0442\u0435\u0445, \u0447\u0442\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u0435\u0451 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043d\u0430\u0448\u0435\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 \u0432\u043d\u043e\u0441\u0438\u0442\u044c \u0432 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u0442\u0440\u0435\u043a\u0438 \u043a\u0443\u0434\u0430 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u044e\u0430\u043d\u0441\u043e\u0432 \u0438 \u0432\u0430\u0440\u0438\u0430\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c, \u043f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u043c\u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u043d\u043e \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0447\u0430\u0441\u0442\u043e\u0442\u044b \u0434\u043b\u044f \u043b\u044e\u0431\u043e\u0439 \u0442\u043e\u043d\u0438\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u044f \u0437\u0430\u0445\u043e\u0447\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c. \u0423 \u041a\u044d\u0442\u0438 \u0425\u0435 \u0435\u0441\u0442\u044c <a href=\"https:\/\/towardsdatascience.com\/music-in-python-2f054deb41f4\">\u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f<\/a>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u043d\u0430 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043c\u0443\u0437\u044b\u043a\u043e\u0439 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 Python. \u042f \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043b \u043e\u0434\u043d\u0443 \u0438\u0437 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u0432 \u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0434\u043b\u044f \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u043e\u0442 \u0444\u043e\u0440\u0442\u0435\u043f\u0438\u0430\u043d\u043e \u0441 \u0447\u0430\u0441\u0442\u043e\u0442\u0430\u043c\u0438:<\/p>\n<pre><code class=\"python\">def get_piano_notes():        # \u0411\u0435\u043b\u044b\u0435 \u043a\u043b\u0430\u0432\u0438\u0448\u0438 \u0443\u043a\u0430\u0437\u0430\u043d\u044b \u0432 \u0432\u0435\u0440\u0445\u043d\u0435\u043c \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435, \u0430 \u0447\u0451\u0440\u043d\u044b\u0435 \u0432 \u043d\u0438\u0436\u043d\u0435\u043c     octave = ['C', 'c', 'D', 'd', 'E', 'F', 'f', 'G', 'g', 'A', 'a', 'B']     base_freq = 440 #Frequency of Note A4     keys = np.array([x+str(y) for y in range(0,9) for x in octave])     # \u041e\u0431\u0440\u0435\u0437\u043a\u0430 \u0434\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 88 \u043a\u043b\u0430\u0432\u0438\u0448     start = np.where(keys == 'A0')[0][0]     end = np.where(keys == 'C8')[0][0]     keys = keys[start:end+1]          note_freqs = dict(zip(keys, [2**((n+1-49)\/12)*base_freq for n in range(len(keys))]))     note_freqs[''] = 0.0 # stop     return note_freqs<\/code><\/pre>\n<p>  \u042d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0441\u043b\u0443\u0436\u0438\u0442 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0441\u043d\u043e\u0432\u044b \u0434\u043b\u044f \u043c\u043e\u0435\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0442\u0440\u0435\u043a\u043e\u0432\/\u0433\u0430\u043c\u043c, \u0438 \u0441 \u0435\u0451 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0439 \u043d\u043e\u0442, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 88 \u043a\u043b\u0430\u0432\u0438\u0448\u0430\u043c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0433\u043e \u0444\u043e\u0440\u0442\u0435\u043f\u0438\u0430\u043d\u043e, \u0441 \u0447\u0430\u0441\u0442\u043e\u0442\u0430\u043c\u0438 \u0432 \u0433\u0435\u0440\u0446\u0430\u0445, \u043a\u0430\u043a \u044d\u0442\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0438\u0436\u0435:<\/p>\n<pre><code class=\"python\"># \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0441\u043b\u043e\u0432\u0430\u0440\u044f \u043d\u043e\u0442 note_freqs = get_piano_notes()<\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u043d\u0443\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u044b \u0433\u0430\u043c\u043c\u044b \u0432 \u0442\u043e\u043d\u0430\u0445, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u0442\u044b.<\/p>\n<pre><code class=\"python\"># \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0442\u043e\u043d\u043e\u0432. \u0412 \u0432\u0435\u0440\u0445\u043d\u0435\u043c \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u044b \u0431\u0435\u043b\u044b\u0435 \u043a\u043b\u0430\u0432\u0438\u0448\u0438, \u0430 \u0432 \u043d\u0438\u0436\u043d\u0435\u043c - \u0447\u0451\u0440\u043d\u044b\u0435 scale_intervals = ['A','a','B','C','c','D','d','E','F','f','G','g']<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u0438\u043d\u0434\u0435\u043a\u0441 \u043d\u0430\u0448\u0435\u0439 \u0433\u0430\u043c\u043c\u044b \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u0442\u043e\u043d\u043e\u0432, \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u043e\u043c \u0432\u044b\u0448\u0435. \u042d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0434\u0430\u043b\u0435\u0435 \u044f \u0431\u0443\u0434\u0443 \u0440\u0435\u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u0441\u043f\u0438\u0441\u043e\u043a, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u043d\u0430\u0447\u0438\u043d\u0430\u043b\u0441\u044f \u0441 \u043d\u0443\u0436\u043d\u043e\u0439 \u0442\u043e\u043d\u0438\u043a\u0438.<\/p>\n<pre><code class=\"python\"># \u043f\u043e\u0438\u0441\u043a \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u043d\u0443\u0436\u043d\u043e\u0439 \u043a\u043b\u0430\u0432\u0438\u0448\u0438 index = scale_intervals.index(whichKey)  # \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0430 \u0433\u0430\u043c\u043c\u044b, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u043d\u0430\u0447\u0438\u043d\u0430\u043b\u0441\u044f \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0439 \u043a\u043b\u0430\u0432\u0438\u0448\u0438 new_scale = scale_intervals[index:12] + scale_intervals[:index]<\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u044f \u0441\u043c\u043e\u0433\u0443 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0437\u043d\u044b\u0445 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u0433\u0430\u043c\u043c, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043a\u0430\u0436\u0434\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0438\u043d\u0434\u0435\u043a\u0441\u0443 \u0438\u0437 \u043f\u0435\u0440\u0435\u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u0448\u0430\u0433\u0435.<\/p>\n<pre><code class=\"python\">  #\u0432\u044b\u0431\u043e\u0440 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0430     if whichScale == 'AEOLIAN':         scale = [0, 2, 3, 5, 7, 8, 10]     elif whichScale == 'BLUES':         scale = [0, 2, 3, 4, 5, 7, 9, 10, 11]     elif whichScale == 'PHYRIGIAN':         scale = [0, 1, 3, 5, 7, 8, 10]     elif whichScale == 'CHROMATIC':         scale = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]     elif whichScale == 'DORIAN':         scale = [0, 2, 3, 5, 7, 9, 10]     elif whichScale == 'HARMONIC_MINOR':         scale = [0, 2, 3, 5, 7, 8, 11]     elif whichScale == 'LYDIAN':         scale = [0, 2, 4, 6, 7, 9, 11]     elif whichScale == 'MAJOR':         scale = [0, 2, 4, 5, 7, 9, 11]     elif whichScale == 'MELODIC_MINOR':         scale = [0, 2, 3, 5, 7, 8, 9, 10, 11]     elif whichScale == 'MINOR':             scale = [0, 2, 3, 5, 7, 8, 10]     elif whichScale == 'MIXOLYDIAN':              scale = [0, 2, 4, 5, 7, 9, 10]     elif whichScale == 'NATURAL_MINOR':            scale = [0, 2, 3, 5, 7, 8, 10]     elif whichScale == 'PENTATONIC':             scale = [0, 2, 4, 7, 9]     else:         print('Invalid scale name')<\/code><\/pre>\n<p>  \u041f\u043e\u0447\u0442\u0438 \u0433\u043e\u0442\u043e\u0432\u043e! \u042f \u0442\u0430\u043a\u0436\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044e \u0437\u0434\u0435\u0441\u044c \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u044b \u043d\u0430 \u0441\u043b\u0443\u0447\u0430\u0439, \u0435\u0441\u043b\u0438 \u043c\u043d\u0435 \u0437\u0430\u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u0445 \u043f\u0440\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043c\u0443\u0437\u044b\u043a\u0438.<\/p>\n<pre><code class=\"python\">#\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u043b\u043e\u0432\u0430\u0440\u044f \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u043e\u0432 #\u043f\u0440\u0438\u043c\u0430           = U0 #\u043f\u043e\u043b\u0443\u0442\u043e\u043d         = ST #\u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0441\u0435\u043a\u0443\u043d\u0434\u0430     = M2 #\u043c\u0430\u043b\u0430\u044f \u0442\u0435\u0440\u0446\u0438\u044f      = m3 #\u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0442\u0435\u0440\u0446\u0438\u044f      = M3 #\u0447\u0438\u0441\u0442\u0430\u044f \u043a\u0432\u0430\u0440\u0442\u0430   = P4 #\u0442\u0440\u0438\u0442\u043e\u043d = DT #\u0447\u0438\u0441\u0442\u0430\u044f \u043a\u0432\u0438\u043d\u0442\u0430    = P5 #\u043c\u0430\u043b\u0430\u044f \u0441\u0435\u043a\u0441\u0442\u0430      = m6 #\u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0441\u0435\u043a\u0441\u0442\u0430      = M6 #\u043c\u0430\u043b\u0430\u044f \u0441\u0435\u043f\u0442\u0438\u043c\u0430    = m7 #\u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0441\u0435\u043f\u0442\u0438\u043c\u0430    = M7 #\u043e\u043a\u0442\u0430\u0432\u0430           = O8 harmony_select = {'U0' : 1,                       'ST' : 16\/15,                       'M2' : 9\/8,                       'm3' : 6\/5,                       'M3' : 5\/4,                       'P4' : 4\/3,                       'DT' : 45\/32,                       'P5' : 3\/2,                       'm6': 8\/5,                       'M6': 5\/3,                       'm7': 9\/5,                       'M7': 15\/8,                       'O8': 2                      }     <\/code><\/pre>\n<p>  \u0418 \u0432\u043e\u0442 \u0442\u0435\u043f\u0435\u0440\u044c \u043e\u0441\u0442\u0430\u043b\u0441\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0448\u0430\u0433, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043d\u0430\u0447\u0430\u0442\u044c \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0440\u0435\u043a\u0438.<\/p>\n<pre><code class=\"python\"># \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u0438\u043d\u044b \u0433\u0430\u043c\u043c\u044b \u0432 \u043d\u043e\u0442\u0430\u0445 nNotes = len(scale)  # \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 freqs = [] #harmony = [] #harmony_val = harmony_select[makeHarmony] for i in range(nNotes):     note = new_scale[scale[i]] + str(whichOctave)     freqToAdd = note_freqs[note]     freqs.append(freqToAdd)     #harmony.append(harmony_val*freqToAdd)<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e! \u0422\u0435\u043f\u0435\u0440\u044c \u0443 \u043c\u0435\u043d\u044f \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438. \u042f \u043c\u043e\u0433\u0443 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u0433\u0430\u043c\u043c\u0443, \u043a\u043b\u0430\u0432\u0438\u0448\u0443, \u043e\u043a\u0442\u0430\u0432\u0443, \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c, \u0431\u0443\u0434\u0443\u0442 \u043b\u0438 \u043f\u0438\u043a\u0441\u0435\u043b\u0438 \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043a\u0430\u0436\u0434\u043e\u0439 \u043d\u043e\u0442\u044b.<\/p>\n<p>  \u041f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c \u0433\u043e\u0442\u043e\u0432\u0443\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u0445. \u0427\u0430\u0441\u0442\u043e\u0442\u0430 \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u043e \u0432\u0441\u0435\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 22050 \u0413\u0446, \u0435\u0441\u043b\u0438 \u0438\u043d\u043e\u0435 \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u044f\u0432\u043d\u043e.<\/p>\n<p>  \u0422\u0435\u043c, \u043a\u0442\u043e \u0447\u0438\u0442\u0430\u0435\u0442 \u0441\u0442\u0430\u0442\u044c\u044e \u043d\u0430 \u0441\u043c\u0430\u0440\u0442\u0444\u043e\u043d\u0435, \u044f \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0441\u043b\u0443\u0448\u0430\u0442\u044c \u0442\u0440\u0435\u043a\u0438 \u0438\u0437 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0430 \u0432 \u043d\u0430\u0443\u0448\u043d\u0438\u043a\u0430\u0445, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0438\u0437\u043a\u0438\u0435 \u0447\u0430\u0441\u0442\u043e\u0442\u044b \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c \u0434\u0438\u043d\u0430\u043c\u0438\u043a\u043e\u043c \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u043f\u043b\u043e\u0445\u043e.<\/p>\n<h2><font color=\"#3AC1EF\">\u258d \u042d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442 \u0441 \u043f\u0438\u043a\u0441\u0435\u043b\u044c\u043d\u043e\u0439 \u0433\u0440\u0430\u0444\u0438\u043a\u043e\u0439<\/font><\/h2>\n<p>  \u0415\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u043f\u043e\u043b\u0435\u043c \u0434\u043b\u044f \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0438\u043a\u0441\u0435\u043b\u044c\u043d\u0430\u044f \u0433\u0440\u0430\u0444\u0438\u043a\u0430. \u0412\u043e\u0442 \u043e\u0434\u0438\u043d \u0438\u0437 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0442\u0440\u0435\u043a\u043e\u0432, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f <a href=\"https:\/\/medium.com\/@retronator?source=post_page-----2e211a6200e2--------------------------------\">@Matej \u2018Retro\u2019 Jan<\/a>. \u0414\u0430\u043d\u043d\u044b\u0439 \u0442\u0440\u0435\u043a \u0431\u044b\u043b \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0442\u0440\u0435\u0442\u044c\u0435\u0439 \u043e\u043a\u0442\u0430\u0432\u044b \u0438 \u0442\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043b\u044f \u043c\u0430\u0436\u043e\u0440. \u041f\u043e-\u043c\u043e\u0435\u043c\u0443, \u0437\u0432\u0443\u0447\u0438\u0442 \u043e\u0447\u0435\u043d\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e. \u0423 \u043c\u0435\u043d\u044f \u043e\u043d \u0430\u0441\u0441\u043e\u0446\u0438\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0441 \u043f\u0440\u043e\u0433\u0443\u043b\u043a\u043e\u0439 \u043f\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u043c\u0443 \u0436\u0438\u0437\u043d\u0435\u0440\u0430\u0434\u043e\u0441\u0442\u043d\u043e\u043c\u0443 \u0433\u043e\u0440\u043e\u0434\u043a\u0443. \u041d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u044d\u0442\u043e\u0442 \u0442\u0440\u0435\u043a \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u043f\u043e\u0434\u043e\u0439\u0434\u0451\u0442 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u043d\u0442\u0440\u043e \u0434\u043b\u044f \u0441\u0442\u0430\u0440\u043e\u0439 \u0432\u0438\u0434\u0435\u043e\u0438\u0433\u0440\u044b.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/wd\/e0\/l8\/wde0l8gyhzmixe-jz6kc4fokrzu.png\" data-src=\"https:\/\/habrastorage.org\/webt\/wd\/e0\/l8\/wde0l8gyhzmixe-jz6kc4fokrzu.png\"\/><br \/>  <i><font color=\"#999999\">\u041f\u0438\u043a\u0441\u0435\u043b\u044c\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f China Mountains, Matej \u2018Retro\u2019 Jan, 2013, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u0430\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043a\u0430\u0440\u0442\u0438\u043d\u044b <a href=\"http:\/\/martanael.deviantart.com\/art\/China-Mountains-345041389\">China Mountains<\/a> \u041c\u0430\u0440\u0442\u044b \u041d\u0430\u044d\u043b\u044c<\/font><\/i><\/p>\n<div class=\"oembed\">\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/63b2b7a8a9cdfde0421c7cdb\" data-style=\"\" id=\"63b2b7a8a9cdfde0421c7cdb\" width=\"\"><\/div>\n<\/div>\n<p>  <\/p>\n<h2><font color=\"#3AC1EF\">\u258d \u041f\u0435\u0441\u043d\u044c \u043f\u0430\u0432\u043b\u0438\u043d\u0430<\/font><\/h2>\n<p>  \u042d\u0442\u043e\u0442 \u0442\u0440\u0435\u043a \u0441 \u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f E Dorian \u0438 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u0442\u0440\u0435\u0442\u044c\u0435\u0439 \u043e\u043a\u0442\u0430\u0432\u044b.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/8f\/c3\/na\/8fc3nanjrsj2mmnevgrywmp7zug.png\" data-src=\"https:\/\/habrastorage.org\/webt\/8f\/c3\/na\/8fc3nanjrsj2mmnevgrywmp7zug.png\"\/><\/p>\n<div class=\"oembed\">\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/63b2b1ebb824706ff7588d77\" data-style=\"\" id=\"63b2b1ebb824706ff7588d77\" width=\"\"><\/div>\n<\/div>\n<p>  <\/p>\n<h2><font color=\"#3AC1EF\">\u258d \u041f\u0435\u0441\u043d\u044c \u0432\u043e\u0434\u044b<\/font><\/h2>\n<p>  \u042d\u0442\u043e\u0442 \u0442\u0440\u0435\u043a \u043c\u043e\u0439 \u043b\u044e\u0431\u0438\u043c\u044b\u0439. \u0415\u0433\u043e \u044f \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c B Lydian \u0438 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430 \u0432\u0442\u043e\u0440\u043e\u0439 \u043e\u043a\u0442\u0430\u0432\u044b. \u041c\u043d\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u043e\u043d \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u0437\u0432\u0443\u0447\u0430\u043b \u0431\u044b \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0433\u0438\u0442\u0430\u0440\u043d\u043e\u0433\u043e \u0440\u0438\u0444\u0444\u0430. \u041d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u0442 \u043c\u0443\u0437\u044b\u043a\u0443 Dream Theatre.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/te\/bc\/oe\/tebcoema2erl3uvtozb_jwf54jq.png\" data-src=\"https:\/\/habrastorage.org\/webt\/te\/bc\/oe\/tebcoema2erl3uvtozb_jwf54jq.png\"\/><\/p>\n<div class=\"oembed\">\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/63b2bb007a8d27e026f56d98\" data-style=\"\" id=\"63b2bb007a8d27e026f56d98\" width=\"\"><\/div>\n<\/div>\n<p>  <\/p>\n<h2><font color=\"#3AC1EF\">\u258d \u041f\u0435\u0441\u043d\u044c \u041a\u0430\u0442\u0442\u0435\u0440\u0438\u043d\u044b<\/font><\/h2>\n<p>  \u041c\u043e\u044f \u043a\u043e\u0448\u043a\u0430 \u041a\u0430\u0442\u0442\u0435\u0440\u0438\u043d\u0430 \u043f\u0440\u0438\u043d\u043e\u0441\u0438\u0442 \u043c\u043d\u0435 \u043a\u0443\u0447\u0443 \u0440\u0430\u0434\u043e\u0441\u0442\u0438. \u042d\u0442\u043e\u0442 \u0442\u0440\u0435\u043a \u044f \u0441\u0434\u0435\u043b\u0430\u043b, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043b\u044f \u043c\u0438\u043d\u043e\u0440 \u0433\u0430\u0440\u043c\u043e\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0438 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u0442\u0440\u0435\u0442\u044c\u0435\u0439 \u043e\u043a\u0442\u0430\u0432\u044b. \u041d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u0437\u0432\u0443\u0447\u0438\u0442 \u043e\u0447\u0435\u043d\u044c \u043a\u043b\u0430\u0441\u0441\u043d\u043e.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/vu\/dc\/rb\/vudcrbmyqtghxsp2qn8z0i2hztk.png\" data-src=\"https:\/\/habrastorage.org\/webt\/vu\/dc\/rb\/vudcrbmyqtghxsp2qn8z0i2hztk.png\"\/><\/p>\n<div class=\"oembed\">\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/63b2bb00396453e03430e05b\" data-style=\"\" id=\"63b2bb00396453e03430e05b\" width=\"\"><\/div>\n<\/div>\n<p>  <\/p>\n<h2><font color=\"#3AC1EF\">\u258d \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432 \u0442\u0440\u0435\u043a\u0438 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 2D-\u043c\u0430\u0441\u0441\u0438\u0432\u044b NumPy<\/font><\/h2>\n<p>  \u041c\u043e\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0432 \u0442\u0440\u0435\u043a\u0438 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u044b. \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c, \u043a\u0430\u043a\u043e\u0439 \u0438\u0437 \u043d\u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0447\u0438\u0441\u0442\u0443\u044e \u043a\u0432\u0438\u043d\u0442\u0443, \u043c\u0430\u043b\u0443\u044e \u0441\u0435\u043a\u0441\u0442\u0443 \u0438 \u0442. \u043f.), \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0445 \u0440\u0430\u043d\u0435\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c \u0438\u0437 \u043d\u0435\u0433\u043e \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u043d\u043e\u0442. \u041d\u0438\u0436\u0435 \u044f \u043f\u043e\u043a\u0430\u0436\u0443 \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u0438\u0437 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0442\u0440\u0435\u043a\u0430, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b \u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0438\u0445 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e 2D-\u043c\u0430\u0441\u0441\u0438\u0432\u0430 NumPy \u0432 \u0432\u0438\u0434\u0435 wav-\u0444\u0430\u0439\u043b\u0430.<\/p>\n<p>  \u0421\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0434\u043b\u044f <code>scipy.io.wavfile.write<\/code>, \u0435\u0441\u043b\u0438 \u044f \u0445\u043e\u0447\u0443 \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0434\u0432\u0443\u0445\u043c\u0435\u0440\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0432 wav-\u0444\u0430\u0439\u043b, \u0442\u043e \u0435\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0444\u043e\u0440\u043c\u0435 (<code>Nsamples<\/code>, <code>Nchannels<\/code>). \u0417\u0430\u043c\u0435\u0442\u044c\u0442\u0435, \u0447\u0442\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u043d\u0430\u0448 \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u043c\u0435\u0435\u0442 \u0444\u043e\u0440\u043c\u0443 (2, 264600), \u0442\u043e \u0435\u0441\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e <code>Nchannels = 2<\/code>, \u0430 <code>Nsamples = 264600<\/code>. \u0427\u0442\u043e\u0431\u044b \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0444\u043e\u0440\u043c\u044b \u043d\u0430\u0448\u0435\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0434\u043b\u044f <code>scipy.io.wavfile.write<\/code>, \u044f \u0441\u043f\u0435\u0440\u0432\u0430 \u0435\u0433\u043e \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u043d\u0438\u0440\u0443\u044e. \u042d\u0442\u043e\u0442 \u0442\u0440\u0435\u043a \u0431\u044b\u043b \u043f\u043e\u043b\u0443\u0447\u0435\u043d \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0433\u0430\u0440\u043c\u043e\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043c\u0438\u043d\u043e\u0440\u0430 \u043b\u044f \u0434\u0438\u0435\u0437, \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430 \u0432\u0442\u043e\u0440\u043e\u0439 \u043e\u043a\u0442\u0430\u0432\u044b \u0438 \u043c\u0430\u043b\u043e\u0439 \u0442\u0435\u0440\u0446\u0438\u0438.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/ce\/qm\/p6\/ceqmp6oawccpujk2mkmp0zkibj4.png\" data-src=\"https:\/\/habrastorage.org\/webt\/ce\/qm\/p6\/ceqmp6oawccpujk2mkmp0zkibj4.png\"\/><br \/>  <i><font color=\"#999999\">\u041e\u0442\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043d\u0435\u0431\u0430 \u0432 \u0432\u043e\u0434\u0435 (\u041d\u0430\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0430\u0440\u043a \u0424\u0430\u0439\u043e\u0440\u0434\u043b\u0435\u043d\u0434 \u0432 \u041d\u043e\u0432\u043e\u0439 \u0417\u0435\u043b\u0430\u043d\u0434\u0438\u0438). \u0424\u043e\u0442\u043e \u0438\u0437 <a href=\"https:\/\/www.markgray.com.au\/\">\u0433\u0430\u043b\u043b\u0435\u0440\u0435\u0438 Mark Gray<\/a><\/font><\/i><\/p>\n<div class=\"oembed\">\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/63b2b1ec396453e03430dbc7\" data-style=\"\" id=\"63b2b1ec396453e03430dbc7\" width=\"\"><\/div>\n<\/div>\n<p>  <\/p>\n<h2><font color=\"#3AC1EF\">\u258d \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432 \u0442\u0440\u0435\u043a\u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u043e\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043e\u0442 Spotify<\/font><\/h2>\n<p>  \u0412\u0435\u043b\u0438\u043a\u043e\u043b\u0435\u043f\u043d\u043e! \u0425\u043e\u0442\u044f \u043c\u043e\u0436\u043d\u043e \u0435\u0449\u0451 \u043c\u043d\u043e\u0433\u043e\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c. \u042f \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0441\u044c \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c wav-\u0444\u0430\u0439\u043b \u0438 \u043f\u043e\u0438\u0433\u0440\u0430\u0442\u044c\u0441\u044f \u0441 \u043d\u0438\u043c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043c\u043e\u0434\u0443\u043b\u044c pedalboard. \u042d\u0442\u043e \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u0438 \u044f \u043d\u0430\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0432\u0430\u043c \u0441 \u043d\u0438\u043c \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f. \u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043d\u0451\u043c \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 <a href=\"https:\/\/github.com\/spotify\/pedalboard\">\u0437\u0434\u0435\u0441\u044c<\/a> \u0438 <a href=\"https:\/\/spotify.github.io\/pedalboard\/reference\/pedalboard.html\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>  \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u044f \u043f\u0435\u0440\u0435\u0434\u0435\u043b\u0430\u044e \u043f\u0435\u0441\u043d\u044c \u0432\u043e\u0434\u044b, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u043c\u044b\u0435 pedalboard \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 <i>Compressor<\/i>, <i>Gain<\/i>, <i>Chorus<\/i>, <i>Phaser<\/i>, <i>Reverb<\/i> \u0438 <i>Ladder Filter<\/i>. \u0412\u043e\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<div class=\"oembed\">\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/63b2bb01b824706ff758920f\" data-style=\"\" id=\"63b2bb01b824706ff758920f\" width=\"\"><\/div>\n<\/div>\n<p>  \u0421\u0443\u043f\u0435\u0440 \u043a\u0440\u0443\u0442\u043e! \u041f\u0440\u043e\u0441\u0442\u043e \u043e\u0442\u043f\u0430\u0434! \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u0441\u0435\u0431\u0435 \u044d\u0442\u043e\u0442 \u0442\u0440\u0435\u043a \u0432 \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u0438 \u0441 \u0443\u0434\u0430\u0440\u043d\u044b\u043c\u0438 \u0438\u043b\u0438 \u0436\u0438\u0432\u044b\u043c\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u044e \u043f\u0435\u0441\u043d\u044c \u041a\u0430\u0442\u0442\u0435\u0440\u0438\u043d\u044b, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f <i>Ladder Filter<\/i>, <i>Delay<\/i>, <i>Reverb<\/i> \u0438 <i>Pitch Shift<\/i>. \u0412\u043e\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<div class=\"oembed\">\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/63b2bb01200df56fc17b66a2\" data-style=\"\" id=\"63b2bb01200df56fc17b66a2\" width=\"\"><\/div>\n<\/div>\n<p>  \u041c\u043c, \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u0438\u044f\u0442\u043d\u043e!<\/p>\n<p>  \u041d\u0443 \u0438 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u044f \u0437\u0430\u043d\u043e\u0432\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e \u0442\u0440\u0435\u043a \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u0440\u0438\u0440\u043e\u0434\u043d\u043e\u0433\u043e \u043b\u0430\u043d\u0434\u0448\u0430\u0444\u0442\u0430 \u0438\u0437 \u041d\u0430\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0430\u0440\u043a\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f <i>Ladder Filter<\/i>, <i>Delay<\/i>, <i>Reverb<\/i>, <i>Chorus<\/i>, <i>Pitch Shift<\/i> \u0438 <i>Phaser<\/i>:<\/p>\n<div class=\"oembed\">\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/63b2bb02a0a2e96fdf18e44b\" data-style=\"\" id=\"63b2bb02a0a2e96fdf18e44b\" width=\"\"><\/div>\n<\/div>\n<p>  <\/p>\n<h2><font color=\"#3AC1EF\">\u258d \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043d\u043e\u0442 \u0438 \u043d\u043e\u043c\u0435\u0440\u043e\u0432 MIDI \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Librosa<\/font><\/h2>\n<p>  Librosa \u2013 \u044d\u0442\u043e \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u044b\u0439 \u043f\u0430\u043a\u0435\u0442, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u0441 \u0430\u0443\u0434\u0438\u043e\u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438. \u0421 \u043d\u0438\u043c \u044f \u0442\u043e\u0436\u0435 \u0441\u043e\u0432\u0435\u0442\u0443\u044e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f. \u0417\u0434\u0435\u0441\u044c \u0441 \u0435\u0433\u043e \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043b \u0447\u0430\u0441\u0442\u043e\u0442\u044b \u0432 \u043d\u043e\u0442\u044b \u0438 \u043d\u043e\u043c\u0435\u0440\u0430 MIDI.<\/p>\n<p>  MIDI \u0444\u043e\u0440\u043c\u0430\u0442 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b\u044b \u043d\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u0445, \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430\u0445 \u0438 \u043f\u0440\u043e\u0447\u0438\u0445 \u0430\u0443\u0434\u0438\u043e-\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u0445, \u0442\u0430\u043a \u0447\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0432 \u043d\u0451\u043c \u0442\u0440\u0435\u043a\u0438 \u0434\u0430\u0441\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u043d\u0438\u043c\u0438 \u0434\u0440\u0443\u0433\u0438\u043c \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u043c\u0443\u0437\u044b\u043a\u0430\u043d\u0442\u0430\u043c \u0438\u043b\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430\u043c.<\/p>\n<p>  \u041d\u0438\u0436\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043c\u043e\u0435\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043e\u0439 \u0447\u0430\u0441\u0442\u043e\u0442, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043c\u0443\u0437\u044b\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u043d\u043e\u0442\u044b \u0438 <code>midi_numbers<\/code> \u0442\u0440\u0435\u043a\u0430.<\/p>\n<pre><code class=\"python\"># \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0447\u0430\u0441\u0442\u043e\u0442\u044b \u0432 \u043d\u043e\u0442\u0443 catterina_df['notes'] = catterina_df.apply(lambda row : librosa.hz_to_note(row['frequencies']),                                            axis = 1)   # \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u043e\u0442\u044b \u0432 \u043d\u043e\u043c\u0435\u0440 MIDI catterina_df['midi_number'] = catterina_df.apply(lambda row : librosa.note_to_midi(row['notes']),                                                  axis = 1)<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/nc\/0q\/x2\/nc0qx23b8rizgtbgupug6wek3da.png\" data-src=\"https:\/\/habrastorage.org\/webt\/nc\/0q\/x2\/nc0qx23b8rizgtbgupug6wek3da.png\"\/><br \/>  <i><font color=\"#999999\">\u0418\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \u0434\u0430\u0442\u0430\u0444\u0440\u0435\u0439\u043c \u0442\u0440\u0435\u043a\u0430, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e librosa \u0438 pandas<\/font><\/i><\/p>\n<h2><font color=\"#3AC1EF\">\u258d \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0442\u0440\u0435\u043a\u0430 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 MIDI<\/font><\/h2>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u0443 \u043c\u0435\u043d\u044f \u0435\u0441\u0442\u044c \u0434\u0430\u0442\u0430\u0444\u0440\u0435\u0439\u043c \u0441 \u0447\u0430\u0441\u0442\u043e\u0442\u0430\u043c\u0438, \u043d\u043e\u0442\u0430\u043c\u0438 \u0438 \u043d\u043e\u043c\u0435\u0440\u0430\u043c\u0438 MIDI, \u044f \u043c\u043e\u0433\u0443 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u0437 \u043d\u0435\u0433\u043e MIDI-\u0444\u0430\u0439\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u0440\u0442\u0438\u0442\u0443\u0440\u0443 \u0442\u0440\u0435\u043a\u0430.<\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u043c \u044f \u044d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0430\u043a\u0435\u0442\u0430 midiutil, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0435\u0433\u043e \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c MIDI-\u0444\u0430\u0439\u043b\u044b \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 MIDI-\u0447\u0438\u0441\u0435\u043b. \u042d\u0442\u043e\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0432\u0441\u044f\u0447\u0435\u0441\u043a\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0432\u0440\u043e\u0434\u0435 \u0433\u0440\u043e\u043c\u043a\u043e\u0441\u0442\u0438, \u0442\u0435\u043c\u043f\u0430 \u0438 \u0434\u043e\u0440\u043e\u0436\u0435\u043a. \u041f\u043e\u043a\u0430 \u0447\u0442\u043e \u044f \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u044e MIDI-\u0444\u0430\u0439\u043b \u0441 \u043e\u0434\u043d\u043e\u0439 \u0434\u043e\u0440\u043e\u0436\u043a\u043e\u0439.<\/p>\n<pre><code class=\"python\"># \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u043e\u043b\u0431\u0446\u0430 \u043d\u043e\u043c\u0435\u0440\u043e\u0432 MIDI \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 NumPy midi_number = catterina_df['midi_number'].to_numpy()  degrees  = list(midi_number) # \u043d\u043e\u043c\u0435\u0440 MIDI \u043d\u043e\u0442\u044b track    = 0 channel  = 0 time     = 0   # \u0432 \u0443\u0434\u0430\u0440\u0430\u0445 duration = 1   # \u0432 \u0443\u0434\u0430\u0440\u0430\u0445 tempo    = 240  # \u0432 BPM volume   = 100 # 0-127, \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0443 MIDI  MyMIDI = MIDIFile(1) # \u043e\u0434\u043d\u0430 \u0434\u043e\u0440\u043e\u0436\u043a\u0430, \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 1 (\u0434\u043e\u0440\u043e\u0436\u043a\u0430 \u0442\u0435\u043c\u043f\u0430 \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438) MyMIDI.addTempo(track,time, tempo)  for pitch in degrees:     MyMIDI.addNote(track, channel, pitch, time, duration, volume)     time = time + 1 with open(\"catterina.mid\", \"wb\") as output_file:     MyMIDI.writeFile(output_file)<\/code><\/pre>\n<p>  <\/p>\n<h2><font color=\"#3AC1EF\">\u258d \u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/font><\/h2>\n<p>  \u0412\u043e\u0442 \u044f \u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u043b, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u043c\u0443\u0437\u044b\u043a\u0443 \u0438\u0437 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0438 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0451 \u0432 wav-\u0444\u0430\u0439\u043b\u044b \u0434\u043b\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438. \u042f \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c\u0441\u044f \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0441\u043b\u043e\u0436\u043d\u044b\u043c\u0438, \u0431\u043e\u0433\u0430\u0442\u044b\u043c\u0438 \u0438 \u0434\u0430\u0436\u0435 \u0441\u0442\u0440\u0430\u043d\u043d\u044b\u043c\u0438. \u041c\u043d\u0435 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u0441\u0432\u043e\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0435\u0449\u0451 \u043a\u043e\u0435-\u0447\u0442\u043e, \u043d\u043e \u043f\u043e\u043a\u0430 \u044f \u044d\u0442\u043e \u043e\u0442\u043b\u043e\u0436\u0443. \u041f\u043e\u043b\u0435 \u0434\u043b\u044f \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432 \u0437\u0434\u0435\u0441\u044c \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u0435!<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441, \u043a\u0430\u043a \u0443 \u043c\u0443\u0437\u044b\u043a\u0430\u043d\u0442\u0430, \u0432\u0434\u0440\u0443\u0433 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0441 \u043f\u043e\u0438\u0441\u043a\u043e\u043c \u043d\u043e\u0432\u043e\u0433\u043e \u0437\u0432\u0443\u043a\u0430, \u0442\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0437\u0430\u043a\u0438\u043d\u0443\u0442\u044c \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443 \u0432 \u043c\u043e\u0451 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0438, \u0431\u044b\u0442\u044c \u043c\u043e\u0436\u0435\u0442, \u043e\u043d\u043e \u043f\u043e\u0434\u043a\u0438\u043d\u0435\u0442 \u0432\u0430\u043c \u0433\u043e\u0434\u043d\u0443\u044e \u0441\u0442\u0430\u0440\u0442\u043e\u0432\u0443\u044e \u0438\u0434\u0435\u044e. \u041d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0437\u043d\u0430\u0435\u0448\u044c, \u043e\u0442\u043a\u0443\u0434\u0430 \u043f\u0440\u0438\u0434\u0451\u0442 \u0432\u0434\u043e\u0445\u043d\u043e\u0432\u0435\u043d\u0438\u0435.<\/p>\n<p>  \u0414\u043b\u044f \u043c\u0435\u043d\u044f \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0435\u043a\u0442 \u0431\u044b\u043b \u043e\u0447\u0435\u043d\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0435\u043d, \u0438, \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u0432\u0430\u043c \u0435\u0433\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0442\u043e\u0436\u0435 \u043f\u0440\u0438\u0448\u043b\u0438\u0441\u044c \u043f\u043e \u043d\u0440\u0430\u0432\u0443.<\/p>\n<p>  \u0414\u043b\u044f \u0432\u0441\u0435\u0445 \u0436\u0435\u043b\u0430\u044e\u0449\u0438\u0445 \u044f \u0435\u0449\u0451 \u0440\u0430\u0437 \u043f\u0440\u043e\u0434\u0443\u0431\u043b\u0438\u0440\u0443\u044e <a href=\"https:\/\/github.com\/victormurcia\/Making-Music-From-Images\">\u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 GitHub<\/a> \u0438 \u043d\u0430 <a href=\"https:\/\/victormurcia-making-music-from-images-music-to-images-ce4ydi.streamlitapp.com\/\">\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 Streamlit<\/a>.<\/p>\n<p>  \u0420\u0430\u0437\u0432\u043b\u0435\u043a\u0430\u0439\u0442\u0435\u0441\u044c, \u0438 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044e \u0437\u0430 \u0447\u0442\u0435\u043d\u0438\u0435!<\/p>\n<blockquote><p><b><font color=\"#3AC1EF\"><a href=\"https:\/\/t.me\/ruvds_community\/130\">\u0418\u0433\u0440\u0430\u0439 \u0432 \u043d\u0430\u0448\u0443 \u043d\u043e\u0432\u0443\u044e \u0438\u0433\u0440\u0443 \u043f\u0440\u044f\u043c\u043e \u0432 Telegram!<\/a><\/font><\/b><\/p><\/blockquote>\n<p><a href=\"http:\/\/ruvds.com\/ru-rub?utm_source=habr&amp;utm_medium=article&amp;utm_campaign=Bright_Translate&amp;utm_content=generaciya_muzyki_iz_izobrazhenij_s_pomoshhyu_python\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/sz\/7j\/pf\/sz7jpfj8i1pa6ocj-eia09dev4q.png\" data-src=\"https:\/\/habrastorage.org\/webt\/sz\/7j\/pf\/sz7jpfj8i1pa6ocj-eia09dev4q.png\"\/><\/a><\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/708890\/\"> https:\/\/habr.com\/ru\/company\/ruvds\/blog\/708890\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\"><a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/708890\/\"><\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/fb\/cw\/ek\/fbcwekpnjhxtaumdjuk1vp_b1pq.png\" data-src=\"https:\/\/habrastorage.org\/webt\/fb\/cw\/ek\/fbcwekpnjhxtaumdjuk1vp_b1pq.png\"\/><\/div>\n<p><\/a><br \/>  \u0421\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u043c\u0443\u0437\u044b\u043a\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0430\u0441\u0442\u044c\u044e \u043c\u043e\u0435\u0439 \u0436\u0438\u0437\u043d\u0438, \u0431\u0443\u0434\u0435\u0442 \u0441\u0435\u0440\u044c\u0451\u0437\u043d\u044b\u043c \u043f\u0440\u0435\u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u0435\u043c. \u042f \u0431\u043e\u043b\u0435\u0435 20 \u043b\u0435\u0442 \u0438\u0433\u0440\u0430\u044e \u043d\u0430 \u0433\u0438\u0442\u0430\u0440\u0435, \u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u0434\u0435\u043d\u044c \u0441\u043b\u0443\u0448\u0430\u044e \u0434\u0440\u0443\u0433\u0438\u0445 \u0433\u0438\u0442\u0430\u0440\u0438\u0441\u0442\u043e\u0432. \u041f\u043e \u043f\u0440\u0430\u0432\u0434\u0435 \u0433\u043e\u0432\u043e\u0440\u044f, \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043d\u0430\u0447\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0430\u043a\u0430\u0434\u0435\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0443\u0442\u044c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0444\u0438\u0437\u0445\u0438\u043c\u0438\u043a\u0430 \u0434\u0432\u0435\u043d\u0430\u0434\u0446\u0430\u0442\u044c \u043b\u0435\u0442 \u043d\u0430\u0437\u0430\u0434, \u044f \u0431\u044b\u043b \u043d\u0430\u043c\u0435\u0440\u0435\u043d \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043c\u0443\u0437\u044b\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u043a\u0430\u0440\u044c\u0435\u0440\u0443.<\/p>\n<p>  \u0418 \u0445\u043e\u0442\u044f \u044d\u0442\u0438\u043c \u043c\u043e\u0438\u043c \u043f\u043b\u0430\u043d\u0430\u043c \u043d\u0443 \u0431\u044b\u043b\u043e \u0441\u0443\u0436\u0434\u0435\u043d\u043e \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0438\u0442\u044c\u0441\u044f, \u044f \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u044e \u043d\u0430\u0441\u043b\u0430\u0436\u0434\u0430\u0442\u044c\u0441\u044f \u043c\u0443\u0437\u044b\u043a\u043e\u0439 \u0438 \u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u0435\u0451 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u0441\u044f\u043a\u0438\u0435 \u043a\u0440\u0443\u0442\u044b\u0435 \u0448\u0442\u0443\u043a\u0438. \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0435\u043a\u0442 \u0432\u043e\u0437\u043d\u0438\u043a \u0438\u0437 \u0438\u0434\u0435\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b\u0430 \u043c\u0443\u0437\u044b\u043a\u0443 \u0438\u0437 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439. \u0412 \u043f\u0440\u043e\u0448\u043b\u043e\u043c \u0443\u0436\u0435 \u0431\u044b\u043b\u0438 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u043f\u043e\u043f\u044b\u0442\u043a\u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435\u0447\u0442\u043e \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0435, \u043d\u043e \u0432\u043e\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u043b\u0438\u0441\u044c \u043d\u0435 \u043e\u0441\u043e\u0431\u043e \u043c\u0443\u0437\u044b\u043a\u0430\u043b\u044c\u043d\u044b\u043c\u0438.<\/p>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e \u0441\u0432\u043e\u0451\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0435 \u043a \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0438\u0437 \u043a\u0430\u0440\u0442\u0438\u043d\u043e\u043a \u0430\u0443\u0434\u0438\u043e\u0442\u0440\u0435\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435, \u0438\u043c\u0445\u043e, \u0437\u0432\u0443\u0447\u0430\u0442 \u0432\u0435\u0441\u044c\u043c\u0430 \u043d\u0435\u043f\u043b\u043e\u0445\u043e. \u0417\u0434\u0435\u0441\u044c \u044f \u043e\u043f\u0438\u0448\u0443 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0438 \u043f\u043e\u043a\u0430\u0436\u0443 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u0434\u0430\u0447\u043d\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b. \u0415\u0441\u043b\u0438 \u0432\u044b \u0437\u0430\u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432\u0435\u0441\u044c \u043a\u043e\u0434, \u0442\u043e \u043e\u043d \u043b\u0435\u0436\u0438\u0442 \u043d\u0430 \u043c\u043e\u0451\u043c <a href=\"https:\/\/victormurcia.github.io\/Making-Music-From-Images-in-Python\/\">\u0441\u0430\u0439\u0442\u0435<\/a> \u0438 \u0432 <a href=\"https:\/\/github.com\/victormurcia\/Making-Music-From-Images\">\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 GitHub<\/a>. \u042f \u0442\u0430\u043a\u0436\u0435 \u0441\u043e\u0437\u0434\u0430\u043b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Streamlit \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/victormurcia-making-music-from-images-music-to-images-ce4ydi.streamlitapp.com\/\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-343578","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/343578","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=343578"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/343578\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=343578"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=343578"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=343578"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}