graph TD
Start[Start: Raw Script Input] --> ScriptCheck[Script Length Check]
ScriptCheck --> LengthOK{Length OK?}
LengthOK -->|Yes| VoiceGen[Generate Voice Over]
LengthOK -->|No| ScriptAdjust[Adjust Script Length]
ScriptAdjust --> VoiceGen
VoiceGen --> CreateWaveform[Create Audio Waveform]
CreateWaveform --> AnalyzeWaveform[Analyze Waveform]
AnalyzeWaveform --> QualityCheck{Quality OK?}
QualityCheck -->|Yes| ConvertFormat[Convert to WAV]
QualityCheck -->|No| SectionIdentify[Identify Problem Sections]
SectionIdentify --> CutAudio[Cut Audio Sections]
CutAudio --> RegenVoice[Regenerate Voice Sections]
RegenVoice --> MergeAudio[Merge Audio]
MergeAudio --> ConvertFormat
ConvertFormat --> FinalCheck{Final Check}
FinalCheck -->|Pass| Output[Final MP3 Output]
FinalCheck -->|Fail| VoiceGen
Output --> End[End: MP3 URL Ready]