esluyter / super-bufrd

UGens for accessing long buffers with subsample accuracy
GNU General Public License v3.0
26 stars 3 forks source link

Cannot calculate/convert PlayheadPosition within synth #7

Closed DjTuxeedo closed 4 years ago

DjTuxeedo commented 4 years ago

This might be a double post, sry for that. I'm using the most recent version of SuperPlayBufXDetails but I'm having trouble making any sense of the playhead position inside the synth. I can't figure out how to convert the playhead position into some useful value that i could use in other ugens like InRange() or at some point generate triggers using the playhead value. If I use float values that have been sent back to sclang by your examples it works statically. so I know the syntax is kinda correct. It Just doesn't work with "live values" from SuperPlayBufXDetails.

Anyone any Ideas?

My code looks like this:

test.txt

elgiano commented 4 years ago

Hey, not the author here, but:

Now my question to @esluyter is: we still have the warning "Cannot convert UGen to Float", but everything seems to be working fine. Am I wrong? Are there reasons to believe the warning?

DjTuxeedo commented 4 years ago

Thank you very much @elgiano Your Example does not work in my setup out of the box with only the SuperPair Branch installed.

Does this mean, I have to compile https://github.com/esluyter/test-double also? Or has SuperPair been moved to the SuperPair branch already? Thanks again :-)

elgiano commented 4 years ago

You have to compile and install test-double as well

DjTuxeedo commented 4 years ago

If I want to send the position back to sclang with a SendTrig I get the following error: frames = pos_pair.asFloat; SendTrig.ar(Impulse.ar(10), 0, frames);

SynthDef superPlayer build failed ERROR: SendTrig arg: 'value' has bad input: nil

DjTuxeedo commented 4 years ago

addition:

Both of your (@elgiano) examples (SuperPlayBuf.arDetails & Phasor + SuperBufRd.ar) yield the same result on my machine. Any attempt on using pos_pair.asFloat results in the error:

SynthDef superPlayer build failed ERROR: SendTrig arg: 'value' has bad input: nil

If I don't try to use the frameValue the Synth works as expected in both cases.

I have only the SuperPair Branch of SuperBufRd and test-double installed.

elgiano commented 4 years ago

superpair branch + test-double should make it. It works on my machine. I corrected a minor error in my examples, but it looks like you had already figured out that. Please try this function and tell me if you see the frame numbers being printed:

{
    var play,pos_pair,pos;
    #play,pos_pair = SuperPlayBuf.arDetails(1,b);
    pos = pos_pair.asFloat;
    pos.poll
}.play
DjTuxeedo commented 4 years ago

@elgiano : Sorry to report, that this code is not working here. I also went from scratch recompiled the superpair branch and test-double. The outcome of your code is that a node on the server is created but no frame numbers are beeing printed. Does it make a difference if I use supernova instead of vanilla sc?

elgiano commented 4 years ago

@DjTuxeedo Does it complain that the UGen is not installed? And, have you built super-bufrd with -DSUPERNOVA=on?

I have just done that and everything works on my machine (Linux), in both scsynth and supernova.

DjTuxeedo commented 4 years ago

Update: I tested some more Code, all tests with the same result. The Synth is created on the Server but .poll does not print anything.

I get a message: "Cannot convert UGen to Float" but I read that you are getting the same message but just ignore it. Correct?

DjTuxeedo commented 4 years ago

I'm not sure if I'm using supernova... let me find out... somehow.

But I know that I have not built super-bufrd with -DSUPERNOVA=on

elgiano commented 4 years ago

"Cannot convert UGen to Float" is something I'm going to open another issue about :) For now I just ignore it and everything seems to work fine

Just to be sure, re-build with -DSUPERNOVA=on, it will build for both scsynth and supernova

git clone https://github.com/esluyter/super-bufrd.git
cd super-bufrd
mkdir build
cd build
cmake -DSC_PATH=/path/to/sc3source/ ..
cmake -DSUPERNOVA=on ..
cmake -DCMAKE_BUILD_TYPE=RELEASE ..
make
DjTuxeedo commented 4 years ago

Thanks for the detailed instructions @elgiano . I took me a while to figure out that cmake -DSUPERNOVA=on is supposed to be: cmake -DSUPERNOVA=on ..

I recompiled my class library. But still the same result I checked, i do not have supernova installed, should I? And if if I have installed it, do I need to start in any specific way? I'm on Linux Mint using the scide

elgiano commented 4 years ago

Sorry for those dots, my bad. (I edited the post in case anyone else needs it). Anyway, if you are not using supernova you don't need to build for supernova... At this point, I don't really know what it could be. Let's make some tests, please execute each line on its own and post the output you get

SuperPhasor.ar
SuperPhasor.arDetails
SuperPlayBuf.ar
SuperPlayBuf.arDetails
SuperPair(0,0)
SuperPair(0,0).asFloat

Then let's try this and see if you get any number posted:

{SuperPhasor.ar.asFloat.poll}.play
DjTuxeedo commented 4 years ago

