Tuesday, 27 November 2012

Working With The Sonic Field Console


Having A Console Makes A Huge Difference To Productivity And Creativity

Up until now the productivity of Sonic Field has been severely limited by the need to re-run a patch every time it is edited; this make playing around with sound a very slow process indeed. The addition of the Console processor opens up a whole new arena of rapid sound development from Sonic Field. It also opens up lots of possibilities for fun.

The implementation of Console at the time of writing this is about as simple as it is possible to be. In agile style, I got something working and will use it to find out ways to improve it.

How It Works
At any point in a patch the Processor Console can be used. This will start interacting with the console. It simply reads from Standard Input. This works OK with the Eclipse console which Sonic Field gets when run under Eclipse. The console accepts lines of input. If a line consist of just:
%end%
then the console processor stops and the next processor in the patch is run.

The Console accumulates a patch. Each line of input is added to the patch. When an line consisting of :
%
and nothing else is entered, the current accumulated patch is parsed and run. This allows for complex patches to be either typed or pasted into the console window and then run. The patch runs in the context (same store values) as the patch which contained the original Console processor. However, there is a difference.

When a patch launched from the command line (or Eclipse) causes an error Sonic Field shuts down. Patches entered in the Console to not cause Sonic Field to shut down in this way. If you make a mistake in the Console Sonic Field will tell you something about the mistake and then just start reading from Standard Input again.

One Small Issue:
At the time of writing there is a slight issue in that if there is a layout problem with code inside a code block which is entered into the Console Sonic Field gets the code block tracking system a bif stuffed up. If, after a patch layout problem, you keep getting 'unmatched brace' errors, then enter
}
%

An Example:
Below is a slightly abridged example form the Eclipse console of me working on a bass/rhythm line in Sonic Field

SFPL: [3]1 >> Sonic Field Thread Factory:
SFPL: [3]1 >> ---------------------------
SFPL: [3]1 >> Found CPUs: 8
SFPL: [3]1 >> Initial Max Threads: 16
Parsing: scripts/play/FastBass.sfpl size: 866
SFPL: [532]1 >> Sonic Field Version 0.2 Starting Processing
SFPL: [532]1 >> ============================================
?play invoke
%
(
(0,2.0),
((?bt,2)*,0),
((?bt,4)*,2)
)NumericShape !qEnv
%
?play invoke
%
{
((?bt,4)*,?pitch)SinWave MakeSawTooth dbs+3 Saturate Normalise !signal
(?qEnv,4)DirectRelength !qsEnv
(?qsEnv,?qsEnv,?qsEnv,?qsEnv,?qsEnv)Concatenate !qsEnv
(0,?signal Length,>qsEnv)Cut !qsEnv
(?pitchEnv,4)DirectRelength !psEnv
(?psEnv,?psEnv,?psEnv,?psEnv,?psEnv)Concatenate !psEnv
(0,?signal Length,>psEnv)Cut !psEnv
(>signal,?psEnv,?qsEnv)ShapedLadderLowPass Normalise !signal
>signal Normalise !signal
(>signal,2)Power Normalise !signal
(>signal,?pitch,1,24)RBJPeaking Normalise !signal Monitor
}!play
%
?play invoke
%
"A2" Note !pitch
?play invoke
%
com.nerdscentral.sfpl.SFPL_RuntimeException: Runtime Exception at key word Invoke
operand: '109.99999987361397'
at line: 0, colum 30 in Console
at com.nerdscentral.sfpl.SFPL_Runner.Invoke(SFPL_Runner.java:103)
at com.nerdscentral.audio.io.SF_Console.Interpret(SF_Console.java:57)
at com.nerdscentral.sfpl.SFPL_Runner.Invoke(SFPL_Runner.java:87)
at com.nerdscentral.sfpl.SFPL_Runner.Invoke(SFPL_Runner.java:64)
at com.nerdscentral.sfpl.RenderRunnerImp.runParser(RenderRunnerImp.java:163)
at com.nerdscentral.sfpl.RenderRunnerImp.render(RenderRunnerImp.java:65)
at com.nerdscentral.sfpl.RenderRunner.main(RenderRunner.java:25)
Caused by: com.nerdscentral.sfpl.SFPL_RuntimeException: Failed to resolve type: class java.lang.Double
at com.nerdscentral.sfpl.Caster.describeSFPLType(Caster.java:55)
at com.nerdscentral.sfpl.Caster.throwConversion(Caster.java:49)
at com.nerdscentral.sfpl.Caster.makeBunch(Caster.java:68)
at com.nerdscentral.sfpl.SFPL_Parser$cInvoke.Interpret(SFPL_Parser.java:1166)
at com.nerdscentral.sfpl.SFPL_Runner.Invoke(SFPL_Runner.java:87)
... 6 more
"A2" Note !pitch

