YannickJadoul / Parselmouth

Praat in Python, the Pythonic way
https://parselmouth.readthedocs.io/
GNU General Public License v3.0
1.07k stars 116 forks source link

parselmouth.PraatError: Not an audio file. #96

Closed hackedbyxx closed 1 year ago

hackedbyxx commented 1 year ago
sound = parselmouth.Sound(tmp.name)
parselmouth.PraatError: Not an audio file.

some .m4a audio file can play normaly,but can't read from parselmouth directly, it must be converted to get correct sound

YannickJadoul commented 1 year ago

Can it be read by Praat itself? If not, that's why.

If that's the issue, you can read read in the audio file with some other Python library (I've used SoundFile in the past), convert the values to floats between -1 and 1 (if SoundFile reads integer values), and construct a parselmouth.Sound object with those.

YannickJadoul commented 1 year ago

See e.g. here: https://groups.google.com/g/parselmouth/c/l9pzddg7xZI

hackedbyxx commented 1 year ago

See e.g. here: https://groups.google.com/g/parselmouth/c/l9pzddg7xZI

thanks, i've tried it,but it seems not useful than pydub's AudioSegment, and i try catch exception,so when parselmouth cant's read the file i convert it, but unfortunally it's depend on ffmpeg