Yes Sir:

1) SuperPhasor.ar -> a SuperPair 2) SuperPhasor.arDetails -> [ a SuperPair, an OutputProxy ] 3) SuperPlayBuf.ar -> an OutputProxy 4) SuperPlayBuf.arDetails -> [ an OutputProxy, a SuperPair, an OutputProxy ] 5) SuperPair(0,0) -> a SuperPair 6) SuperPair(0,0).asFloat -> 0

7) {SuperPhasor.ar.asFloat.poll}.play replies: Cannot convert UGen to Float -> Synth('temp__4' : 1004)

No Numbers are being posted. The Node Tree shows the synth 1004 but nothing else is happening.

Just to check the rest of my setup: 8.) {Phasor.ar.poll}.play replies: -> Synth('temp__6' : 1005) UGen(Phasor): 0 Until I free the synth 1005

btw. I'm using SuperCollider 3.9.1 from the Ubuntu Repo

elgiano commented 4 years ago

ok, could you try these two as well?

{SuperPair(0,0).poll;Silent.ar}.play
{SuperPoll.ar(10,SuperPair(0,0),"Test");Silent.ar}.play

I'm wondering, have you built test-double as well? It doesn't contain instructions, but you build it exactly like you built super-bufrd.

cd test-double
mkdir build
cd build
cmake -DSC_PATH=/path/to/sc3source/ ..
cmake -DCMAKE_BUILD_TYPE=RELEASE ..
make
DjTuxeedo commented 4 years ago

Hey there, Here are my Replies: 1.) {SuperPair(0,0).poll;Silent.ar}.play -> Synth('temp__0' : 1000) SuperPair: 0.000000 ...

2.) {SuperPoll.ar(10,SuperPair(0,0),"Test");Silent.ar}.play -> Synth('temp__1' : 1001) Test: 0.000000 ...

I built test-double just like you suggested. I'm guessing the output is just like it's supposed to be? I'm lost here, don't know how this is possible

elgiano commented 4 years ago

Yes, it looks like everything is how it is supposed to be, you have all UGens installed on both server and language... I'm also lost here. Is this still not producing any output on your post window?

b = Buffer.alloc(s,44100); // or whatever other buffer
{
    var play,pos_pair,pos;
    #play,pos_pair = SuperPlayBuf.arDetails(1,b);
    pos = pos_pair.asFloat;
    pos_pair.poll;
    pos.poll
}.play
DjTuxeedo commented 4 years ago

The code you just posted yields the following output:

Cannot convert UGen to Float -> Synth('temp__4' : 1003) SuperPair: 0.459375 SuperPair: 4410.459318 SuperPair: 8820.459261 SuperPair: 13230.459203 SuperPair: 17640.459146 ...

so pos_pair is being polled, but pos is not. There must be some irregularity within the ".asFloat" function :-(

elgiano commented 4 years ago

Ok I got it. Sorry, the whole problem is that I forgot I had modified TestDouble.sc. So, if you want to apply my change, at line 39, substitute nil with (msd+lsd). This is how my SuperPair:asFloat function looks:

asFloat {
        if (this.isUGen) {
            "Cannot convert UGen to Float".postln;
            ^(msd + lsd);
        } {
            ^(msd + lsd);
        };
    }

On Fri, Feb 7, 2020 at 3:44 PM DjTuxeedo notifications@github.com wrote:

The code you just posted yields the following output:

Cannot convert UGen to Float -> Synth('temp__4' : 1003) SuperPair: 0.459375 SuperPair: 4410.459318 SuperPair: 8820.459261 SuperPair: 13230.459203 SuperPair: 17640.459146 ...

so pos_pair is being polled, but pos is not. There must be some irregularity within the ".asFloat" function :-(

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/esluyter/super-bufrd/issues/7?email_source=notifications&email_token=AACNMWXBVPT3TY3X4PIX2CLRBWTZ7A5CNFSM4KOTJLN2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELEEEKY#issuecomment-583549483, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACNMWUURF2DFNVO7O7OFH3RBWTZ7ANCNFSM4KOTJLNQ .

DjTuxeedo commented 4 years ago

I applied your change and recompiled the class library. now my Reply to this synth:

{ var play,pos_pair,pos;

play,pos_pair = SuperPlayBuf.arDetails(1,b);

pos = pos_pair.asFloat;
pos_pair.poll;
pos.poll

}.play

looks like this:

Cannot convert UGen to Float -> Synth('temp__1' : 1001) SuperPair: 0.459375 UGen(BinaryOpUGen): 0.459375 SuperPair: 4410.459318 UGen(BinaryOpUGen): 4410.46 SuperPair: 8820.459261 ....

So this was indeed the missing Puzzle piece. @esluyter is this change beeing braught back to test-double? Also it would be nice to have a hint at the superBufRd install instructions that test-double is needed to use all functionality

@elgiano thanks a million I hope I can put this knowledge to good use and I'll promise that if I ever can I will give my help to another stranger like you did.