jorisvaneyghen commited on
Commit
d9f938e
·
1 Parent(s): 397e431

Fix: audioplayer glitches

Browse files
Files changed (3) hide show
  1. index.html +3 -3
  2. js/AudioStretchPlayer.js +10 -2
  3. sw.js +1 -1
index.html CHANGED
@@ -1429,11 +1429,11 @@
1429
  const wavBlob = this.audioBufferToWav(audioSegment);
1430
  const audioUrl = URL.createObjectURL(wavBlob);
1431
 
1432
- // Load the segment into the AudioStretchPlayer
1433
- this.audioPlayer.loadAudioFromUrl(audioUrl);
1434
-
1435
  // Update UI highlights
1436
  this.updateBarHighlights();
 
 
 
1437
  }
1438
 
1439
  extractAudioSegment(startTime, endTime, overlay = true) {
 
1429
  const wavBlob = this.audioBufferToWav(audioSegment);
1430
  const audioUrl = URL.createObjectURL(wavBlob);
1431
 
 
 
 
1432
  // Update UI highlights
1433
  this.updateBarHighlights();
1434
+
1435
+ // Load the segment into the AudioStretchPlayer
1436
+ this.audioPlayer.loadAudioFromUrl(audioUrl);
1437
  }
1438
 
1439
  extractAudioSegment(startTime, endTime, overlay = true) {
js/AudioStretchPlayer.js CHANGED
@@ -210,11 +210,19 @@ export default class AudioStretchPlayer {
210
  await this.stretch.addBuffers(channelBuffers);
211
 
212
  this.controlValues.loopEnd = this.audioDuration;
213
- // this.configChanged();
214
- this.controlsChanged();
215
 
216
  // Update duration display
217
  this.elements.duration.textContent = this.formatTime(this.audioDuration);
 
 
 
 
 
 
 
 
 
 
218
  }
219
 
220
  handleDrop(event) {
 
210
  await this.stretch.addBuffers(channelBuffers);
211
 
212
  this.controlValues.loopEnd = this.audioDuration;
 
 
213
 
214
  // Update duration display
215
  this.elements.duration.textContent = this.formatTime(this.audioDuration);
216
+
217
+ if (this.stretch) {
218
+ const obj = {
219
+ input: 0,
220
+ output: this.audioContext.currentTime + 0.15,
221
+ ...this.controlValues
222
+ };
223
+ this.stretch.schedule(obj);
224
+ }
225
+ this.audioContext.resume();
226
  }
227
 
228
  handleDrop(event) {
sw.js CHANGED
@@ -1,5 +1,5 @@
1
  // Use a version that you can update with each release
2
- const APP_VERSION = '0.1.15';
3
  const CACHE_NAME = `my-pwa-cache-${APP_VERSION}`;
4
 
5
  // List of files to cache
 
1
  // Use a version that you can update with each release
2
+ const APP_VERSION = '0.1.16';
3
  const CACHE_NAME = `my-pwa-cache-${APP_VERSION}`;
4
 
5
  // List of files to cache