bastibe / python-soundfile

SoundFile is an audio library based on libsndfile, CFFI, and NumPy
BSD 3-Clause "New" or "Revised" License
676 stars 105 forks source link

buffer_read doesn't work in basic test #408

Closed mcclure closed 9 months ago

mcclure commented 9 months ago

I build and install tag 0.12.1 of libsoundfile in a venv. Then I run this script:

import soundfile
s = soundfile.SoundFile("clap.wav")
b = s.buffer_read('int16')
print(b)

I get the error:

Traceback (most recent call last):
  File "C:\Users\Andi\work\g\other\python-soundfile\BUFFERTEST.py", line 3, in <module>
    s.buffer_read('int16')
  File "C:\Users\Andi\work\g\other\python-soundfile\soundfile.py", line 931, in buffer_read
    frames = self._check_frames(frames, fill_value=None)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Andi\work\g\other\python-soundfile\soundfile.py", line 1298, in _check_frames
    if frames < 0 or (frames > remaining_frames and
       ^^^^^^^^^^
TypeError: '<' not supported between instances of 'str' and 'int'

numpy was not installed for this test, I was trying to test the configuration from #406.

EDIT: Trying again with numpy, I get the same failure.

bastibe commented 9 months ago

buffer_read requires an integer as its first argument.

mcclure commented 9 months ago

Oh. Oh no. I see what I did D: