Skip to content
This repository was archived by the owner on Nov 21, 2024. It is now read-only.

Commit b320dbc

Browse files
committed
pcm -> mp3
1 parent de2a83b commit b320dbc

File tree

5 files changed

+2
-10
lines changed

5 files changed

+2
-10
lines changed

docs/sample.mp3

88.5 KB
Binary file not shown.

public/sample.mp3

88.5 KB
Binary file not shown.

public/sample.pcm

-15.1 MB
Binary file not shown.

src/components/Footer.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -143,16 +143,7 @@ const Waveform = memo(
143143
},
144144
});
145145

146-
fetch('/sample.pcm')
147-
.then((res) => res.arrayBuffer())
148-
.then((buffer) => {
149-
waveform.load({
150-
sampleRate: 44100,
151-
getChannelData() {
152-
return new Float32Array(buffer);
153-
},
154-
});
155-
});
146+
waveform.load('/sample.mp3');
156147
}, [player, $waveform, setWaveform, setRender]);
157148

158149
return <div className="waveform" ref={$waveform} />;

src/components/Tool.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ export default function Header({
241241
const output = `${Date.now()}.mp3`;
242242
await ffmpeg.run('-i', file.name, '-ac', '1', '-ar', '8000', output);
243243
const uint8 = ffmpeg.FS('readFile', output);
244+
// download(URL.createObjectURL(new Blob([uint8])), `${output}`);
244245
await waveform.decoder.decodeAudioData(uint8);
245246
// download(URL.createObjectURL(new Blob([waveform.decoder.channelData])), `${Date.now()}.pcm`);
246247
waveform.drawer.update();

0 commit comments

Comments
 (0)