Re: ATK: HOAbinaural in NRT?

[email protected] Wed, 26 May 2021 08:48:58 +0800
Newsgroups gmane.comp.audio.supercollider.user
Message-ID <CAFniQ7WjJshVxSoh8_L0kO9JD05=57gQphedsr2qX2a5othiNQ@mail.gmail.com>
On Mon, May 24, 2021 at 11:11 PM <[email protected]> wrote:
>         hoaLoadBundle = myserver.makeBundle(nil, {
>                 myserver.doWhenBooted({
>                         HOABinaural.loadbinauralIRs(myserver);

This looks like confusion about synchronous vs asynchronous operations.

`makeBundle` is synchronous. It collects the bundles *right now*, only
for the operations performed within the scope of the function.

`doWhenBooted` is asynchronous. It will do its action sometime in the
future, not right now.

So, `loadbinauralIRs` is happening outside of the (execution) scope of
the makeBundle function. Therefore makeBundle has no access to the
messages produced, since makeBundle has already returned.

TL;DR you should (temporarily) boot the server before trying to do
anything to it.

```
(
var decoderLoad;

~nrt = Server(\nrt, NetAddr("127.0.0.1", 57110),
    ServerOptions.new.numOutputBusChannels_(2));  // likely more ;->

~nrt.waitForBoot {

    decoderLoad = ~nrt.makeBundle(nil, {
        ~decoder = FoaDecoderKernel.newUHJ(server: ~nrt);
    });

    decoderLoad.do(_.postln);

    ~score = Score.new;

    decoderLoad.do { |msg|
        ~score.add([0, msg]);
    };

    ~nrt.quit.remove;
};
)

~score.score.do(_.postln); ""

[ 0, [ /b_allocReadChannel, 0, /snip_path/UHJ_W.wav, 0, -1, 0, [
/b_query, 0 ] ] ]
[ 0, [ /b_allocReadChannel, 1, /snip_path/UHJ_W.wav, 0, -1, 1, [
/b_query, 1 ] ] ]
[ 0, [ /b_allocReadChannel, 2, /snip_path/UHJ_X.wav, 0, -1, 0, [
/b_query, 2 ] ] ]
[ 0, [ /b_allocReadChannel, 3, /snip_path/UHJ_X.wav, 0, -1, 1, [
/b_query, 3 ] ] ]
[ 0, [ /b_allocReadChannel, 4, /snip_path/UHJ_Y.wav, 0, -1, 0, [
/b_query, 4 ] ] ]
[ 0, [ /b_allocReadChannel, 5, /snip_path/UHJ_Y.wav, 0, -1, 1, [
/b_query, 5 ] ] ]
```

Yep, it's all there.

But... I also notice that the FOA kernel classes have a `score`
parameter, to add the messages to the score instead of performing them
in real-time. So I could simply have done:

```
(
~nrt = Server(\nrt, NetAddr("127.0.0.1", 57110),
    ServerOptions.new.numOutputBusChannels_(2));  // likely more ;->

~score = Score.new;

~decoder = FoaDecoderKernel.newUHJ(server: ~nrt, score: ~score);

// more score stuff here...

~nrt.remove;
)
```

However, I can't confirm whether HOA supports the same because, for
some reason that I don't understand, I don't have any HOABinaural
class. There's a lot of Hoa stuff in atk-sc3 but not the specific
class that you're using. I don't know if it's because of a different
version or what, but it's just not there. Unlikely that I would have
time to troubleshoot some weird installation problem for classes that
I don't even use, so... others may have to take it from here.

hjh

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/