Operating system: Windows (6.1.7601)
Slicer version: 4.10.0
Expected behavior: Load in python package to slicer, package is loaded, use package in scripted module to access and load an external audio data file.
Actual behavior: Load in python package to slicer, package is loaded, script loaded module cannot locate external file.
I am trying to implement a specific sound feedback in Slicer to play a specific audio file in response to an observed change in a node. I am attempting to use the python module pydub. I have imported this into slicer using the following:
The module is loaded into Slicer, but when I attempt to use this module to access an external .wav file
out_audio = AudioSegment.from_wav("/tmp/file.wav")
it fails to recognize the file (Windows Error 2, the file or directory does not exist. is this an issue with Slicer being able to open a file called by an external command? If anyone has an insight into why I may be getting this issue I would greatly appreciate your input.
/tmp/file.wav is not a full path on Windows. Verify the path and make sure to include drive name:
You can also replay sound using Qt or for more flexibility use a sound synthesizer (by using/customizing SoundControl extension).
/tmp/file.wav was a typo, I was using the path with the full drive name:
In regards to customizing the SoundControl extension, I had previously tried to work with this extension but was getting an error (Breach warning, Open Sound Control, test with Pure Data errors) which i belive is related to purr-data.
Also, the use of Qt in python would require some form of C++ wrapping would it not? I know that the PyQT provides binding for Qt but I am not sure if I would be able to use this within Slicer.
All Qt classes (with a few exceptions) are Python-wrapped and heavily used in all scripted modules in Slicer.
Yes, Qt already have python-wrapping in Slicer using PythonQt. You can see in the OpenSoundControl python module here where the python wrapped qt package is imported.
I would suggest to keep debugging that issue with the subprocess call within the OpenSoundControl extension code. I wouldn’t be surprised if the config file path is in an incorrect format. Maybe you have quotes around the path when there shouldn’t be? I haven’t tried anything myself, but giving you some ideas to try.
Thanks for the suggestions! I appreciate your support. The error I am getting is actually when I just use the built in Open Sound Control module under Modules>IGT>Open Sound Control. When i go under the PureData Server input section and add the PureData configuration for the OscSimpleTest and then it gives the error I discussed. I have tried several different iterations or ways of expressing the path for the OscSimpleTest.pd file and none seem to work I still get the same Error 87.
Additionally, I ran the OscSimpleTest just within Purr-Data, it is producing sound but outputting these errors:
Not sure if this is contributing to the problem.
I’ve just tried this and it works well. Make sure you download full pd version (including plugins) as described in instructions: SlicerSoundControl/README.md at master · SlicerIGT/SlicerSoundControl · GitHub