diff options
Diffstat (limited to 'animism-align/frontend/app/views/editor/sidebar/components/waveUpload.component.js')
| -rw-r--r-- | animism-align/frontend/app/views/editor/sidebar/components/waveUpload.component.js | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/animism-align/frontend/app/views/editor/sidebar/components/waveUpload.component.js b/animism-align/frontend/app/views/editor/sidebar/components/waveUpload.component.js index 3ca19f0..efd4bee 100644 --- a/animism-align/frontend/app/views/editor/sidebar/components/waveUpload.component.js +++ b/animism-align/frontend/app/views/editor/sidebar/components/waveUpload.component.js @@ -3,7 +3,7 @@ import { connect } from 'react-redux' import extractPeaks from 'webaudio-peaks' import actions from 'app/actions' -import { formatSize, timestampHMS } from 'app/utils' +import { formatSize, timestampHMS, commatize } from 'app/utils' import { Loader } from 'app/common' class WaveUpload extends Component { @@ -43,7 +43,7 @@ class WaveUpload extends Component { audioContext.decodeAudioData(arrayBuffer, (audioBuffer) => { // buffer, samplesPerPixel, isMono, startOffset, endOffset, bitResolution this.setState({ duration: audioBuffer.duration }) - var peaks = extractPeaks(audioBuffer, 441, true); + var peaks = extractPeaks(audioBuffer, audioBuffer.sampleRate / 5, true); console.log(peaks) const array = Array.from(peaks.data[0]) const peaksBlob = new Blob([ JSON.stringify(array) ], {type: "application/json"}); @@ -93,6 +93,8 @@ class WaveUpload extends Component { duration: null, size: null, }) + actions.align.loadPeaks(episode) + actions.audio.loadEpisodeAudio(episode) }) } @@ -143,11 +145,7 @@ class WaveUpload extends Component { <small>{episode.settings.audio.fn}</small> <small>{'Size: '}{formatSize(episode.settings.audio.size)}</small> <small>{'Duration: '}{timestampHMS(episode.settings.audio.duration)}</small> - </div> - )} - {peaks.length && ( - <div> - Peaks: {peaks.length} + <small>{'Peaks: '}{commatize(peaks.length)}</small> </div> )} <div className="uploadButton"> |
