{"id":210422,"date":"2014-01-27T10:53:03","date_gmt":"2014-01-27T06:53:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=210422"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=210422","title":{"rendered":"<span class=\"post_title\">\u041f\u0440\u043e\u0431\u0443\u0435\u043c Audio API \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430<\/span>"},"content":{"rendered":"<div class=\"content html_format\"> \t\t\t<img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/50e\/5a9\/6cf\/50e5a96cfff37c69b6f63c58465469a8.jpg\" height=\"250\" align=\"left\"\/><br \/>  Web Audio API \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0442\u0435\u0445 \u043d\u043e\u0432\u0438\u043d\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0441\u0435\u0439\u0447\u0430\u0441 \u043d\u0430\u043f\u0438\u0447\u043a\u0430\u043d\u044b \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u044b \u0438 \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u043f\u043e\u0434\u0440\u0443\u0436\u0438\u0442\u044c\u0441\u044f \u043f\u043e\u0431\u043b\u0438\u0436\u0435 \u0438 \u0445\u043e\u0442\u044c \u043a\u0430\u043a-\u0442\u043e \u043f\u0440\u043e\u043d\u0438\u043a\u043d\u0443\u0442\u044c\u0441\u044f \u0442\u0435\u043c, \u0447\u0442\u043e \u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u0442\u0432\u043e\u0440\u0438\u0442\u044c. \u0427\u0442\u043e \u0431\u044b \u043f\u0440\u043e\u043d\u0438\u043a\u043d\u0443\u0442\u044c\u0441\u044f, \u044f \u0440\u0435\u0448\u0438\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0438\u0439 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0430\u0443\u0434\u0438\u043e.<\/p>\n<p>  \u041d\u043e \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043d\u0430\u0447\u0430\u0442\u044c \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441 Audio API, \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u0431\u0440\u043e\u0441\u0430\u0442\u044c \u0437\u0430\u0433\u043e\u0442\u043e\u0432\u043a\u0443 \u043d\u0430\u0448\u0435\u0433\u043e \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u0438 \u0434\u0435\u043b\u0430\u0442\u044c \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u044d\u0442\u043e \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 canvas.<\/p>\n<p>  <a name=\"habracut\"><\/a>  <\/p>\n<h2>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0437\u0430\u0433\u043e\u0442\u043e\u0432\u043a\u0438<\/h2>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430 \u044d\u0442\u0430 \u0447\u0430\u0441\u0442\u044c \u0442\u043e \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0435\u0451.   <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0437\u0430\u0433\u043e\u0442\u043e\u0432\u043a\u0438<\/b><\/p>\n<div class=\"spoiler_text\">\u0418\u0442\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0445\u043e\u043b\u0441\u0442:  <\/p>\n<pre><code class=\"javascript\">var canva = document.createElement('canvas'); var ctx = canva.getContext('2d'); \/\/\u0414\u0435\u043b\u0430\u0435\u043c \u043d\u0430\u0448 \u0445\u043e\u043b\u0441\u0442 \u043d\u0430 \u0432\u0441\u044e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 canva.width = window.innerWidth; canva.height = window.innerHeight; \/\/\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0435\u0433\u043e \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 document.body.appendChild(canvas); <\/code><\/pre>\n<p>  \u041e\u0442\u043b\u0438\u0447\u043d\u043e, \u0445\u043e\u043b\u0441\u0442 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0438 \u0434\u0430\u043b\u0435\u0435 \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438 \u0431\u0443\u0434\u0443\u0442 \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u0437\u0430 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0437\u0432\u0443\u043a\u043e\u0432\u043e\u0433\u043e \u0441\u0438\u0433\u043d\u0430\u043b\u0430. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u0431\u0443\u0434\u0443\u0442 \u043e\u0431\u044b\u0447\u043d\u044b\u0435 \u043a\u0440\u0443\u0433\u0438:<\/p>\n<pre><code class=\"javascript\">var particles = [];\/\/\u0422\u0443\u0442 \u0431\u0443\u0434\u0443\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f \u0432\u0441\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435 \u0447\u0430\u0441\u0442\u0438\u0446\u044b var createParticles = function () {     var particle = null;     for (var i = 0; i &lt; 50; i++) {         particle = new Particle();         particles.push(particle);     }     \/\/\u0422\u0443\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0444-\u044e \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438      setInterval(draw,33); } <\/code><\/pre>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u044f draw, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0448\u0438 \u043a\u0440\u0443\u0433\u0438, \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"javascript\">var draw = function () {     \/\/\u041e\u0447\u0438\u0449\u0430\u0435\u043c \u0445\u043e\u043b\u0441\u0442 \u043f\u0435\u0440\u0435\u0434 \u043d\u043e\u0432\u043e\u0439 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u043e\u0439      ctx.clearRect(0, 0, canva.width, canva.height);     for (var i = 0; i &lt; 50; i++) {         var loc = particles[i];         loc.draw();     } } <\/code><\/pre>\n<p>  \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043d\u0430\u0448\u0430 \u0437\u0430\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0433\u043e\u0442\u043e\u0432\u0430, \u043e\u0441\u0442\u0430\u043b\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0447\u0430\u0441\u0442\u0438\u0446\u044b Particle.<\/p>\n<pre><code class=\"javascript\">var Particle = function () {        this.init(); };  Particle.prototype = {     init: function () {          this.x = random(canva.width);          this.y = random(canva.height);          this.level = 1 * random(4);          this.speed = random(0.2, 1);          this.radius = random(10, 70); \/\/\u0440\u0430\u0434\u0438\u0443\u0441 \u0447\u0430\u0441\u0442\u0438\u0446          this.color = random(['#69D2E7', '#A7DBD8', '#E0E4CC', '#F38630', '#FA6900', '#FF4E50', '#F9D423']); \/\/\u0446\u0432\u0435\u0442 \u0447\u0430\u0441\u0442\u0438\u0446\u044b          this.opacity = random(0.2, 1);          this.band = Math.floor(random(128));      },      draw: function () {          var pulsar, scale;          pulsar = Math.exp(this.pulse);          scale = pulsar * this.radius || this.radius;          ctx.save();          ctx.beginPath(); \/\/\u041d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0443 \u0444\u0438\u0433\u0443\u0440\u044b          ctx.arc(this.x, this.y, scale, 0, Math.PI * 2);          ctx.fillStyle = this.color; \/\/\u0446\u0432\u0435\u0442          ctx.globalAlpha = this.opacity \/ this.level; \/\/\u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0441\u0442\u044c          ctx.closePath();          ctx.fill();          ctx.strokeStyle = this.color; \/\/\u0446\u0432\u0435\u0442 \u0440\u0430\u043c\u043a\u0438          ctx.stroke();          ctx.restore();            this.move();       },       move: function () {           this.y -= this.speed * this.level;                       \/\/\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0432 \u043d\u0430\u0447\u0430\u043b\u043e \u0447\u0430\u0441\u0442\u0438\u0446\u044b \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u0448\u043b\u0438 \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u044b \u0445\u043e\u043b\u0441\u0442\u0430           if (this.y &lt; -100) {               this.y = canva.height;           }       } } \/\/\u0418 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0444-\u0438  var random: function( min, max ) {     if (this.isArray( min )) {         return min[ ~~( Math.random() * min.length ) ];     }     if (!this.isNumber(max)) {         max = min || 1, min = 0;     }     return min + Math.random() * ( max - min );  }, \/\/\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430 \u043c\u0430\u0441\u0441\u0438\u0432 var isArray: function(object) {     return Object.prototype.toString.call( object ) == '[object Array]'; }, \/\/\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430 \u0447\u0438\u0441\u043b\u043e var isNumber: function(object) {     return typeof object == 'number'; } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<h2>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440<\/h2>\n<p>  \u0418\u0442\u0430\u043a, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0432\u0441\u0435, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0447\u0430\u0442\u044c \u043f\u0438\u0441\u0430\u0442\u044c \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440. \u0413\u043b\u0430\u0432\u043d\u0443\u044e \u0440\u043e\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u0438\u0433\u0440\u0430\u0442\u044c \u043f\u043e\u043d\u044f\u0442\u0438\u0435 AudioContext. \u0423 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442, \u043d\u043e \u044d\u0442\u043e\u0433\u043e \u0432\u043f\u043e\u043b\u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435, \u0447\u0442\u043e \u0432\u0430\u0448\u0435\u0439 \u0434\u0443\u0448\u0435 \u0443\u0433\u043e\u0434\u043d\u043e. \u041f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0441\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 AudioContext. \u041f\u043e\u043b\u043d\u044b\u0439 \u0438\u0445 \u0441\u043f\u0438\u0441\u043e\u043a \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/API\/AudioContext\">\u0442\u0443\u0442<\/a>. \u0422\u0430\u043a \u043a\u0430\u043a \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f AudioContext \u0434\u043e \u043a\u043e\u043d\u0446\u0430 \u0435\u0449\u0435 \u043d\u0435 \u043e\u0434\u043e\u0431\u0440\u0435\u043d\u0430, \u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043c\u044b \u0435\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0442 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"javascript\">var AudioContext = w.AudioContext || w.webkitAudioContext; var context = new AudioContext (); <\/code><\/pre>\n<p>  \u042d\u0442\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c AudioContext \u0432 Opera, Chrome \u0438 Firefox. \u041e\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043d\u0430\u043c\u0438 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b:<\/p>\n<ol>\n<li><b>createScriptProcessor (\u0411\u044b\u0432\u0448\u0438\u0439 createJavaScriptNode)<\/b> \u2014 \u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u0430, \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438\u043b\u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0430\u0443\u0434\u0438\u043e-\u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 js. \u0423 \u044d\u0442\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0438 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0435 <b>onaudioprocess<\/b>, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0430\u0441\u0442\u0443\u043f\u0430\u0435\u0442, \u043a\u043e\u0433\u0434\u0430 \u043d\u0430 \u0432\u0445\u043e\u0434 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. <br \/>  \u041f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043c\u0435\u0442\u043e\u0434 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0442\u0440\u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 <b>bufferSize<\/b> \u2014 \u0420\u0430\u0437\u043c\u0435\u0440 \u0431\u0443\u0444\u0435\u0440\u0430, <b>numInputChannels<\/b> \u2014 \u043a\u043e\u043b-\u0432\u043e \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u043a\u0430\u043d\u0430\u043b\u043e\u0432 \u0432 \u043f\u043e\u0442\u043e\u043a\u0435, <b>numOutputChannels<\/b> \u2014 \u043a\u043e\u043b-\u0432\u043e \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0445 \u043a\u0430\u043d\u0430\u043b\u043e\u0432.   <\/li>\n<li><b>createMediaElementSource<\/b> \u2014 \u0421\u043e\u0437\u0434\u0430\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0437\u0432\u0443\u043a\u0430 \u043e\u0442 \u0430\u0443\u0434\u0438\u043e \u0438\u043b\u0438 \u0432\u0438\u0434\u0435\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430. \u041f\u043e\u0441\u043b\u0435 \u0432\u044b\u0437\u043e\u0432\u0430 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u0430\u0443\u0434\u0438\u043e \u043f\u043e\u0442\u043e\u043a \u0441 \u0430\u0443\u0434\u0438\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u043d\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0432 AudioContext.   <\/li>\n<li><b>createAnalyser<\/b> \u2014 \u0414\u0430\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0447\u0430\u0441\u0442\u043e\u0442\u043d\u044b\u0445 \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u0445 \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u0432 \u0432\u0438\u0434\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0434\u0430\u043d\u043d\u044b\u0445. \u041c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u043d\u0430\u0448 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043a \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0443 \u0430\u0443\u0434\u0438\u043e \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u0438 \u043a \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u044e \u0437\u0432\u0443\u043a\u0430.   <\/li>\n<\/ol>\n<p>  \u0418\u0442\u0430\u043a, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0442\u043e, \u0447\u0442\u043e \u043c\u044b \u0432\u044b\u044f\u0441\u043d\u0438\u043b\u0438 \u043f\u043e \u043f\u043e\u0432\u043e\u0434\u0443 AudioContext, \u043d\u0430\u0431\u0440\u043e\u0441\u0430\u0435\u043c \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u043d\u0430\u0448\u0435\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430:<\/p>\n<pre><code class=\"javascript\">var Analyze = function () {     var AudioContext = w.AudioContext || w.webkitAudioContext;         this.context = new AudioContext();     this.node = this.context.createScriptProcessor(2048, 1, 1);     this.analyser = this.context.createAnalyser();     this.analyser.smoothingTimeConstant = 0.3;     this.analyser.fftSize = 512;          this.bands = new Uint8Array(this.analyser.frequencyBinCount); } <\/code><\/pre>\n<p>  \u042d\u0442\u0430 \u0444-\u044f \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u043d\u0430\u043c \u0430\u0443\u0434\u0438\u043e \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445. \u0422\u0443\u0442 \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u043c\u044b \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 <b>smoothingTimeConstant <\/b> \u2014 \u0447\u0430\u0441\u0442\u043e\u0442\u0430 \u043e\u043f\u0440\u043e\u0441\u0430 \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0431\u0443\u0434\u0435\u0442 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 <b>fftSize<\/b> \u2014 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0424\u0443\u0440\u044c\u0435 (\u0433\u0440\u0443\u0431\u043e \u0433\u043e\u0432\u043e\u0440\u044f, \u044d\u0442\u043e\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0447\u0430\u0441\u0442\u043e\u0442\u043d\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0441\u0438\u0433\u043d\u0430\u043b\u0430, \u044d\u0442\u043e \u043a\u043e\u043b-\u0432\u043e \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u043d\u043e fftSize\/2). \u0424\u0443\u043d\u043a\u0446\u0438\u044e <b>Uint8Array<\/b> \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0441 \u0447\u0435\u0442\u043a\u0438\u043c \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435\u043c \u0433\u0440\u0430\u043d\u0438\u0446, \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0435\u0433\u043e \u0434\u043b\u0438\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u043d\u0430 256.<\/p>\n<pre><code class=\"javascript\">[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \u2026] <\/code><\/pre>\n<p>  \u041f\u043e\u043a\u0430 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u0443 \u043d\u0430\u0441 \u0448\u0430\u0440\u043e\u043c \u043f\u043e\u043a\u0430\u0442\u0438, \u043d\u043e \u044d\u0442\u043e \u0438 \u043d\u0435 \u0443\u0434\u0438\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u0432\u0435\u0434\u044c \u043d\u0435\u0442 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u0441\u0438\u0433\u043d\u0430\u043b\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0434\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043d\u0430\u0448 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 audio \u2014 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430, \u0430 \u0437\u0430\u043e\u0434\u043d\u043e \u0438 \u043f\u043e\u0434\u043f\u0438\u0448\u0435\u043c\u0441\u044f \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 <b>canplay<\/b> \u0434\u043b\u044f \u043d\u0435\u0433\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442, \u043a\u043e\u0433\u0434\u0430 \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u0441\u0447\u0438\u0442\u0430\u0435\u0442, \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0447\u0430\u0442\u044c \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435. \u0421 \u0443\u0447\u0435\u0442\u043e\u043c \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u0448 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u043f\u0440\u0438\u043c\u0435\u0442 \u0432\u0438\u0434:<\/p>\n<pre><code class=\"javascript\">var Analyze = function () {     var AudioContext = w.AudioContext || w.webkitAudioContext;         \/\/\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430     this.audio = new Audio();     this.audio.src = &quot;test1.ogg&quot;;     this.controls = true;     \/\/\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0430\u0443\u0434\u0438\u043e-\u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442     this.context = new AudioContext();     this.node = this.context.createScriptProcessor(2048, 1, 1);     \/\/\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440     this.analyser = this.context.createAnalyser();     this.analyser.smoothingTimeConstant = 0.3;     this.analyser.fftSize = 512;     this.bands = new Uint8Array(this.analyser.frequencyBinCount);      \/\/\u041f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c\u0441\u044f \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0435     this.audio.addEventListener(&quot;canplay&quot;, function () {}); } <\/code><\/pre>\n<p>  \u041d\u0430\u043c \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043d\u0430\u0448 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0430\u0443\u0434\u0438\u043e \u043f\u043e\u0442\u043e\u043a \u0432 AudioContext \u0438 \u0441\u0432\u044f\u0437\u0430\u0442\u044c \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0441 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u043c \u0438 \u043f\u0440\u0438\u0435\u043c\u043d\u0438\u043a\u043e\u043c. \u0421\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043b\u0435\u0433\u043a\u043e, \u0432\u0435\u0434\u044c \u0443\u043c\u043d\u044b\u0435 \u043b\u044e\u0434\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b\u0438 Web Audio API, \u043f\u043e\u0437\u0430\u0431\u043e\u0442\u0438\u043b\u0438\u0441\u044c \u043e\u0431 \u044d\u0442\u043e\u043c \u0438 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0438\u043c \u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e audio \u2014 \u043c\u043e\u0434\u0443\u043b\u044f \u0435\u0441\u0442\u044c \u043c\u0435\u0442\u043e\u0434 <b>connect<\/b>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0438 \u043d\u0430\u0434\u043e \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0442\u044c\u0441\u044f. \u0418\u0442\u043e\u0433\u043e, \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0432\u0438\u0434 \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a\u0438\u043c:<\/p>\n<pre><code class=\"javascript\">var Analyse = function () {           var an= this,           AudioContext = w.AudioContext || w.webkitAudioContext;            \/\/\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430           this.audio = new Audio();           this.audio.src = &quot;test1.ogg&quot;;           this.controls = true;           \/\/\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0430\u0443\u0434\u0438\u043e-\u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442           this.context = new AudioContext();           this.node = this.context.createScriptProcessor(2048, 1, 1);           \/\/\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440           this.analyser = this.context.createAnalyser();           this.analyser.smoothingTimeConstant = 0.3;           this.analyser.fftSize = 512;           this.bands = new Uint8Array(this.analyser.frequencyBinCount);           \/\/\u041f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c\u0441\u044f \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0435           this.audio.addEventListener('canplay', function () {                      \/\/\u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0432  AudioContext                      an.source = an.context.createMediaElementSource(an.audio);                     \/\/\u0441\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u043c \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u043e\u043c                     an.source.connect(an.analyser);                     \/\/\u0441\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u043c \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0441 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u043c, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435                     an.analyser.connect(an.node);                     \/\/\u0421\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u043c \u0432\u0441\u0435 \u0441 \u0432\u044b\u0445\u043e\u0434\u043e\u043c                     an.node.connect(an.context.destination);                     an.source.connect(an.context.destination);                     \/\/\u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c\u0441\u044f \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445                     an.node.onaudioprocess = function () {                         an.analyser.getByteFrequencyData(an.bands);                         if (!an.audio.paused) {                             if (typeof an.update === &quot;function&quot;) {                                 return an.update(an.bands);                             } else {                                 return 0;                             }                         }                     };             });              return this;         }; <\/code><\/pre>\n<p>  \u0422\u0443\u0442 \u0441\u0442\u043e\u0438\u0442 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044c \u043e <b>AudioContext.destination<\/b> \u2014 \u044d\u0442\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0437\u0432\u0443\u043a\u043e\u0432\u043e\u0439 \u0432\u044b\u0445\u043e\u0434 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e (\u043e\u0431\u044b\u0447\u043d\u043e \u044d\u0442\u043e \u043a\u043e\u043b\u043e\u043d\u043a\u0438). \u041c\u0435\u0442\u043e\u0434 <b>getByteFrequencyData<\/b> \u2014 \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0442 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u0438 \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u0442 \u0438\u0445 \u0432 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0432 \u0438\u0442\u043e\u0433\u0435 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c, \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0432\u0435\u043b\u0438\u043a\u043e\u0439 \u043c\u0430\u0433\u0438\u0438 \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u0439. <\/p>\n<p>  \u0414\u043e\u043f\u0438\u0448\u0435\u043c \u0432 \u043d\u0430\u0448\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e createParticles \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430, \u0432 \u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043c:<\/p>\n<pre><code class=\"javascript\">var createParticles = function () {     var particle = null, audio = null;     for (var i = 0; i &lt; 50; i++) {         particle = new Particle();         particles.push(particle);     }     \/\/\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440     elem = new Analyse();    \/\/\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 audio \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443    document.body.appendChild(elem.audio);    \/\/\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u043e\u043c \u043a \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u043c \u0447\u0430\u0441\u0442\u0438\u0446\u0430\u043c    audio.update = function (bands) {        var ln = 50;         while (ln--) {             var loc = particles[ln];             loc.pulse = bands[loc.band] \/ 256;         }    };     \/\/\u0422\u0443\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438      setInterval(draw,33); } <\/code><\/pre>\n<p>  \u0412\u043e\u0442 \u0438 \u0432\u0441\u0435, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0441\u0432\u043e\u0439 \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0438\u0439 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043e\u0442\u043a\u0440\u044b\u043b\u0438 \u0437\u0430\u0432\u0435\u0441\u0443 \u043d\u0430\u0434 Web Audio API. \u0412\u0441\u044f \u044d\u0442\u0430 \u043f\u0440\u0435\u043b\u0435\u0441\u0442\u044c \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 Chrome, Opera, Firefox. IE, \u043a\u0430\u043a \u0438 \u0432\u0441\u0435\u0433\u0434\u0430, \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0437\u0430 \u0431\u043e\u0440\u0442\u043e\u043c. <br \/>  \u041d\u0435\u043c\u043d\u043e\u0433\u043e \u0431\u043e\u043b\u0435\u0435 \u043d\u0430\u0432\u043e\u0440\u043e\u0447\u0435\u043d\u043d\u0430\u044f \u0434\u0435\u043c\u043a\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434: <a href=\"http:\/\/phalcon.demosite.pro\/\">demo<\/a><br \/>  \u041a\u043e\u0434 \u0434\u0435\u043c\u043a\u0438 \u043d\u0430 github: <a href=\"https:\/\/github.com\/abaddonGIT\/woolVisualizer\">Analyser<\/a><br \/>  \u041a\u043e\u0434 \u043d\u0430 codepen: <a href=\"http:\/\/codepen.io\/abaddonGIT\/pen\/qeswC\">Analyser<\/a><\/p>\n<p>  \u041a\u043e\u043d\u0435\u0447\u043d\u043e \u044d\u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0442\u0435\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u0435\u043d Audio API, \u043d\u043e \u043d\u0430\u0434\u043e \u0436\u0435 \u0441 \u0447\u0435\u0433\u043e-\u0442\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c. \u0423\u0436\u0435 \u0441\u0435\u0439\u0447\u0430\u0441 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c Audio API \u0434\u043b\u044f:  <\/p>\n<ul>\n<li>\u041e\u0431\u044a\u0435\u043c\u043d\u044b\u0439 \u0437\u0432\u0443\u043a \u0434\u043b\u044f \u0438\u0433\u0440<\/li>\n<li>\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0437\u0432\u0443\u043a\u0430<\/li>\n<li>\u0410\u0443\u0434\u0438\u043e \u0441\u0438\u043d\u0442\u0435\u0437<\/li>\n<\/ul>\n<p>  \u0438 \u0434\u043b\u044f \u043c\u043d\u043e\u0433\u043e\u0433\u043e \u0434\u0440\u0443\u0433\u043e\u0433\u043e.<\/p>\n<p>  \u041f\u043e\u043b\u0435\u0437\u043d\u043e\u0435 \u0447\u0442\u0438\u0432\u043e:  <\/p>\n<ul>\n<li><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/API\/AudioContext\">developer.mozilla.org\/en-US\/docs\/Web\/API\/AudioContext<\/a><\/li>\n<li><a href=\"http:\/\/www.html5rocks.com\/en\/tutorials\/webaudio\/intro\/\">www.html5rocks.com\/en\/tutorials\/webaudio\/intro\/<\/a><\/li>\n<li><a href=\"http:\/\/creativejs.com\/resources\/web-audio-api-getting-started\/\">creativejs.com\/resources\/web-audio-api-getting-started\/<\/a><\/li>\n<li><a href=\"http:\/\/blogs.msdn.com\/b\/ie\/archive\/2011\/05\/13\/unlocking-the-power-of-html5-lt-audio-gt.aspx\">blogs.msdn.com\/b\/ie\/archive\/2011\/05\/13\/unlocking-the-power-of-html5-lt-audio-gt.aspx<\/a><\/li>\n<li><a href=\"http:\/\/updates.html5rocks.com\/2012\/02\/HTML5-audio-and-the-Web-Audio-API-are-BFFs\">updates.html5rocks.com\/2012\/02\/HTML5-audio-and-the-Web-Audio-API-are-BFFs<\/a><\/li>\n<li><a href=\"http:\/\/css.dzone.com\/articles\/exploring-html5-web-audio\">css.dzone.com\/articles\/exploring-html5-web-audio<\/a><\/li>\n<\/ul>\n<div class=\"clear\"><\/div>\n<\/p><\/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\/210422\/\"> http:\/\/habrahabr.ru\/post\/210422\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\"> \t\t\t<img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/50e\/5a9\/6cf\/50e5a96cfff37c69b6f63c58465469a8.jpg\" height=\"250\" align=\"left\"\/><br \/>  Web Audio API \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0442\u0435\u0445 \u043d\u043e\u0432\u0438\u043d\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0441\u0435\u0439\u0447\u0430\u0441 \u043d\u0430\u043f\u0438\u0447\u043a\u0430\u043d\u044b \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u044b \u0438 \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u043f\u043e\u0434\u0440\u0443\u0436\u0438\u0442\u044c\u0441\u044f \u043f\u043e\u0431\u043b\u0438\u0436\u0435 \u0438 \u0445\u043e\u0442\u044c \u043a\u0430\u043a-\u0442\u043e \u043f\u0440\u043e\u043d\u0438\u043a\u043d\u0443\u0442\u044c\u0441\u044f \u0442\u0435\u043c, \u0447\u0442\u043e \u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u0442\u0432\u043e\u0440\u0438\u0442\u044c. \u0427\u0442\u043e \u0431\u044b \u043f\u0440\u043e\u043d\u0438\u043a\u043d\u0443\u0442\u044c\u0441\u044f, \u044f \u0440\u0435\u0448\u0438\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0438\u0439 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0430\u0443\u0434\u0438\u043e.<\/p>\n<p>  \u041d\u043e \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043d\u0430\u0447\u0430\u0442\u044c \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441 Audio API, \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u0431\u0440\u043e\u0441\u0430\u0442\u044c \u0437\u0430\u0433\u043e\u0442\u043e\u0432\u043a\u0443 \u043d\u0430\u0448\u0435\u0433\u043e \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u0438 \u0434\u0435\u043b\u0430\u0442\u044c \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u044d\u0442\u043e \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 canvas.<\/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-210422","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/210422","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=210422"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/210422\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=210422"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=210422"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=210422"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}