Summary
SpeechSDK.synthesize() and MusicSDK.generate() return hex-encoded audio in response.data.audio, but provide no method to decode and save that audio to disk. Users must manually implement hex validation, decoding, directory creation, and default filename generation.
The CLI already handles all of this via saveAudioOutput() in src/output/audio.ts.
Proposed solution
Add save(response, outPath?, ext?) methods to both SDKs that:
- Validate hex format and length
- Decode via
Buffer.from(hex, 'hex')
- Create intermediate directories
- Generate timestamp-based default filenames
- Throw on missing audio data or disk-full errors
See linked PR.
Summary
SpeechSDK.synthesize()andMusicSDK.generate()return hex-encoded audio inresponse.data.audio, but provide no method to decode and save that audio to disk. Users must manually implement hex validation, decoding, directory creation, and default filename generation.The CLI already handles all of this via
saveAudioOutput()insrc/output/audio.ts.Proposed solution
Add
save(response, outPath?, ext?)methods to both SDKs that:Buffer.from(hex, 'hex')See linked PR.