{"id":257078,"date":"2015-05-13T12:21:02","date_gmt":"2015-05-13T08:21:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=257078"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=257078","title":{"rendered":"\u041f\u0438\u0448\u0435\u043c \u0411\u0435\u0442\u0445\u043e\u0432\u0435\u043d\u0430 \u043d\u0430 Javascript \u0438\u043b\u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043e MIDI.js"},"content":{"rendered":"<p>             \u041a\u0430\u043a \u0441\u044b\u0433\u0440\u0430\u0442\u044c \u043d\u043e\u0442\u044b \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435? \u041a\u0430\u043a \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u0442\u044c \u043b\u044e\u0431\u043e\u0435 \u0434\u043b\u0438\u043d\u043d\u0435\u0439\u0448\u0435\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0434\u043e 107 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u043d\u043e\u0442 (\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0435\u0449\u0435 \u0438 \u0437\u0430\u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u0442\u044c) \u0438 \u043a\u0438\u043b\u043e\u0431\u0430\u0439\u0442\u0430-\u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0442\u0435\u043a\u0441\u0442\u0430? \u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043c\u0443\u0437\u044b\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0442\u0435\u043e\u0440\u0438\u0438, js-\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0438 MIDI \u043f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c.<br \/>  <a name=\"habracut\"><\/a><br \/>  <i>\u041f\u0440\u0435\u0434\u0438\u0441\u043b\u043e\u0432\u0438\u0435. \u041d\u0430 \u0433\u043b\u0443\u0431\u043e\u043a\u0438\u0435 \u043f\u043e\u0437\u043d\u0430\u043d\u0438\u044f \u0432 \u043d\u043e\u0442\u043d\u043e\u0439 \u0433\u0440\u0430\u043c\u043e\u0442\u0435 \u044f \u043d\u0435 \u043f\u0440\u0435\u0442\u0435\u043d\u0434\u0443\u044e. \u041d\u043e \u044d\u0442\u043e \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u043e\u043c\u0435\u0448\u0430\u0442\u044c \u043f\u043e\u043d\u044f\u0442\u044c \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044e \u043d\u043e\u0442\u043d\u043e\u0435 \u043f\u0438\u0441\u044c\u043c\u043e \u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435\u0447\u0442\u043e, \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c, \u043f\u043e\u0445\u043e\u0436\u0435\u0435 \u043d\u0430 \u0437\u0432\u0443\u043a\u043e\u0440\u044f\u0434, \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u043e\u043c \u0432 \u043d\u043e\u0442\u0430\u0445. \u041c\u043d\u043e\u0433\u0438\u0435 \u0442\u0435\u0440\u043c\u0438\u043d\u044b \u0438 \u043f\u043e\u043d\u044f\u0442\u0438\u044f \u043d\u0430\u0440\u043e\u0447\u043d\u043e \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u044b. \u0423\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u043d\u0430 \u0433\u0440\u0430\u043c\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435, \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0438 \u043f\u0440\u043e\u0447\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0432 \u0442\u0435\u043a\u0441\u0442\u0435 \u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442\u0441\u044f \u0432 \u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u0445.<\/i><\/p>\n<p>  \u0414\u043b\u044f \u043d\u0435\u0442\u0435\u0440\u043f\u0435\u043b\u0438\u0432\u044b\u0445 \u2014 \u0441\u0440\u0430\u0437\u0443 \u043c\u043e\u0436\u043d\u043e <a href=\"https:\/\/cdn.rawgit.com\/tirnak\/MIDI.js\/master\/examples\/Betchoven.html\">\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c<\/a> (7 \u0442\u0430\u043a\u0442\u043e\u0432 \u043b\u0443\u043d\u043d\u043e\u0439 \u0441\u043e\u043d\u0430\u0442\u044b). \u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 Chrome \u0438 Firefox \u043d\u0430 Ubuntu 14.04. \u041d\u0430 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u0445 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u043d\u0435 \u0431\u0443\u0434\u0435\u0442.<\/p>\n<p>  \u041a\u0430\u043a \u0436\u0435 \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u043d\u043e\u0442\u043d\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435? \u041f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u0432 \u0433\u043e\u043b\u043e\u0432\u0443 \u2014 \u043d\u0430\u0439\u0442\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0435\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u041f\u043e\u0438\u0441\u043a \u043f\u043e \u0433\u0438\u0442\u0445\u0430\u0431\u0443 \u0432\u044b\u0434\u0430\u0435\u0442 <a href=\"https:\/\/github.com\/mudcube\/MIDI.js\">midi.js<\/a>. \u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u0443\u0434\u043e\u0431\u043d\u043e\u0435. \u041b\u0438\u0446\u0435\u043d\u0437\u0438\u044f MIT. \u041f\u0440\u0438\u043c\u0435\u0440\u044b \u2014 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442. \u0411\u0435\u0440\u0435\u043c! <\/p>\n<pre><code class=\"bash\">$ git clone https:\/\/github.com\/mudcube\/MIDI.js.git <\/code><\/pre>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043a\u043e\u043f\u0438\u044e \u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u043c \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0438. \u0412 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 examples \u0432\u0438\u0434\u0438\u043c Basic.html. \u0421\u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0442\u0443\u0434\u0430 \u0436\u0435 \u043a\u0430\u043a Betchoven.html \u0438 \u0431\u0443\u0434\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435. \u0418\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0449\u0438\u0435 \u043d\u0430\u0441 \u0441\u0442\u0440\u043e\u043a\u0438: <\/p>\n<pre><code class=\"javascript\">    var delay = 0; \/\/ play one note every quarter second     var note = 50; \/\/ the MIDI note     var velocity = 127; \/\/ how hard the note hits     \/\/ play the note     MIDI.setVolume(0, 127);     MIDI.noteOn(0, note, velocity, delay);     MIDI.noteOff(0, note, delay + 0.75); <\/code><\/pre>\n<p>  \u041d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0430\u0434\u043e \u0447\u0442\u043e-\u0442\u043e \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0438 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e\u0435. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0435\u0440\u0432\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u041b\u0443\u043d\u043d\u043e\u0439 \u0441\u043e\u043d\u0430\u0442\u044b \u0411\u0435\u0442\u0445\u043e\u0432\u0435\u043d\u0430 (\u0421\u043e\u043d\u0430\u0442\u0430 \u0434\u043b\u044f \u0444\u043e\u0440\u0442\u0435\u043f\u0438\u0430\u043d\u043e \u2116 14 \u0434\u043e-\u0434\u0438\u0435\u0437 \u043c\u0438\u043d\u043e\u0440, \u043e\u043f. 27, \u2116 2, \u043a\u0430\u043a \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0432\u0438\u043a\u0438). \u041d\u0430\u0439\u0434\u0435\u043c \u043d\u043e\u0442\u044b. <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0443\u0441\u0442\u044c \u0431\u0443\u0434\u0443\u0442 \u0442\u0430\u043a\u0438\u0435:<\/b><\/p>\n<div class=\"spoiler_text\"><img decoding=\"async\" src=\"\/\/habrastorage.org\/files\/37f\/11c\/a54\/37f11ca54e724711bea241d1c094ed50.jpg\"\/><\/div>\n<\/div>\n<p>  \u0420\u0430\u0441\u043f\u0438\u0448\u0443 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435 \u0434\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u043d\u043e\u0442\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438.<\/p>\n<h4>\u041d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u044d\u043a\u0441\u043a\u0443\u0440\u0441 \u0432 \u0442\u0435\u043e\u0440\u0438\u044e<\/h4>\n<p>  \u041d\u043e\u0442\u044b \u043d\u0430 \u043f\u0438\u0430\u043d\u0438\u043d\u043e. \u041d\u0430 \u043f\u0435\u0440\u0432\u043e\u0439 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0435 \u043d\u0430\u0440\u0438\u0441\u043e\u0432\u0430\u043d\u0430 \u0440\u0430\u0441\u043a\u043b\u0430\u0434\u043a\u0430 \u043f\u0438\u0430\u043d\u0438\u043d\u043e.<\/p>\n<p>  <img decoding=\"async\" src=\"\/\/habrastorage.org\/files\/614\/52f\/e84\/61452fe84259482e86d2d291f0994644.gif\"\/><br \/>  <i>\u0420\u0430\u0437\u043c\u0435\u0442\u043a\u0430 \u043e\u043a\u0442\u0430\u0432 \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0432\u0435\u0440\u043d\u0430\u044f \u2014 \u043f\u0435\u0440\u0432\u044b\u0435 \u0434\u0432\u0435 \u043d\u043e\u0442\u044b \u0441\u043b\u0435\u0432\u0430 \u2014 \u043d\u0443\u043b\u0435\u0432\u0430\u044f \u043e\u043a\u0442\u0430\u0432\u0430. \u0421 \u043f\u0435\u0440\u0432\u043e\u0439 \u043d\u043e\u0442\u044b \u0414\u043e (\u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0430 \u043a\u0430\u043a C) \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0432\u0430\u044f \u043e\u043a\u0442\u0430\u0432\u0430.<\/i><\/p>\n<p>  \u041d\u0430\u0436\u0430\u0442\u0438\u0435 \u043d\u0430 \u043a\u043b\u0430\u0432\u0438\u0448\u0443 \u043f\u0438\u0430\u043d\u0438\u043d\u043e \u0441 \u0442\u0430\u043a\u043e\u0439 \u0440\u0430\u0441\u043a\u043b\u0430\u0434\u043a\u043e\u0439 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u0442 \u043a \u043f\u0440\u043e\u0438\u0433\u0440\u044b\u0432\u0430\u043d\u0438\u044e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u0437\u0432\u0443\u043a\u0430:<br \/>  \u043e\u0442 \u043a\u043e\u043d\u0442\u0440\u043e\u043a\u0442\u0430\u0432\u043d\u044b\u0445 \u041b\u044f \u2014 \u041b\u044f-\u0434\u0438\u0435\u0437 (\u043e\u043d \u0436\u0435 \u0421\u0438-\u0431\u0435\u043c\u043e\u043b\u044c) \u2014 \u0421\u0438<br \/>  \u0434\u043e \u0414\u043e \u043f\u044f\u0442\u043e\u0439 \u043e\u043a\u0442\u0430\u0432\u044b. \u0413\u0434\u0435 \u0446\u0435\u043b\u044b\u0435 \u043d\u043e\u0442\u044b (\u0414\u043e, \u0420\u0435,..) \u2014 \u0431\u0435\u043b\u044b\u0435 \u043a\u043b\u0430\u0432\u0438\u0448\u0438, \u043f\u043e\u043b\u0443\u0442\u043e\u043d\u0430 (\u0441 \u0434\u0438\u0435\u0437\u0430\u043c\u0438 \u0438 \u0431\u0435\u043c\u043e\u043b\u044f\u043c\u0438) \u2014 \u0447\u0435\u0440\u043d\u044b\u0435.<br \/>  \u0412 \u0437\u0430\u0440\u0443\u0431\u0435\u0436\u043d\u043e\u0439 \u043b\u0438\u0442\u0435\u0440\u0430\u0442\u0443\u0440\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0434\u0440\u0443\u0433\u0430\u044f, \u043d\u0430\u0443\u0447\u043d\u0430\u044f \u043d\u043e\u0442\u0430\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u044b \u0432 \u0438\u0442\u043e\u0433\u0435 \u0438 \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f:<br \/>  \u043d\u043e\u0442\u044b \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0442\u0441\u044f \u043b\u0430\u0442\u0438\u043d\u0441\u043a\u0438\u043c\u0438 \u0431\u0443\u043a\u0432\u0430\u043c\u0438 \u0421 (\u0414\u043e), D (\u0420\u0435), E (\u041c\u0438), F (\u0424\u0430), G (\u0421\u043e\u043b\u044c), A (\u041b\u044f), B (\u0421\u0438). \u041e\u043a\u0442\u0430\u0432\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u043e\u043d\u0443\u043c\u0435\u0440\u043e\u0432\u0430\u043d\u044b \u043e\u0442 0 \u0434\u043e 8. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043d\u0430 \u043f\u0438\u0430\u043d\u0438\u043d\u043e \u0432 \u0437\u0430\u0440\u0443\u0431\u0435\u0436\u043d\u043e\u0439 \u043d\u043e\u0442\u0430\u0446\u0438\u0438 \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043d\u043e\u0442 <br \/>  \u043e\u0442 A0 \u2014 A0\u266f (B0\u266d) \u2014 B0 \u2014 \u04211<br \/>  \u0434\u043e \u04218. \u0427\u0435\u0440\u043d\u044b\u0435 \u043a\u043b\u0430\u0432\u0438\u0448\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043d\u0435 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u044b, \u043a\u0430\u043a \u043d\u0430 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0435 \u0432\u044b\u0448\u0435. \u041d\u0430 \u0447\u0435\u0440\u043d\u044b\u0445 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0435 \u0437\u0432\u0443\u043a\u0438 (\u043f\u043e\u043b\u0443\u0442\u043e\u043d\u0430) \u2014 \u043d\u043e\u0442\u044b \u0441 \u0434\u0438\u0435\u0437\u0430\u043c\u0438 \u0438 \u0431\u0435\u043c\u043e\u043b\u044f\u043c\u0438.<br \/>  \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043d\u043e\u0442\u044b \u0438 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u043e\u043b\u0443\u0442\u043e\u043d\u0430 \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438, \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044b\u0445 \u043d\u0430 \u0434\u0430\u043d\u043d\u043e\u0439 \u0440\u0430\u0441\u043a\u043b\u0430\u0434\u043a\u0435 \u0435\u0441\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043d\u043e\u043c\u0435\u0440 \u043d\u043e\u0442\u044b \u0432 MIDI (\u043e\u0442 21 \u0434\u043e 108). \u0421\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u0438\u0434\u043d\u043e \u0434\u0430\u043b\u0435\u0435.<br \/>  \u041d\u0430\u0434 \u043f\u0438\u0430\u043d\u0438\u043d\u043e \u0432\u0438\u0434\u043d\u043e \u0434\u0432\u0430 \u043d\u043e\u0442\u043d\u044b\u0445 \u0441\u0442\u0430\u043d\u0430 (\u0434\u0432\u0430 \u0440\u0430\u0437\u0430 \u043f\u043e \u043f\u044f\u0442\u044c \u043b\u0438\u043d\u0438\u0439). \u0412\u0435\u0440\u0445\u043d\u0438\u0439 \u2014 \u0441\u043a\u0440\u0438\u043f\u0438\u0447\u043d\u044b\u0439, \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u0432\u044b\u0441\u043e\u043a\u0438\u0435 \u043e\u043a\u0442\u0430\u0432\u044b, \u041d\u0438\u0436\u043d\u0438\u0439 \u2014 \u0431\u0430\u0441\u043e\u0432\u044b\u0439, \u0431\u043e\u043b\u0435\u0435 \u043d\u0438\u0437\u043a\u0438\u0435. \u0417\u0430\u0433\u043e\u0433\u0443\u043b\u0438\u043d\u044b \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0441\u0442\u0440\u043e\u043a \u2014 \u0437\u043d\u0430\u043a\u0438 \u0441\u043a\u0440\u0438\u043f\u0438\u0447\u043d\u043e\u0433\u043e \u0438 \u0431\u0430\u0441\u043e\u0432\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0435\u0439, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u043f\u0435\u0440\u0432\u0430\u044f \u043b\u0438\u043d\u0438\u044f \u0441\u043a\u0440\u0438\u043f\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u043d\u043e\u0442\u0443 \u041c\u0438(E) \u043f\u0435\u0440\u0432\u043e\u0439(4) \u043e\u043a\u0442\u0430\u0432\u044b, \u0430 \u043f\u0435\u0440\u0432\u0430\u044f \u0431\u0430\u0441\u043e\u0432\u043e\u0433\u043e \u2014 \u043d\u043e\u0442\u0443 \u0421\u043e\u043b\u044c(G) \u0431\u043e\u043b\u044c\u0448\u043e\u0439(2).<\/p>\n<h5>\u0422\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438<\/h5>\n<p>  \u0421\u043b\u0435\u0434\u043e\u043c \u0437\u0430 \u043a\u043b\u044e\u0447\u043e\u043c \u043d\u0430 \u043d\u043e\u0442\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432\u0438\u0434\u0438\u043c 4 \u0434\u0438\u0435\u0437\u0430. \u0422\u0430\u043a \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u043d\u0430 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u043e-\u0434\u0438\u0435\u0437 \u043c\u0438\u043d\u043e\u0440.<\/p>\n<p>  \u0414\u043b\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0439 \u0438\u0433\u0440\u044b \u0432 \u044d\u0442\u043e\u0439 \u0442\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043d\u0443\u0436\u043d\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u043d\u043e\u0442, \u043d\u0430 \u043b\u0438\u043d\u0438\u044f\u0445 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0430\u0440\u0438\u0441\u043e\u0432\u0430\u043d\u044b \u0434\u0438\u0435\u0437\u044b, \u0438\u0433\u0440\u0430\u0442\u044c \u0434\u0438\u0435\u0437\u044b (\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0441\u043f\u0440\u0430\u0432\u0430 \u043a\u043b\u0430\u0432\u0438\u0448\u0430) \u044d\u0442\u0438\u0445 \u043d\u043e\u0442. \u0414\u0438\u0435\u0437\u044b \u043d\u0430\u0440\u0438\u0441\u043e\u0432\u0430\u043d\u044b \u043d\u0430 \u043d\u043e\u0442\u0430\u0445 C, D, F, G. \u041f\u0440\u0438\u043d\u0446\u0438\u043f\u044b \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0442\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439 \u0440\u0430\u0441\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0443 \u2014 \u0441\u0435\u0439\u0447\u0430\u0441 \u043e\u043d\u0438 \u043d\u0435 \u0442\u0430\u043a \u0432\u0430\u0436\u043d\u044b \u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0432 \u0441\u0435\u0442\u0438 \u043c\u043d\u043e\u0433\u043e. \u0416\u0435\u043b\u0430\u044e\u0449\u0438\u0435 \u0434\u0430 \u0437\u0430\u0433\u0443\u0433\u043b\u044f\u0442. <\/p>\n<p>  \u0421\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0435\u0441\u043b\u0438 \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u043d\u043e\u0442\u044b C1, D1,..G7, \u043c\u044b\u0441\u043b\u0435\u043d\u043d\u043e \u043c\u0435\u043d\u044f\u0435\u043c \u0438\u0445 \u043d\u0430 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0438\u0435 \u0441\u043f\u0440\u0430\u0432\u0430 C1\u266f, D1\u266f,\u2026 G7\u266f \u0438 \u0443\u0436\u0435 \u043f\u043e\u0441\u043b\u0435 \u0438\u0449\u0435\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043d\u043e\u043c\u0435\u0440 \u0432 MIDI \u043d\u0443\u043c\u0435\u0440\u0430\u0446\u0438\u0438.<\/p>\n<h5>\u0417\u043d\u0430\u043a\u0438 \u0430\u043b\u044c\u0442\u0435\u0440\u0430\u0446\u0438\u0438 (\u266f, \u266e, \u266d)<\/h5>\n<p>  \u0415\u0441\u043b\u0438 \u044d\u0442\u0438 \u0437\u043d\u0430\u043a\u0438 \u0441\u0442\u043e\u044f\u0442 \u043d\u0435 \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438, \u0430 \u0433\u0434\u0435-\u0442\u043e \u0432 \u00ab\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u043c\u00bb \u043c\u0435\u0441\u0442\u0435, \u0442\u043e \u043e\u043d\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e, \u0434\u043e \u043a\u043e\u043d\u0446\u0430 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0442\u0430\u043a\u0442\u0430 (\u0442\u0430\u043a\u0442\u044b \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0447\u0435\u0440\u0442\u043e\u0439) \u0438\u0437\u043c\u0435\u043d\u044f\u044e\u0442 \u043d\u043e\u0442\u0443 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<br \/>   \u2014 \u041e\u0442\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0430\u043b\u044c\u0442\u0435\u0440\u0430\u0446\u0438\u044f \u044d\u0442\u043e\u0439 \u043d\u043e\u0442\u044b \u0432 \u044d\u0442\u043e\u0439 \u043e\u043a\u0442\u0430\u0432\u0435, \u0437\u0430\u0434\u0430\u043d\u043d\u0430\u044f \u0442\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u043e\u0442\u0430 \u04213\u266e \u0438 \u0432\u0441\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0437\u0430 \u043d\u0435\u0439 C3 \u0434\u043e \u043a\u043e\u043d\u0446\u0430 \u0442\u0430\u043a\u0442\u0430 (\u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0435\u0439 \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0447\u0435\u0440\u0442\u044b) \u0431\u0443\u0434\u0443\u0442 \u0438\u0433\u0440\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u043a \u04213;<br \/>  -\u266f \u043f\u043e\u0432\u044b\u0448\u0430\u0435\u0442 \u043d\u043e\u0442\u0443 \u043d\u0430 \u043f\u043e\u043b\u0442\u043e\u043d\u0430. A3\u266f \u0438 \u0432\u0441\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 A3 \u0434\u043e \u043a\u043e\u043d\u0446\u0430 \u0442\u0430\u043a\u0442\u0430 \u0438\u0433\u0440\u0430\u044e\u0442\u0441\u044f \u043a\u0430\u043a A3\u266f;<br \/>  -\u266d \u043f\u043e\u043d\u0438\u0436\u0430\u0435\u0442 \u043d\u043e\u0442\u0443 \u043d\u0430 \u043f\u043e\u043b\u0442\u043e\u043d\u0430. D3\u266d \u0438 \u0432\u0441\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 D3 \u0431\u0443\u0434\u0443\u0442 \u0438\u0433\u0440\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u043a C3\u266f (\u043e\u043d \u0436\u0435 D3\u266d).<\/p>\n<p>  \u0412\u0434\u0443\u043c\u0447\u0438\u0432\u044b\u0439 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c \u0443\u0436\u0435 \u0437\u0430\u043c\u0435\u0442\u0438\u043b, \u0447\u0442\u043e \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u00ab\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0434\u0438\u0435\u0437 \u0438 \u0431\u0435\u043c\u043e\u043b\u044c\u00bb \u043d\u0435 \u0438\u043c\u0435\u044e\u0442 \u0441\u043c\u044b\u0441\u043b\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u0442\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043b\u0443\u043d\u043d\u043e\u0439 \u0441\u043e\u043d\u0430\u0442\u044b \u043f\u0440\u0438 \u043d\u043e\u0442\u0430\u0445 \u0421, D, F, G \u043c\u043e\u0436\u043d\u043e \u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0438 \u043d\u0435 \u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0434\u0438\u0435\u0437. \u041d\u0438\u0447\u0435\u0433\u043e \u043e\u0442 \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c\u0441\u044f. \u0414\u0430, \u0434\u043b\u044f \u0442\u0430\u043a\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u0435\u0441\u0442\u044c \u0434\u0443\u0431\u043b\u044c-\u0434\u0438\u0435\u0437\u044b, \u043d\u043e \u043e\u043d\u0438 \u2014 \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u043c\u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438.<\/p>\n<h5>\u0414\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c<\/h5>\n<p>  \u041d\u043e\u0442\u0430 \u0432 \u043d\u043e\u0442\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u043c\u043e\u0436\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u043f\u043e\u043b\u044b\u0439 \u0438\u043b\u0438 \u0437\u0430\u043a\u0440\u0430\u0448\u0435\u043d\u043d\u044b\u0439 \u043a\u0440\u0443\u0436\u043e\u043a (\u0433\u043e\u043b\u043e\u0432\u043a\u0443), \u0438\u043c\u0435\u0442\u044c \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u0430\u043b\u043a\u0443 (\u0448\u0442\u0438\u043b\u044c) \u0438 \u0444\u043b\u0430\u0436\u043e\u043a. \u042d\u0442\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u043a\u0430\u043a\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0442\u0430\u043a\u0442\u0430 \u043f\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u043e\u0442\u0430 \u2014 \u0432\u0435\u0441\u044c \u0442\u0430\u043a\u0442, \u043f\u043e\u043b\u0442\u0430\u043a\u0442\u0430 \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435. \u041f\u0440\u0438\u0432\u043e\u0436\u0443 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443 \u0434\u043b\u044f \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>  <img decoding=\"async\" src=\"\/\/habrastorage.org\/files\/277\/5de\/734\/2775de734e254ab4a460e705654af133.jpg\"\/><\/p>\n<p>  \u0415\u0449\u0435 \u043e\u0434\u0438\u043d \u043d\u044e\u0430\u043d\u0441 \u2014 \u0442\u043e\u0447\u043a\u0438. \u0422\u043e\u0447\u043a\u0430 \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u043d\u043e\u0442\u044b \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u044d\u0442\u0430 \u043d\u043e\u0442\u0430 \u0437\u0432\u0443\u0447\u0438\u0442 \u043f\u043e\u043b\u0442\u043e\u0440\u044b \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, 1\/8 \u0441 \u0442\u043e\u0447\u043a\u043e\u0439 \u0437\u0432\u0443\u0447\u0438\u0442 \u043d\u0430 \u043f\u0440\u043e\u0442\u044f\u0436\u0435\u043d\u0438\u0438 1\/8 + 1\/16 = 3\/16 \u0434\u043e\u043b\u0438 \u0442\u0430\u043a\u0442\u0430. \u0421\u0440\u0430\u0437\u0443 \u043e\u0433\u043e\u0432\u043e\u0440\u044e\u0441\u044c \u0434\u043b\u044f \u0437\u043d\u0430\u0442\u043e\u043a\u043e\u0432, Adagio \u0432 beats per minute \u044f \u043d\u0435 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u043b, \u0430 \u0435\u0441\u043b\u0438 \u0431\u044b \u0438 \u043f\u0435\u0440\u0435\u0432\u0435\u043b, \u0442\u043e \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u044d\u0442\u0438\u043c 60-80 \u2014 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043d\u044f\u0442\u043d\u043e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0442\u0430\u043a\u0442\u0430 \u043f\u043e\u0434\u043e\u0431\u0440\u0430\u043d\u0430 \u043d\u0430 \u0441\u043b\u0443\u0445.<\/p>\n<p>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0437\u043d\u0430\u043d\u0438\u044f, \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0435\u043c \u043d\u043e\u0442\u044b \u0438 \u043f\u0435\u0440\u0435\u0432\u0435\u0434\u0435\u043c \u0438\u0445 \u0432 MIDI \u043f\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0435:<\/p>\n<p>  <img decoding=\"async\" src=\"\/\/habrastorage.org\/files\/c83\/f51\/dca\/c83f51dca72a4e6a948f1d184411202b.GIF\"\/><\/p>\n<p>  \u04212 -&gt; 37 (\u043d\u0430 \u043f\u043e\u043b\u0442\u043e\u043d\u0430 \u0432\u044b\u0448\u0435, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u0440\u043e \u0442\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u2014 \u0434\u043e-\u0434\u0438\u0435\u0437 \u043c\u0438\u043d\u043e\u0440)<br \/>  C3 -&gt; 49 <br \/>  G3 -&gt; 56 \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435.<\/p>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0438\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u043f\u043e\u0440\u043d\u0443\u044e, \u043d\u043e \u0440\u0430\u0431\u043e\u0447\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0442\u0430\u043a\u0442\u0430:<\/p>\n<pre><code class=\"javascript\">window.onload = function () { \tMIDI.loadPlugin({ \t\tsoundfontUrl: &quot;.\/soundfont\/&quot;, \t\tinstrument: &quot;acoustic_grand_piano&quot;, \t\tonprogress: function(state, progress) { \t\t\tconsole.log(state, progress); \t\t}, \t\tonsuccess: function() {   \t\t\tplay(); \t\t} \t}); };  function play() { \tvar delay = 0; \/\/ play one note every quarter second \tvar velocity = 127; \/\/ how hard the note hits \tvar gap = 0.6; \tvar duration = 0.4; \tMIDI.setVolume(0, 80); \t\/\/ \u043f\u0435\u0440\u0432\u044b\u0439 \u0442\u0430\u043a\u0442 \tdelay += gap; \tMIDI.noteOn(0, 49, velocity, delay); \tMIDI.noteOff(0, 49, delay + 4 * gap); \tMIDI.noteOn(0, 37, velocity, delay); \tMIDI.noteOff(0, 37, delay + 4 * gap);  \tMIDI.noteOn(0, 56, velocity, delay); \tMIDI.noteOff(0, 56, delay + duration); \tdelay += gap; \tMIDI.noteOn(0, 61, velocity, delay); \tMIDI.noteOff(0, 61, delay + duration); \tdelay += gap; \tMIDI.noteOn(0, 64, velocity, delay); \tMIDI.noteOff(0, 64, delay + duration);  \tdelay += gap; \tMIDI.noteOn(0, 56, velocity, delay); \tMIDI.noteOff(0, 56, delay + duration); \tdelay += gap; \tMIDI.noteOn(0, 61, velocity, delay); \tMIDI.noteOff(0, 61, delay + duration); \tdelay += gap; \tMIDI.noteOn(0, 64, velocity, delay); \tMIDI.noteOff(0, 64, delay + duration);  \tdelay += gap; \tMIDI.noteOn(0, 56, velocity, delay); \tMIDI.noteOff(0, 56, delay + duration); \tdelay += gap; \tMIDI.noteOn(0, 61, velocity, delay); \tMIDI.noteOff(0, 61, delay + duration); \tdelay += gap; \tMIDI.noteOn(0, 64, velocity, delay); \tMIDI.noteOff(0, 64, delay + duration);  \tdelay += gap; \tMIDI.noteOn(0, 56, velocity, delay); \tMIDI.noteOff(0, 56, delay + duration); \tdelay += gap; \tMIDI.noteOn(0, 61, velocity, delay); \tMIDI.noteOff(0, 61, delay + duration); \tdelay += gap; \tMIDI.noteOn(0, 64, velocity, delay); \tMIDI.noteOff(0, 64, delay + duration); } <\/code><\/pre>\n<p>  \u042d\u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0447\u0430\u043b\u043e, \u043d\u043e \u043d\u0435\u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u0443\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0442\u043e\u043c\u0438\u0442\u0441\u044f \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0442\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0430\u043b\u044c\u0442\u0435\u0440\u0430\u0446\u0438\u0438. \u0414\u0430 \u0438 \u043f\u0440\u043e\u0441\u0442\u044b\u043d\u0438 \u043a\u043e\u0434\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442\u0441\u044f \u0434\u043b\u0438\u043d\u043d\u044b\u0435. \u0410 \u044d\u0442\u043e \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u043f\u0435\u0440\u0432\u044b\u0439 \u0442\u0430\u043a\u0442. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u043d\u0430\u0446\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u043d\u0430 \u041e\u041e\u041f \u0433\u043b\u0430\u0437 \u0441\u0440\u0430\u0437\u0443 \u043d\u0430\u0439\u0434\u0435\u0442 \u043c\u0438\u0448\u0435\u043d\u0438 \u0434\u043b\u044f \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433\u0430. \u0412\u043c\u0435\u0441\u0442\u0435 \u0441 \u0442\u0435\u043c, \u0437\u0430\u0434\u0430\u0447\u0443 \u0432\u044b\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0437\u0432\u0443\u043a\u0430 \u043c\u043e\u0436\u043d\u043e \u0441\u043c\u0435\u043b\u043e \u043f\u0435\u0440\u0435\u043b\u043e\u0436\u0438\u0442\u044c \u043d\u0430 javascript.<\/p>\n<p>  \u041e\u043f\u0438\u0448\u0435\u043c \u0442\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c. \u0422\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u2014 \u0442\u0435\u0440\u043c\u0438\u043d \u0440\u0430\u0441\u043f\u043b\u044b\u0432\u0447\u0430\u0442\u044b\u0439. \u041d\u043e \u0432 \u043d\u0430\u0448\u0435\u043c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0442\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430\u044f \u0430\u043b\u044c\u0442\u0435\u0440\u0430\u0446\u0438\u044f \u043d\u043e\u0442 \u0432 \u044d\u0442\u043e\u0439 \u0442\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u041a\u0430\u043a \u0432\u044b \u043f\u043e\u043c\u043d\u0438\u0442\u0435, \u0432 \u0442\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0434\u043e-\u0434\u0438\u0435\u0437 \u043c\u0438\u043d\u043e\u0440 \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u043d\u043e\u0442\u044b C1, D1,..G7, \u0430 \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u0430 \u0438\u0445 \u043c\u0435\u0441\u0442\u043e C1\u266f, D1\u266f,\u2026 G7\u266f. \u042f \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0438\u043b \u0441\u0434\u0432\u0438\u0433 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0437 \u044d\u0442\u0438\u0445 \u043d\u043e\u0442 (+1 \u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e 1). 4 \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0434\u0438\u0435\u0437\u043e\u0432. \u0411\u0435\u043c\u043e\u043b\u0438 \u0431\u044b \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u043b\u0438\u0441\u044c \u043a\u0430\u043a -4. \u0417\u043d\u0430\u0442\u043e\u043a\u0438 \u043f\u043e\u0439\u043c\u0443\u0442, \u0447\u0442\u043e \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0443\u0437\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0440\u0430\u0437\u043d\u0438\u0446\u044b \u043c\u0435\u0436\u0434\u0443 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0442\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u0434\u043e-\u0434\u0438\u0435\u0437 \u043c\u0438\u043d\u043e\u0440 \u0438 \u043c\u0438-\u043c\u0430\u0436\u043e\u0440 \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u2014 \u043d\u0435\u0442. \u041e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435 \u0434\u0438\u0435\u0437\u044b \u043f\u0440\u0438 \u0442\u0435\u0445 \u0436\u0435 \u043d\u043e\u0442\u0430\u0445.<\/p>\n<p>  <i>\u041a\u043e\u0434 \u0434\u043b\u044f \u0441\u0442\u0430\u0442\u044c\u0438 \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0437\u0430\u0433\u0440\u043e\u043c\u043e\u0436\u0434\u0435\u043d\u043d\u044b\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435\u0442 JSDoc, \u043d\u0435 \u0431\u044b\u043b\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a JSHint \u0438 \u043f\u0440\u043e\u0447\u0435\u0433\u043e, \u043d\u043e \u0435\u0441\u0442\u044c \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438, \u043f\u0435\u0440\u0435\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0435 \u043d\u0430 \u0440\u0443\u0441\u0441\u043a\u0438\u0439.<\/i><\/p>\n<pre><code class=\"javascript\">var keys = {     4 : {         C : 1,         D : 1,         F : 1,         G : 1     } }; <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043e\u0431\u044a\u0435\u043a\u0442 \u0434\u043b\u044f \u043f\u0440\u043e\u0438\u0433\u0440\u044b\u0432\u0430\u043d\u0438\u044f:<\/p>\n<pre><code class=\"javascript\">var player = {     \/\/ \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0442\u0430\u043a\u0442\u0430     barDuration : 8,     \/\/ \u0448\u043a\u0430\u043b\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438     timeline : 0,     \/\/ \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0432\u0430\u0436\u043d\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440     velocity : 127,     \/\/ \u0443\u043a\u0430\u0436\u0435\u043c \u0442\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c     key : keys[4],     \/\/ \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0442\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043f\u043e \u0442\u0435\u043a\u0441\u0442\u0443     tempAlts : {},     \/\/ \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b - \u043d\u043e\u0442\u0430 \u043a\u0430\u043a \u0441\u0442\u0440\u043e\u043a\u0430, \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u043d\u0430\u0434\u043e \u043b\u0438 \u0441\u0434\u0432\u0438\u0433\u0430\u0442\u044c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0443 \u0432\u0440\u0435\u043c\u0435\u043d\u0438     play : function(noteString, duration, moveTime) {         \/\/ \u043f\u043e\u0434\u0441\u0447\u0435\u0442 \u043d\u043e\u0442\u044b \u0431\u0443\u0434\u0435\u0442 \u043d\u0438\u0436\u0435         var noteInt = this.calcNote(noteString);          MIDI.noteOn(0, noteInt, this.velocity, this.timeline);         \/\/ \u0437\u0432\u0443\u0447\u0430\u043d\u0438\u0435 \u043d\u043e\u0442\u044b \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0442\u0430\u043a\u0442\u0430 * \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043d\u043e\u0442\u044b \u0432 \u0442\u0430\u043a\u0442\u0435         MIDI.noteOff(0, noteInt, this.velocity, this.timeline + this.barDuration * duration);          if (typeof moveTime !== 'undefined' && moveTime === true) {             this.move(duration);         }     },     move : function(duration) {         this.timeline += this.barDuration * duration;         \/\/ \u0432 \u043a\u043e\u043d\u0446\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0430\u043a\u0442\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0434\u0438\u0435\u0437\u044b, \u0431\u0435\u043c\u043e\u043b\u0438 \u0438 \u0431\u0435\u043a\u0430\u0440\u044b \u043e\u0442\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f.         if (this.timeline % this.barDuration === 0) {             this.tempAlts = {};}     }, }; <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0435\u043b\u0438\u0437\u0443\u0435\u043c \u043f\u043e\u0434\u0441\u0447\u0435\u0442 \u043d\u043e\u0442\u044b \u0438 \u0435\u0449\u0435 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0443\u043b\u0443\u0447\u0448\u0438\u043c \u043a\u043e\u0434:<\/p>\n<pre><code class=\"javascript\">var player = {     barDuration : 8,     timeline : 0,     velocity : 127,     key : keys[4],     tempAlts : {},     play : function(noteString, duration, moveTime) {         var noteInt = this.calcNote(noteString);          MIDI.noteOn(0, noteInt, this.velocity, this.timeline);         MIDI.noteOff(0, noteInt, this.velocity, this.timeline + this.barDuration * duration);          if (typeof moveTime !== 'undefined' && moveTime === true) {             this.move(duration);         }     },     move : function(duration) {         this.timeline += this.barDuration * duration;         if (this.isEndOfBar()) {             this.tempAlts = {};}     },     calcNote : function(noteString) {         var note = noteString[0];         var noteWithOctave = noteString.substring(0,2);         \/\/ \u0435\u0441\u0442\u044c \u043b\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0437\u043d\u0430\u043a\u0438 \u0430\u043b\u044c\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u0438 \u043d\u043e\u0442\u0435         var altering = this.getAltering(noteString);         \/\/ \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0434\u0438\u0435\u0437\u044b, \u0431\u0435\u043c\u043e\u043b\u0438, \u0431\u0435\u043a\u0430\u0440\u044b         if (altering) {             this.setTempAltering(noteWithOctave, altering);         }         \/\/ \u0435\u0441\u043b\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0430\u043b\u044c\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u043d\u0435\u0442 - \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043d\u043e\u043c\u0435\u0440 \u043d\u043e\u0442\u044b \u0432 MIDI + \u0441\u0434\u0432\u0438\u0433 \u043f\u043e \u0442\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438         if (this.tempAlts[noteWithOctave] !== undefined) {             return MIDI.keyToNote[noteWithOctave] + this.tempAlts[noteWithOctave];         }         \/\/ \u0435\u0441\u043b\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0430\u043b\u044c\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0435\u0441\u0442\u044c - \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043d\u043e\u043c\u0435\u0440 \u043d\u043e\u0442\u044b \u0432 MIDI + \u0441\u0434\u0432\u0438\u0433 \u043f\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0430\u043b\u044c\u0442\u0435\u0440\u0430\u0446\u0438\u0438         \/\/ \u0442\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0437\u0434\u0435\u0441\u044c \u043d\u0435 \u0443\u0447\u0430\u0432\u0441\u0442\u0432\u0443\u0435\u0442         return MIDI.keyToNote[noteWithOctave] +                 (this.key[note] !== undefined ? this.key[note] : 0);     },     isEndOfBar : function() {         return !!(this.timeline % this.barDuration === 0)     },     \/\/ \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0437\u043d\u0430\u043a \u0430\u043b\u044c\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u0438 \u043d\u043e\u0442\u0435 \u0438\u043b\u0438 false     getAltering : function(noteString) {         var altering = noteString[2];         return altering !== undefined ? altering : false;     },     setTempAltering : function(noteWithOctave, altering) {         switch (altering) {             \/\/ \u0437\u043d\u0430\u043a \u0431\u0435\u043c\u043e\u043b\u044f \u043f\u0440\u0438 \u043d\u043e\u0442\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u043d\u0438\u0436\u0430\u0435\u0442 \u043d\u043e\u0442\u0443 \u043d\u0430 1 \u043f\u043e\u043b\u0443\u0442\u043e\u043d \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435              case 'b': this.tempAlts[noteWithOctave] = -1; break;             \/\/ \u0431\u0435\u043a\u0430\u0440 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0438\u043b \u043a\u0430\u043a &quot;%&quot;             case '%': this.tempAlts[noteWithOctave] = 0;  break;             case '#': this.tempAlts[noteWithOctave] = 1;  break;         }     } } <\/code><\/pre>\n<p>  \u041d\u0443 \u0438 \u0441\u0430\u043c\u0430 \u043d\u043e\u0442\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c:<\/p>\n<pre><code class=\"javascript\">    player.play('C2', 1);     player.play('C1', 1);     player.play('G3', 1\/12, true);     player.play('C4', 1\/12, true);     player.play('E4', 1\/12, true);     player.play('G3', 1\/12, true);     player.play('C4', 1\/12, true);     player.play('E4', 1\/12, true);     player.play('G3', 1\/12, true);     player.play('C4', 1\/12, true);     player.play('E4', 1\/12, true);     player.play('G3', 1\/12, true);     player.play('C4', 1\/12, true);     player.play('E4', 1\/12, true);     ... <\/code><\/pre>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0438\u0439\u0441\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043c\u043e\u0436\u043d\u043e \u0443\u0441\u043b\u044b\u0448\u0430\u0442\u044c <a href=\"https:\/\/cdn.rawgit.com\/tirnak\/MIDI.js\/master\/examples\/Betchoven.html\">\u0442\u0443\u0442<\/a> \u0438 \u0443\u0432\u0438\u0434\u0435\u0442\u044c <a href=\"https:\/\/github.com\/tirnak\/MIDI.js\/blob\/master\/examples\/Betchoven.html\">\u0437\u0434\u0435\u0441\u044c<\/a>. \u0421\u0434\u0435\u043b\u0430\u043b \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 7 \u0442\u0430\u043a\u0442\u043e\u0432 \u0438\u0437 19.             <\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/257813\/\"> http:\/\/habrahabr.ru\/post\/257813\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>             \u041a\u0430\u043a \u0441\u044b\u0433\u0440\u0430\u0442\u044c \u043d\u043e\u0442\u044b \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435? \u041a\u0430\u043a \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u0442\u044c \u043b\u044e\u0431\u043e\u0435 \u0434\u043b\u0438\u043d\u043d\u0435\u0439\u0448\u0435\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0434\u043e 107 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u043d\u043e\u0442 (\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0435\u0449\u0435 \u0438 \u0437\u0430\u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u0442\u044c) \u0438 \u043a\u0438\u043b\u043e\u0431\u0430\u0439\u0442\u0430-\u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0442\u0435\u043a\u0441\u0442\u0430? \u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043c\u0443\u0437\u044b\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0442\u0435\u043e\u0440\u0438\u0438, js-\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0438 MIDI \u043f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c.  <\/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-257078","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/257078","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=257078"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/257078\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=257078"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=257078"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=257078"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}