Score .sort problem?

View: New views
4 Messages — Rating Filter:   Alert me  

Score .sort problem?

by stwbass :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm getting a strange error with .sort on a Score. I hope I'm not misunderstanding the syntax of the .add method.

If have have the following:

(
x = [

[0.0, [\b_allocRead, 0, "/scsound/blackman.wav"]],
[0.0, [\b_allocRead, 1, "/scsound/blackmanHarris.wav"]],
[0.0, [\b_allocRead, 2, "/scsound/nuttall.wav"]],
[0.0, [\b_allocRead, 3, "/scsound/sinc.wav"]],
[0.0, [\b_allocRead, 4, "/Users/Scott/Compositions/PercElec/OperaGongs/cogong3-7.wav"]],
[0.0, [\b_allocRead, 5, "/Users/Scott/Compositions/PercElec/Bongos/bongo4-1.wav"]],
[0.0, [\b_allocRead, 6, "/Users/Scott/Compositions/PercElec/Bongos/bongo3-1.wav"]],
[0.0, [\b_allocRead, 7, "/Users/Scott/Compositions/PercElec/Bongos/bongo4-2.wav"]]

]
)

(
a =     Pbind(
    \instrument, \fileGran,
    \sndbuf, 4,
    \windowbuf, 2,
    \freq, Pseq([\rest, Pwhite(1,1)]),
    \delta, Pseq([1, Pwhite(0.005, 0.01, 730)]),
    \beg, Env([1000, 10000], [5]),
    \end, Pkey(\beg) + Env([100, 10000], [5]),
    \pan, Env([-1, 0.5, -0.5, 0.2, 1, 0], [5, 5, 5, 5, 6]),
    \trans, 1.8,
    \db, Env([-60, 0, -80], [3, 3])
    );
)


d = a.asScore(7.5);
d.add(x);
d.sort;


The d.sort throws this error:


ERROR: Message '>=' not understood.
RECEIVER:
   nil
ARGS:
   Integer 0
CALL STACK:
    DoesNotUnderstandError:reportError   061B3430
        arg this = <instance of DoesNotUnderstandError>
    Nil:handleError   064A3810
        arg this = nil
        arg error = <instance of DoesNotUnderstandError>
    Thread:handleError   064A3D50
        arg this = <instance of Thread>
        arg error = <instance of DoesNotUnderstandError>
    Object:throw   064A4470
        arg this = <instance of DoesNotUnderstandError>
    Object:doesNotUnderstand   064A47D0
        arg this = nil
        arg selector = '>='
        arg args = [*1]
    < FunctionDef in Method Collection:collectAs >   064A5370
        arg elem = "/scsound/blackman.wav"
        arg i = 2
    ArrayedCollection:do   064A57F0
        arg this = [*3]
        arg function = <instance of Function>
        var i = 2
    Collection:collectAs   06528990
        arg this = [*3]
        arg function = <instance of Function>
        arg class = class Array
        var res = [*2]
    < FunctionDef in Method Collection:collectAs >   064A5490
