react-native-speech-audio-exporter
v0.2.0
Published
Export React Native text-to-speech output to an audio file.
Maintainers
Readme
react-native-speech-audio-exporter
Export text-to-speech output to an audio file from React Native.
The first release supports iOS using AVSpeechSynthesizer.write(_:toBufferCallback:).
Android is intentionally unsupported for now.
Install
npm install react-native-speech-audio-exporter
cd ios && pod installUsage
import { exportSpeechToFile } from 'react-native-speech-audio-exporter';
const result = await exportSpeechToFile({
text: 'Hello world',
fileName: 'chapter-1',
voiceId: 'com.apple.ttsbundle.Samantha-compact',
rate: 0.5,
pitch: 1.0,
format: 'm4a',
maxDurationSeconds: 60,
});
console.log(result.uri);Supported iOS formats are caf, wav, aiff, and m4a. If
maxDurationSeconds is provided, the exporter stops writing audio after that
duration.
The package does not present a share sheet. Use React Native or app-specific UI to share or move the returned file.
