Skip to content

Commit 535dcf7

Browse files
committed
StkInst Docs: rawwaves filepath fix
1 parent 42770cb commit 535dcf7

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

source/StkInst/sc/HelpSource/Classes/StkGlobals.schelp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,20 @@ Examples::
2828

2929
code::
3030

31-
//a instrument that uses waveforms///////////////////
31+
//an instrument that uses waveforms///////////////////
3232
//first set rawfilepath to let Stk know where to look
33-
{StkGlobals.ar(1,1,Platform.userExtensionDir ++"/SC3Plugins/StkInst/rawwaves")}.play;
33+
({
34+
var path = [
35+
Platform.userExtensionDir ++ "/SC3Plugins/StkInst/rawwaves",
36+
Platform.userExtensionDir ++ "/SC3Plugins/StkInst/rawwaves",
37+
Platform.systemExtensionDir ++ "/SC3plugins/StkInst/rawwaves",
38+
Platform.systemExtensionDir ++ "/SC3plugins/StkInst/rawwaves"
39+
].select({ |possiblePath| File.exists(possiblePath) }).first;
40+
41+
if(path.isNil, {Error("audio files not found").throw;});
42+
43+
StkGlobals.ar(1,1,path)
44+
}.play;)
3445

3546
//Define mandolin synthdef
3647
(

source/StkInst/sc/HelpSource/Classes/StkInst.schelp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ SynthDef(\helpStkbowed,{arg out=0,freq=220,gate=1,amp=1,bowpressure = 64, bowpos
4848

4949
//Use it.
5050
(
51-
5251
Pbind(
5352
\instrument, \helpStkbowed,
5453
\dur , 0.25,
@@ -58,9 +57,20 @@ Pbind(
5857
).play;
5958
)
6059

61-
//now a instrument that uses waveforms///////////////////
60+
//an instrument that uses waveforms///////////////////
6261
//first set rawfilepath to let Stk know where to look
63-
{StkGlobals.ar(1,1,Platform.userExtensionDir ++"/SC3Plugins/StkInst/rawwaves")}.play;
62+
({
63+
var path = [
64+
Platform.userExtensionDir ++ "/SC3Plugins/StkInst/rawwaves",
65+
Platform.userExtensionDir ++ "/SC3Plugins/StkInst/rawwaves",
66+
Platform.systemExtensionDir ++ "/SC3plugins/StkInst/rawwaves",
67+
Platform.systemExtensionDir ++ "/SC3plugins/StkInst/rawwaves"
68+
].select({ |possiblePath| File.exists(possiblePath) }).first;
69+
70+
if(path.isNil, {Error("audio files not found").throw;});
71+
72+
StkGlobals.ar(1,1,path)
73+
}.play;)
6474

6575
//Define mandolin synthdef
6676
(
@@ -74,7 +84,6 @@ SynthDef(\helpMandolin,{arg out=0,freq=220,gate=1,amp=1;
7484

7585
//Use it.
7686
(
77-
7887
Pbind(
7988
\instrument, \helpMandolin,
8089
\dur , 0.25,

0 commit comments

Comments
 (0)