First time here? Check out the FAQ!
x

Is there a way to direct DiskRecorder to write to a custom directory?

+1 vote
155 views

Hi...

I was experimenting with trying to save DiskRecorder renders to a custom directory, and tried the following in a Script, which tries to create a directory and then pass that whole name to the FileName field of DiskRecorder. I know I can do this kind of Filename SmallTalk from a Tool, but when I try it in a Script, Kyma throws OS error.
 

 

| recName |

recName := ':output'&
    Time now hours printString & Time now minutes printString & Time now seconds printString.

(recName asFilename reallyExistsOrIsDirectory) ifFalse: [
    recName asFilename makeDirectory.
].

 

 

asked Apr 25, 2017 in Capytalk & Smalltalk by cristian-vogel (Master) (7,930 points)

1 Answer

+1 vote
 
Best answer

Try this instead (it avoids hard-coding in the folder separator character and refers to a known folder in the Kyma installation):

myFolderName := HostDriverInterface diskTracksDirectory constructString: 'yourFolderName'.

myFolderName asFilename reallyExists ifFalse: [myFolderName asFilename makeDirectory].

recName := myFolderName asFilename constructString: 'myFileName'.

answered Apr 26, 2017 by ssc (Savant) (112,750 points)
selected Apr 28, 2017 by cristian-vogel
Thanks!

OK, this works up until passing the recName it seems. A folder is created inside Disk Tracks, but then I'm gettin a new OS error -  Argument Invalid.

Here is a screenshot.
https://dl.dropboxusercontent.com/u/18440215/public%20image/Screenshot%202017-04-26%2015.15.17.png
Could you please upload an example to the Q&A that demonstrates this? Thanks!

Arguments Invalid Example

here is an example that throws the error...

The sample code omitted the check to see if the directory existed first before trying to make it. Have edited the code above to include the check. Should work now!

(In your example, you are recording AIFF but using WAV as the extension, so you should change either the file extension you use or the DiskRecorder Sound so that the two agree.)
...