Skip to content

Commit b27e2cb

Browse files
Audio Trim Fix (#12580)
* trim fix * add changeset --------- Co-authored-by: gradio-pr-bot <[email protected]>
1 parent 1fa29ff commit b27e2cb

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

.changeset/long-wolves-yell.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@gradio/audio": patch
3+
"gradio": patch
4+
---
5+
6+
fix:Audio Trim Fix

js/audio/shared/utils.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ export const process_audio = async (
2828

2929
let trimmedLength = audioBuffer.length;
3030
let startOffset = 0;
31-
32-
if (start && end) {
31+
if (start != null && end != null) {
3332
startOffset = Math.round(start * sampleRate);
3433
const endOffset = Math.round(end * sampleRate);
3534
trimmedLength = endOffset - startOffset;

0 commit comments

Comments
 (0)