(there's more after this that I'm assuming isn't necessary to debug, but I can post if needed).


Thanks very much,
sw



--
Scott Worthington
stwbass@...
www.scottworthington.com

Re: Score .sort problem?

by Josh Parmenter :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Score.add expects a single OSC bundle... you are adding an array of bundles. You can iterate over them and add each one:

d = a.asScore(7.5);
x.do({arg me; d.add(me)})
d.sort;

or, since all of the \b_allocRead have the same time stamp, create a single bundle with it:

x = [0.0, [\b_allocRead ... ], [\b_allocRead ...]]

and add that to the Score.

Hope that helps.

Josh

On Apr 24, 2009, at 11:44 AM, Scott Worthington wrote:

(
x = [

[0.0, [\b_allocRead, 0, "/scsound/blackman.wav"]],
[0.0, [\b_allocRead, 1, "/scsound/blackmanHarris.wav"]],
[0.0, [\b_allocRead, 2, "/scsound/nuttall.wav"]],
[0.0, [\b_allocRead, 3, "/scsound/sinc.wav"]],
[0.0, [\b_allocRead, 4, "/Users/Scott/Compositions/PercElec/OperaGongs/cogong3-7.wav"]],
[0.0, [\b_allocRead, 5, "/Users/Scott/Compositions/PercElec/Bongos/bongo4-1.wav"]],
[0.0, [\b_allocRead, 6, "/Users/Scott/Compositions/PercElec/Bongos/bongo3-1.wav"]],
[0.0, [\b_allocRead, 7, "/Users/Scott/Compositions/PercElec/Bongos/bongo4-2.wav"]]

]
)

(
a =     Pbind(
    \instrument, \fileGran, 
    \sndbuf, 4, 
    \windowbuf, 2,
    \freq, Pseq([\rest, Pwhite(1,1)]),
    \delta, Pseq([1, Pwhite(0.005, 0.01, 730)]),
    \beg, Env([1000, 10000], [5]),
    \end, Pkey(\beg) + Env([100, 10000], [5]),
    \pan, Env([-1, 0.5, -0.5, 0.2, 1, 0], [5, 5, 5, 5, 6]),
    \trans, 1.8,
    \db, Env([-60, 0, -80], [3, 3])
    );
)


d = a.asScore(7.5);
d.add(x);
d.sort;

******************************************

/* Joshua D. Parmenter

http://www.realizedsound.net/josh/


“Every composer – at all times and in all cases – gives his own interpretation of how modern society is structured: whether actively or passively, consciously or unconsciously, he makes choices in this regard. He may be conservative or he may subject himself to continual renewal; or he may strive for a revolutionary, historical or social palingenesis." - Luigi Nono

*/


Re: Score .sort problem?

by Stefan Nussbaumer (SC list) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hi scott,

i think, you  can't simply add an array to your score. you have to add
its slots one by one:

x.do({ |i| d.add(i) });

 ... hope, that does the trick

stefan

Scott Worthington schrieb:

> I'm getting a strange error with .sort on a Score. I hope I'm not
> misunderstanding the syntax of the .add method.
>
> If have have the following:
>
> (
> x = [
>
> [0.0, [\b_allocRead, 0, "/scsound/blackman.wav"]],
> [0.0, [\b_allocRead, 1, "/scsound/blackmanHarris.wav"]],
> [0.0, [\b_allocRead, 2, "/scsound/nuttall.wav"]],
> [0.0, [\b_allocRead, 3, "/scsound/sinc.wav"]],
> [0.0, [\b_allocRead, 4,
> "/Users/Scott/Compositions/PercElec/OperaGongs/cogong3-7.wav"]],
> [0.0, [\b_allocRead, 5,
> "/Users/Scott/Compositions/PercElec/Bongos/bongo4-1.wav"]],
> [0.0, [\b_allocRead, 6,
> "/Users/Scott/Compositions/PercElec/Bongos/bongo3-1.wav"]],
> [0.0, [\b_allocRead, 7,
> "/Users/Scott/Compositions/PercElec/Bongos/bongo4-2.wav"]]
>
> ]
> )
>
> (
> a =     Pbind(
>     \instrument, \fileGran,
>     \sndbuf, 4,
>     \windowbuf, 2,
>     \freq, Pseq([\rest, Pwhite(1,1)]),
>     \delta, Pseq([1, Pwhite(0.005, 0.01, 730)]),
>     \beg, Env([1000, 10000], [5]),
>     \end, Pkey(\beg) + Env([100, 10000], [5]),
>     \pan, Env([-1, 0.5, -0.5, 0.2, 1, 0], [5, 5, 5, 5, 6]),
>     \trans, 1.8,
>     \db, Env([-60, 0, -80], [3, 3])
>     );
> )
>
>
> d = a.asScore(7.5);
> d.add(x);
> d.sort;
>
>
> The d.sort throws this error:
>
>
> ERROR: Message '>=' not understood.
> RECEIVER:
>    nil
> ARGS:
>    Integer 0
> CALL STACK:
>     DoesNotUnderstandError:reportError   061B3430
>         arg this = <instance of DoesNotUnderstandError>
>     Nil:handleError   064A3810
>         arg this = nil
>         arg error = <instance of DoesNotUnderstandError>
>     Thread:handleError   064A3D50
>         arg this = <instance of Thread>
>         arg error = <instance of DoesNotUnderstandError>
>     Object:throw   064A4470
>         arg this = <instance of DoesNotUnderstandError>
>     Object:doesNotUnderstand   064A47D0
>         arg this = nil
>         arg selector = '>='
>         arg args = [*1]
>     < FunctionDef in Method Collection:collectAs >   064A5370
>         arg elem = "/scsound/blackman.wav"
>         arg i = 2
>     ArrayedCollection:do   064A57F0
>         arg this = [*3]
>         arg function = <instance of Function>
>         var i = 2
>     Collection:collectAs   06528990
>         arg this = [*3]
>         arg function = <instance of Function>
>         arg class = class Array
>         var res = [*2]
>     < FunctionDef in Method Collection:collectAs >   064A5490
> (there's more after this that I'm assuming isn't necessary to debug, but I
> can post if needed).
>
>
> Thanks very much,
> sw
>
>
>
>  


_______________________________________________
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/

Re: Score .sort problem?

by stwbass :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

yup! I misunderstood "bundle."

Thanks to both,
sw

On Fri, Apr 24, 2009 at 4:31 PM, Stefan Nussbaumer (SC list) <stefanus@...> wrote:
hi scott,

i think, you  can't simply add an array to your score. you have to add its slots one by one:

x.do({ |i| d.add(i) });

... hope, that does the trick

stefan

Scott Worthington schrieb:

I'm getting a strange error with .sort on a Score. I hope I'm not
misunderstanding the syntax of the .add method.

If have have the following:

(
x = [

[0.0, [\b_allocRead, 0, "/scsound/blackman.wav"]],
[0.0, [\b_allocRead, 1, "/scsound/blackmanHarris.wav"]],
[0.0, [\b_allocRead, 2, "/scsound/nuttall.wav"]],
[0.0, [\b_allocRead, 3, "/scsound/sinc.wav"]],
[0.0, [\b_allocRead, 4,
"/Users/Scott/Compositions/PercElec/OperaGongs/cogong3-7.wav"]],
[0.0, [\b_allocRead, 5,
"/Users/Scott/Compositions/PercElec/Bongos/bongo4-1.wav"]],
[0.0, [\b_allocRead, 6,
"/Users/Scott/Compositions/PercElec/Bongos/bongo3-1.wav"]],
[0.0, [\b_allocRead, 7,
"/Users/Scott/Compositions/PercElec/Bongos/bongo4-2.wav"]]

]
)

(
a =     Pbind(
   \instrument, \fileGran,
   \sndbuf, 4,
   \windowbuf, 2,
   \freq, Pseq([\rest, Pwhite(1,1)]),
   \delta, Pseq([1, Pwhite(0.005, 0.01, 730)]),
   \beg, Env([1000, 10000], [5]),
   \end, Pkey(\beg) + Env([100, 10000], [5]),
   \pan, Env([-1, 0.5, -0.5, 0.2, 1, 0], [5, 5, 5, 5, 6]),
   \trans, 1.8,
   \db, Env([-60, 0, -80], [3, 3])
   );
)


d = a.asScore(7.5);
d.add(x);
d.sort;


The d.sort throws this error:


ERROR: Message '>=' not understood.
RECEIVER:
  nil
ARGS:
  Integer 0
CALL STACK:
   DoesNotUnderstandError:reportError   061B3430
       arg this = <instance of DoesNotUnderstandError>
   Nil:handleError   064A3810
       arg this = nil
       arg error = <instance of DoesNotUnderstandError>
   Thread:handleError   064A3D50
       arg this = <instance of Thread>
       arg error = <instance of DoesNotUnderstandError>
   Object:throw   064A4470
       arg this = <instance of DoesNotUnderstandError>
   Object:doesNotUnderstand   064A47D0
       arg this = nil
       arg selector = '>='
       arg args = [*1]
   < FunctionDef in Method Collection:collectAs >   064A5370
       arg elem = "/scsound/blackman.wav"
       arg i = 2
   ArrayedCollection:do   064A57F0
       arg this = [*3]
       arg function = <instance of Function>
       var i = 2
   Collection:collectAs   06528990
       arg this = [*3]
       arg function = <instance of Function>
       arg class = class Array
       var res = [*2]
   < FunctionDef in Method Collection:collectAs >   064A5490
(there's more after this that I'm assuming isn't necessary to debug, but I
can post if needed).


Thanks very much,
sw



 


_______________________________________________
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/



--
Scott Worthington
stwbass@...
www.scottworthington.com