21

I am trying to create wave files using mac's say command, however, I get the following error:

$ say "hello" -o hi.wav

Opening output file failed: fmt?

although,

$ say --file-format=?

WAVE WAVE (.wav) [lpcm,ulaw,alaw]

Is there some way I can get say to output a wave file?

Community
  • 1
  • 1
simbara
  • 213
  • 2
  • 4

1 Answers1

37

It infers the file format from the file extension, but you need to specify the data format:

say -o hi.wav --data-format=LEF32@22050 "hello"
Jason
  • 11,435
  • 24
  • 77
  • 131
Gordon Davisson
  • 118,432
  • 16
  • 123
  • 151
  • 3
    By the way you can use ```say -o hi.wav --data-format=LEF32@32000 "hello"``` to increase the sample rate and final quality. – Darius May 22 '15 at 14:48
  • 1
    @DariusMorawiec 32000 is better than 8000, but the native sample rate of most macOS voices is either 22050 Hz or 11025, so anything beyond 22050 will just get you upsampled audio. – microtherion Apr 06 '17 at 14:52