title: How to cut audiofile from input in browser with js, lamejs?
body: <p>I have input in my Vue component where i upload audiofile via @change, next i need to cut it, for example i have 30 seconds audio and i need to receive audio from 5 to 15 second.
  I have installed lamejs package to do that.</p>
  <p>But after all my operations with audio i receive cutted audio but without any sound, so i dont know where is the reason of that. Need help!</p>
  <p><strong>method which upload file</strong></p>
  <pre><code>async onUploadFile(event) {
          const fileData = event.target.files[0];
          this.file = fileData;
          await this.decodeFile(fileData);
      },
  </code></pre>
  <p><strong>method which decodes file to audioBuffer</strong></p>
  <pre><code>async onUploadFile(event) {
          const fileData = event.target.files[0];
          this.file = fileData;
          await this.decodeFile(fileData);
      },
  </code></pre>
  <p><strong>method which cut audio and encode it to mp3 and then receive blob url</strong></p>
  <pre><code>async audioBufferSlice(buffer, begin, end) {
          const audioContext = new AudioContext();
          const channels = buffer.numberOfChannels;
          const rate = buffer.sampleRate;
          const duration = buffer.duration;
  
          const startOffset = rate * begin;
          const endOffset = rate * end;
          const frameCount = endOffset - startOffset;
  
          const audioLength = endOffset - startOffset;
  
          let trimmedAudio = audioContext.createBuffer(
              buffer.numberOfChannels,
              audioLength,
              rate
          );
  
          for(var i = 0; i &lt; buffer.numberOfChannels; i++){
              trimmedAudio.copyToChannel(buffer.getChannelData(i).slice(begin, end), i);
          }
  
          var audioData = this.serializeAudioBuffer(trimmedAudio);
  
          let mp3Data = [];
          const sampleBlockSize = 1152;
  
          let mp3encoder = new lamejs.Mp3Encoder(2, audioData.sampleRate, 128);
  
          var left = new Int8Array(audioData.channels[0].length);
          var right = new Int8Array(audioData.channels[1].length);
  
          for (var i = 0; i &lt; audioData.channels[0].length; i += sampleBlockSize) {
              var leftChunk = left.subarray(i, i + sampleBlockSize);
              var rightChunk = right.subarray(i, i + sampleBlockSize);
              var mp3buf = await mp3encoder.encodeBuffer(leftChunk, rightChunk);
              if (mp3buf.length &gt; 0) {
                  mp3Data.push(mp3buf);
              }
          }
  
          let buf = await mp3encoder.flush();
  
          if (buf.length &gt; 0) {
              mp3Data.push(buf);
          }
  
          var blob = new Blob(mp3Data, {type: 'audio/mp3'});
          var url = window.URL.createObjectURL(blob);
          console.log('MP3 URl: ', url);
      },
  </code></pre>
  <p>What did I do wrong that I receive cut audio but without any sound?
  I look at that repository as example <a href="https://github.com/Vinit-Dantkale/AudioFy" rel="nofollow noreferrer">https://github.com/Vinit-Dantkale/AudioFy</a></p>