I’m trying to open a wav file in a buffer and keep getting errors saying SC can’t open or find the file.
This is on Windows 10 so I use the \ in the file directory. In the error message SC shows the whole directory without any ‘’ to separate things, I tried adding the Platform.resourceDir +/+ before the file path and still got the same errors.
I also tried changing the \ to a / and same error.
I tried making the \ a double \ and then when I got the error it shows the file path with \ in between the proper places but it still can’t open the file.
The code is as follows:
b = Buffer.readChannel(s,“C:\Users\44774\Desktop\Autobot\wubsquare8.wav”, startFrame:0, numFrames: -1);
I initially had not included the start and end frames and tried adding them to see if that was what was causing the error.
I’m guessing this is just some sort of syntax error on my part??
I tried running the code again to load the sample wav file into a buffer.
It didn’t work.
I tried converting the .wav file to an .aiff file because maybe there was something to do with the format of the .wav file and I also moved the path to my desktop in case there was some sort of permissions issue with the documents folder. It seems as though SuperCollider can find the file path now however it says the following error message:
File ‘C:\Users\44774\Desktop\stuff and things\Autobot’ could not be opened: System error : Access is denied.
I tried temporarily turning off my anti-virus software and checking the permissions of the folders and my account has full access (I mean I created the folders so I should) as an admin.
Has anyone else had issues getting SC to load a sound file into a buffer this way?
Is this purely a windows 10 problem or an issue with this version of SC?
I moved the file to a folder I created in the user support directory for SuperCollider and then changed the quotes to ascii.
I think the issue was that at first I had the file name listed without the extension, then I added the extension to the file name and added the file extension to the file path in the code and this must have created a conflict.
In the first instance SC needed the file extension, ascii quotes, and since I’m on windows the path needed double \ in the path file.
The final working code looks like this:
b = Buffer.readChannel(s, "C:\\Users\\44774\\AppData\\Local\\SuperCollider\\Tables\\wubsquare.wav", startFrame:0, numFrames: -1);
The wav file is simply named wubsquare and I included the file extension in the code.
That’s OK but not strictly necessary. The file can be anywhere in your system.
The Windows hides file explorer file extensions by default… maybe friendlier, but if you’re going to do any programming, you’ll need to see the real, complete filename.
If the extension was hidden and then you added the extension by renaming in 5th explorer, then you’d have Autobot.aiff.aiff in the file system – it’s very confusing for programming when the extensions are hidden. Make sure to show them.
I’d bet it’s named wubsquare.wav and the explorer is lying to you by showing only wubsquare.
Also you can use forward slashes: "C:/Users/44774/AppData..."
Also you can drag a file from the explorer into the code window, and the IDE will insert the correct path string.