Discussion:
asinteger
brucearnold
2014-10-21 14:36:27 UTC
Permalink
I'm getting back into an old sound I used to use. I'm getting the following
error message:

Operator 'asInteger' applied to a UGen is not supported in scsynth

I could've swore I had this is a SynthDef or possibly I'm having a senior
moment :-) Or could this be a case of "synthdefs, once compiled, are
static."

If so, does anybody have a workaround to get the pitch information as a
number or float within a SynthDef.

Thanks

Bruce

(
SynthDef("mon_cheri1",{ | in, lpfreq=1000, winSize=0.3, pchDispersion=0.2,
timeDispersion=0.1, decaytime=0.3 |

var fReally, fVirtual, delta, gate, out, round;


fReally = Pitch.kr(LPF.ar(in, lpfreq)).at(0);
gate = Lag.kr(Amplitude.kr(in) > 0.001, 0.01, 0.2);
fVirtual = fReally.asInteger;

delta = (fVirtual - fReally) / fReally + 5;
delta = Lag.kr(delta, 0.1);

out = PitchShift.ar(in, winSize, delta, pchDispersion,
timeDispersion, gate);
out = CombL.ar(out, 1, fVirtual.reciprocal, decaytime);
});
)




--
View this message in context: http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/asinteger-tp7614189.html
Sent from the SuperCollider Users New (Use this!!!!) mailing list archive at Nabble.com.

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
Dan Zink
2014-10-21 14:54:01 UTC
Permalink
You want to round off to the nearest whole value? Use freally.round(1)
Post by brucearnold
I'm getting back into an old sound I used to use. I'm getting the following
Operator 'asInteger' applied to a UGen is not supported in scsynth
I could've swore I had this is a SynthDef or possibly I'm having a senior
moment :-) Or could this be a case of "synthdefs, once compiled, are
static."
If so, does anybody have a workaround to get the pitch information as a
number or float within a SynthDef.
Thanks
Bruce
(
SynthDef("mon_cheri1",{ | in, lpfreq=1000, winSize=0.3,
pchDispersion=0.2,
timeDispersion=0.1, decaytime=0.3 |
var fReally, fVirtual, delta, gate, out, round;
fReally = Pitch.kr(LPF.ar(in, lpfreq)).at(0);
gate = Lag.kr(Amplitude.kr(in) > 0.001, 0.01, 0.2);
fVirtual = fReally.asInteger;
delta = (fVirtual - fReally) / fReally + 5;
delta = Lag.kr(delta, 0.1);
out = PitchShift.ar(in, winSize, delta, pchDispersion,
timeDispersion, gate);
out = CombL.ar(out, 1, fVirtual.reciprocal, decaytime);
});
)
--
http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/asinteger-tp7614189.html
Sent from the SuperCollider Users New (Use this!!!!) mailing list archive at Nabble.com.
_______________________________________________
sc-users mailing list
http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
brucearnold
2014-10-21 15:33:45 UTC
Permalink
Hi Dan, thanks for the quick reply. I tried adding your suggestion and get an
error message. here is what I added:

(
SynthDef ("mon_cheriTEST",{ | in, lpfreq=1000, winSize=0.3,
pchDispersion=0.2, timeDispersion=0.1, decaytime=0.3 |

var fReally, fVirtual, delta, gate, out, round;


fReally = Pitch.kr(LPF.ar(in, lpfreq)).at(0);
gate = Lag.kr(Amplitude.kr(in) > 0.001, 0.01, 0.2);
fVirtual = fReally.round(1);

delta = (fVirtual - fReally) / fReally + 5;
delta = Lag.kr(delta, 0.1);

out = PitchShift.ar(in, winSize, delta, pchDispersion,
timeDispersion, gate);
out = CombL.ar(out, 1, fVirtual.reciprocal, decaytime);
});
)


below are they error messages I got when I tried to compile.

LPF first input is not audio rate: an OutputProxy control
ARGS:
in: an OutputProxy OutputProxy
freq: an OutputProxy OutputProxy
PitchShift first input is not audio rate: an OutputProxy control
ARGS:
in: an OutputProxy OutputProxy
windowSize: an OutputProxy OutputProxy
pitchRatio: a Lag Lag
pitchDispersion: an OutputProxy OutputProxy
timeDispersion: an OutputProxy OutputProxy
SynthDef mon_cheriTEST build failed
ERROR: LPF first input is not audio rate: an OutputProxy control

PROTECTED CALL STACK:
SynthDef:checkInputs 0x10c1a0980
arg this = a SynthDef
var firstErr = LPF first input is not audio rate: an OutputProxy control
SynthDef:finishBuild 0x10c19b940
arg this = a SynthDef
a FunctionDef 0x10c1c5500
sourceCode = "<an open Function>"
Function:prTry 0x10c045600
arg this = a Function
var result = nil
var thread = a Thread
var next = nil
var wasInProtectedFunc = false

