Skip to content

Commit f02542a

Browse files
authored
Refactor audio blob creation and fix label text
1 parent bc14144 commit f02542a

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

App.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -535,11 +535,9 @@ const App: React.FC = () => {
535535
} catch (chunkErr: any) { throw new Error(`Sequence ${i+1} Failed: ${chunkErr.message}`); }
536536
}
537537

538+
const concatenated = concatenateBuffers(audioParts);
538539
const isMpeg = narrationProvider === 'elevenlabs' || narrationProvider === 'resemble';
539-
const audioBlob = isMpeg
540-
? new globalThis.Blob([concatenateBuffers(audioParts)], { type: 'audio/mpeg' })
541-
: pcmToWavBlob(concatenateBuffers(audioParts), 24000, 1) as Blob;
542-
setAudioUrl(URL.createObjectURL(audioBlob));
540+
setAudioUrl(URL.createObjectURL(isMpeg ? new globalThis.Blob([concatenated], { type: 'audio/mpeg' }) : pcmToWavBlob(concatenated, 24000, 1)));
543541
} catch (err: any) { setError(err.message); } finally { setIsGenerating(false); }
544542
};
545543

@@ -701,7 +699,7 @@ const App: React.FC = () => {
701699
</div>
702700
<div className="flex flex-col flex-grow min-h-[300px]">
703701
<div className="flex justify-between items-center mb-2">
704-
<label className="text-[9px] font-black text-gray-500 uppercase tracking-widest">NARATIVE MANUSCRIPT (PROSODY STACK ACTIVE (PROSODY STACK ACTIVE)</label>
702+
<label className="text-[9px] font-black text-gray-500 uppercase tracking-widest">NARRATIVE MANUSCRIPT (PROSODY STACK ACTIVE)</label>
705703
<div className="flex gap-3">
706704
<button onClick={exportScript} className="text-[8px] text-gray-500 hover:text-teal-400 font-black uppercase flex items-center gap-1 transition-colors"><ArrowDownTrayIcon className="w-3 h-3" /> Export Script</button>
707705
<button onClick={importScript} className="text-[8px] text-gray-500 hover:text-teal-400 font-black uppercase flex items-center gap-1 transition-colors"><ArrowUpTrayIcon className="w-3 h-3" /> Import Script</button>
@@ -750,4 +748,4 @@ const App: React.FC = () => {
750748
);
751749
};
752750

753-
export default App;
751+
export default App;

0 commit comments

Comments
 (0)