Skip to content
Snippets Groups Projects
Commit c11b4a34 authored by Eric Rosenbaum's avatar Eric Rosenbaum
Browse files

Protect effects from error due to very short sound

parent e5a517a3
No related branches found
No related tags found
No related merge requests found
......@@ -171,6 +171,11 @@ class SoundEditor extends React.Component {
const trimStart = this.state.trimStart === null ? 0.0 : this.state.trimStart;
const trimEnd = this.state.trimEnd === null ? 1.0 : this.state.trimEnd;
// Offline audio context needs at least 2 samples
if (this.audioBufferPlayer.buffer.length < 2) {
return;
}
const effects = new AudioEffects(this.audioBufferPlayer.buffer, name, trimStart, trimEnd);
effects.process((renderedBuffer, adjustedTrimStart, adjustedTrimEnd) => {
const samples = renderedBuffer.getChannelData(0);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment