1

Librosa is writing an audio file with y as ndtype=float64 even though I hand it as a float32. I am using version 0.7.2. Am I doing something wrong? Here is basically what I'm doing:

y, sr = librosa.load("audio_file", mono=False, sr=None, dtype='float32')
print(y.dtype) # float32
librosa.output.write_wav("output_audio_path", y, sr)
y, sr = librosa.load("output_audio_path", mono=False, sr=None, dtype=None)
print(y.dtype) #float64

Anyone have any idea why?

John Lexus
  • 3,576
  • 3
  • 15
  • 33

1 Answers1

2

librosa always returns float64, regardless of the underlying format of a WAV file.

If you want more control over the details in audio I/O, use pysoundfile directly. Or even the wave module in Python standard library.

Jon Nordby
  • 5,494
  • 1
  • 21
  • 50