CALL STACK:
Exception:reportError 0x1156ee228
arg this = <instance of Error>
Nil:handleError 0x11566ab58
arg this = nil
arg error = <instance of Error>
Thread:handleError 0x1090523a8
arg this = <instance of Thread>
arg error = <instance of Error>
Object:throw 0x1156e9198
arg this = <instance of Error>
Function:protect 0x1156f3998
arg this = <instance of Function>
arg handler = <instance of Function>
var result = <instance of Error>
SynthDef:build 0x115743378
arg this = <instance of SynthDef>
arg ugenGraphFunc = <instance of Function>
arg rates = nil
arg prependArgs = nil
Interpreter:interpretPrintCmdLine 0x10c9602c8
arg this = <instance of Interpreter>
var res = nil
var func = <instance of Function>
var code = "
SynthDef ("mon_cheriTEST"..."
var doc = <instance of CocoaDocument>
var ideClass = nil
Process:interpretPrintCmdLine 0x115664b18
arg this = <instance of Main>
^^ The preceding error dump is for ERROR: LPF first input is not audio rate:
an OutputProxy control






--
View this message in context: http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/asinteger-tp7614189p7614192.html
Sent from the SuperCollider Users New (Use this!!!!) mailing list archive at Nabble.com.

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
Dan Zink
2014-10-21 15:39:05 UTC
Permalink
Hi Bruce

You need to put something into "in" before you filter it.

Based on yr code, it looks like in is a bus number, or you want sound from
your interface. Create another variable called input, and use input =
In.ar(in) or input = SoundIn.ar(in) respectively (for a bus, or sound in).

The in LPF, replace the bus number "in" with the actual audio "input"
Post by brucearnold
Hi Dan, thanks for the quick reply. I tried adding your suggestion and get an
(
SynthDef ("mon_cheriTEST",{ | in, lpfreq=1000, winSize=0.3,
pchDispersion=0.2, timeDispersion=0.1, decaytime=0.3 |
var fReally, fVirtual, delta, gate, out, round;
fReally = Pitch.kr(LPF.ar(in, lpfreq)).at(0);
gate = Lag.kr(Amplitude.kr(in) > 0.001, 0.01, 0.2);
fVirtual = fReally.round(1);
delta = (fVirtual - fReally) / fReally + 5;
delta = Lag.kr(delta, 0.1);
out = PitchShift.ar(in, winSize, delta, pchDispersion,
timeDispersion, gate);
out = CombL.ar(out, 1, fVirtual.reciprocal, decaytime);
});
)
below are they error messages I got when I tried to compile.
LPF first input is not audio rate: an OutputProxy control
in: an OutputProxy OutputProxy
freq: an OutputProxy OutputProxy
PitchShift first input is not audio rate: an OutputProxy control
in: an OutputProxy OutputProxy
windowSize: an OutputProxy OutputProxy
pitchRatio: a Lag Lag
pitchDispersion: an OutputProxy OutputProxy
timeDispersion: an OutputProxy OutputProxy
SynthDef mon_cheriTEST build failed
ERROR: LPF first input is not audio rate: an OutputProxy control
SynthDef:checkInputs 0x10c1a0980
arg this = a SynthDef
var firstErr = LPF first input is not audio rate: an OutputProxy control
SynthDef:finishBuild 0x10c19b940
arg this = a SynthDef
a FunctionDef 0x10c1c5500
sourceCode = "<an open Function>"
Function:prTry 0x10c045600
arg this = a Function
var result = nil
var thread = a Thread
var next = nil
var wasInProtectedFunc = false
Exception:reportError 0x1156ee228
arg this = <instance of Error>
Nil:handleError 0x11566ab58
arg this = nil
arg error = <instance of Error>
Thread:handleError 0x1090523a8
arg this = <instance of Thread>
arg error = <instance of Error>
Object:throw 0x1156e9198
arg this = <instance of Error>
Function:protect 0x1156f3998
arg this = <instance of Function>
arg handler = <instance of Function>
var result = <instance of Error>
SynthDef:build 0x115743378
arg this = <instance of SynthDef>
arg ugenGraphFunc = <instance of Function>
arg rates = nil
arg prependArgs = nil
Interpreter:interpretPrintCmdLine 0x10c9602c8
arg this = <instance of Interpreter>
var res = nil
var func = <instance of Function>
var code = "
SynthDef ("mon_cheriTEST"..."
var doc = <instance of CocoaDocument>
var ideClass = nil
Process:interpretPrintCmdLine 0x115664b18
arg this = <instance of Main>
an OutputProxy control
--
http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/asinteger-tp7614189p7614192.html
Sent from the SuperCollider Users New (Use this!!!!) mailing list archive at Nabble.com.
_______________________________________________
sc-users mailing list
http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
brucearnold
2014-10-21 16:07:51 UTC
Permalink
Yes that worked, thanks so much Dan

Bruce



--
View this message in context: http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/asinteger-tp7614189p7614195.html
Sent from the SuperCollider Users New (Use this!!!!) mailing list archive at Nabble.com.

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
James Harkins
2014-10-22 00:53:15 UTC
Permalink
Post by Dan Zink
Post by brucearnold
I'm getting back into an old sound I used to use. I'm getting the following
Operator 'asInteger' applied to a UGen is not supported in scsynth
You want to round off to the nearest whole value? Use freally.round(1)
Note that .asInteger doesn't round to the nearest integer. It chops off the
fractional part. So the server-side equivalent is 'trunc'.

0.8.asInteger = 0
0.8.round = 1.0
0.8.trunc = 0.0

hjh

Sent with AquaMail for Android
http://www.aqua-mail.com





_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
brucearnold
2014-10-22 12:00:06 UTC
Permalink
Thanks so much for that information I've been wondering exactly what
information these different methods were sending.

Bruce



--
View this message in context: http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/asinteger-tp7614189p7614216.html
Sent from the SuperCollider Users New (Use this!!!!) mailing list archive at Nabble.com.

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/

Loading...