%
?play println
%
com.nerdscentral.sfpl.SFPL_Runner@c6824d9
?play println
%
com.nerdscentral.sfpl.SFPL_Runner@c6824d9
?play invoke
%
{
((?bt,4)*,?pitch)SinWave MakeSawTooth dbs+3 Saturate Normalise !signal
(?qEnv,4)DirectRelength !qsEnv
(?qsEnv,?qsEnv,?qsEnv,?qsEnv,?qsEnv)Concatenate !qsEnv
(0,?signal Length,>qsEnv)Cut !qsEnv
(?pitchEnv,4)DirectRelength !psEnv
(?psEnv,?psEnv,?psEnv,?psEnv,?psEnv)Concatenate !psEnv
(0,?signal Length,>psEnv)Cut !psEnv
(>signal,?psEnv,?qsEnv)ShapedLadderLowPass Normalise !signal
>signal Normalise !signal
(>signal,2)Power Normalise !signal
(>signal,?pitch,1,24)RBJPeaking Normalise dbs+3 Saturate Normalise !signal
?bt WhiteNoise MakeTriangle Normalise !signalb
(
>signal,>signalb
)Concatenate !signal Monitor
}!play
%
?play invoke
%

?play invoke
%

{
((?bt,4)*,?pitch)SinWave MakeSawTooth dbs+3 Saturate Normalise !signal
(?qEnv,4)DirectRelength !qsEnv
(?qsEnv,?qsEnv,?qsEnv,?qsEnv,?qsEnv)Concatenate !qsEnv
(0,?signal Length,>qsEnv)Cut !qsEnv
(?pitchEnv,4)DirectRelength !psEnv
(?psEnv,?psEnv,?psEnv,?psEnv,?psEnv)Concatenate !psEnv
(0,?signal Length,>psEnv)Cut !psEnv
(>signal,?psEnv,?qsEnv)ShapedLadderLowPass Normalise !signal
>signal Normalise !signal
(>signal,2)Power Normalise !signal
?bt WhiteNoise MakeSawTooth !signalb
(?signalb,(?pitch,4)*,24,1.5)RBJLowShelf !signalb
(
((0,0),(100,1),(?signalb Length,0))NumericShape,
>signalb
)Multiply Normalise !signalb
(
>signal,>signalb
)Concatenate !signal
(>signal,?pitch,1,24)RBJPeaking Normalise dbs+3 Saturate Normalise !signal Monitor
}!play
%
?play invoke
%

{
((?bt,4)*,?pitch)SinWave MakeSawTooth dbs+3 Saturate Normalise !signal
(?qEnv,4)DirectRelength !qsEnv
(?qsEnv,?qsEnv,?qsEnv,?qsEnv,?qsEnv)Concatenate !qsEnv
(0,?signal Length,>qsEnv)Cut !qsEnv
(?pitchEnv,4)DirectRelength !psEnv
(?psEnv,?psEnv,?psEnv,?psEnv,?psEnv)Concatenate !psEnv
(0,?signal Length,>psEnv)Cut !psEnv
(>signal,?psEnv,?qsEnv)ShapedLadderLowPass Normalise !signal
>signal Normalise !signal
(>signal,2)Power Normalise !signal
?bt WhiteNoise MakeSawTooth !signalb
(?signalb,(?pitch,4)*,1.5,24)RBJLowShelf !signalb
(
((0,0),(100,1),(?signalb Length,0))NumericShape,
>signalb
)Multiply Normalise !signalb
(
>signal,>signalb
)Concatenate !signal
(>signal,?pitch,1,24)RBJPeaking Normalise dbs+3 Saturate Normalise !signal Monitor
}!play
%
?play invoke
%
{
((?bt,4)*,?pitch)SinWave MakeSawTooth dbs+3 Saturate Normalise !signal
(?qEnv,4)DirectRelength !qsEnv
(?qsEnv,?qsEnv,?qsEnv,?qsEnv,?qsEnv)Concatenate !qsEnv
(0,?signal Length,>qsEnv)Cut !qsEnv
(?pitchEnv,4)DirectRelength !psEnv
(?psEnv,?psEnv,?psEnv,?psEnv,?psEnv)Concatenate !psEnv
(0,?signal Length,>psEnv)Cut !psEnv
(>signal,?psEnv,?qsEnv)ShapedLadderLowPass Normalise !signal
>signal Normalise !signal
(>signal,2)Power Normalise !signal
?bt WhiteNoise MakeSawTooth !signalb
(?signalb,(?pitch,2)*,1.5,24)RBJLowShelf !signalb
(
((0,0),(100,1),(?signalb Length,0))NumericShape,
>signalb
)Multiply Normalise !signalb
(
>signal,>signalb dbs+12
)Concatenate !signal
(>signal,?pitch,1,24)RBJPeaking Normalise dbs+3 Saturate Normalise !signal Monitor
}!play
%
?play invoke
%
?signal monitor
%
((?signal),"temp/tone.wav")WriteFile32
%



No comments:

Post a Comment