spotify / pedalboard

🎛 🔊 A Python library for audio.
https://spotify.github.io/pedalboard
GNU General Public License v3.0
5.11k stars 261 forks source link

SegmentationFault on Windows trying to user AudioFile or AudioStream #353

Open EParisot opened 1 month ago

EParisot commented 1 month ago

Hi I'd like to use this library on Windows but no luck...

Here is the code :

from pedalboard import Pedalboard, Chorus, Compressor, Delay, Gain, Reverb, Phaser, Convolution
from pedalboard.io import AudioStream, AudioFile

input_device_name = AudioStream.input_device_names[2]
output_device_name = AudioStream.output_device_names[1]
print(input_device_name)
print(output_device_name)

# Open up an audio stream:
with AudioStream(
  input_device_name=input_device_name,  # Guitar interface
  output_device_name=output_device_name,
  sample_rate=48000,
  buffer_size=512
) as stream:
  # Audio is now streaming through this pedalboard and out of your speakers!
  stream.plugins = Pedalboard([
      Compressor(threshold_db=-50, ratio=25),
      Gain(gain_db=30),
      #Chorus(),
      #Phaser(),
      #Convolution("./guitar_amp.wav", 1.0),
      #Reverb(room_size=0.25),
  ])

  input("Press enter to stop streaming...")

# The live AudioStream is now closed, and audio has stopped.

With git bash on windows (also tryed with cmd and powershell) Python 3.12

$ python guitar.py 
Microphone (Realtek(R) Audio)
Haut-parleurs (Focusrite USB Audio)
Segmentation fault

Or with other micro, same :

$ python guitar.py 
Analogue 1 + 2 (Focusrite USB A
Haut-parleurs (Focusrite USB Audio)
Segmentation fault

Same kind of issue with AudioFile

AudioFile work on my wsl Ubuntu but it does not acces my audio devices so can't test Audiostream...

new infos: After some downgrades, the library works with version 0.9.6, BUT the sound (I can hear now !) is stutering, lot of artifacts and latency. I tried several frequencies or buffer sizes, definitelly affects the issue but can't solve it.

I open a new issue for this point...

EParisot commented 1 month ago

this issue is solved after the workaround for ASIO on windows : cf https://github.com/spotify/pedalboard/issues/211