Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

function-hacks posts: instrument not found: nil #61

Closed
gilfuser opened this issue May 18, 2017 · 7 comments
Closed

function-hacks posts: instrument not found: nil #61

gilfuser opened this issue May 18, 2017 · 7 comments

Comments

@gilfuser
Copy link

The example function-hacks, in the hacks directory, would be perfect for my case, but I'm guessing its outdated, isn't it?
Or maybe I don't understand what ~diversions is and I made something wrong.
I followed the step and I only could get the message in the title.

best regards,
Gil

@telephon
Copy link
Contributor

telephon commented May 18, 2017

I'll take a look, thanks for reporting.

What branch are you using?

@vivid-synth
Copy link

Maybe this is the same issue as we're seeing here? vivid-synth/vivid#3

@telephon
Copy link
Contributor

What branch are you using?

@gilfuser
Copy link
Author

Hi.
I forgot about this issue, but I tried it again and got the same error. I'm using Tidal 1.0.0 and the most recent version of SuperDirt.

@gilfuser
Copy link
Author

Here is what I tried so far:

if I evaluate

(
var diversions = ();  // make a dictionary of functions
~diversions = diversions; // make it available out of scope
~diversions[\tlalak] = {
	"hello tlalak".postln;
};
// use the "diversion" key as a hook for playing the synth
~d1.defaultParentEvent[\diversion] = { diversions[~sound].value };
)

I get module 'sound': instrument not found: nil

Then I add it in ~dirt.soundLibrary like this: ~dirt.soundLibrary.addSynth(\tlalak) or this: ~dirt.soundLibrary.addSynth(\tlalak, (instrument: \tlalak))

I get:

ERROR: Message 'flop' not understood.
RECEIVER:
   nil
ARGS:

PROTECTED CALL STACK:
	Meta_MethodError:new	0x55bf74fe4180
		arg this = DoesNotUnderstandError
		arg what = nil
		arg receiver = nil
	Meta_DoesNotUnderstandError:new	0x55bf74fe6140
		arg this = DoesNotUnderstandError
		arg receiver = nil
		arg selector = flop
		arg args = [  ]
	Object:doesNotUnderstand	0x55bf74859bc0
		arg this = nil
		arg selector = flop
		arg args = nil
	DirtEvent:sendSynth	0x55bf74f88a80
		arg this = a DirtEvent
		arg instrument = tlalak
		arg args = nil
		var group = 1129
	DirtModule:value	0x55bf76412100
		arg this = DirtModule('sound')
		arg orbit = a DirtEvent
	ArrayedCollection:do	0x55bf75f8b280
		arg this = [ DirtModule('sound'), DirtModule('vowel'), DirtModule('shape'), DirtModule('hpf'), DirtModule('bpf'), DirtModule('crush'), DirtModule('coarse'), DirtModule('lpf'), DirtModule('pshift'), DirtModule('envelope'), DirtModule('tremolo'), DirtModule('phaser'), DirtModule('waveloss'), DirtModule('squiz') ]
		arg function = a Function
		var i = 0
	a FunctionDef	0x55bf74f8a540
		sourceCode = "<an open Function>"
	a FunctionDef	0x55bf761984c0
		sourceCode = "<an open Function>"
	Function:prTry	0x55bf752d6540
		arg this = a Function
		var result = nil
		var thread = a Thread
		var next = a Function
		var wasInProtectedFunc = true
	Function:try	0x55bf752d6000
		arg this = a Function
		arg handler = a Function
		var result = nil
	Server:makeBundle	0x55bf76198100
		arg this = localhost
		arg time = 0.04104968924139
		arg func = a Function
		arg bundle = nil
	DirtEvent:playSynths	0x55bf74f8a000
		arg this = a DirtEvent
		var cutGroup = nil
	a FunctionDef	0x55bf760bfc80
		sourceCode = "<an open Function>"
	Function:prTry	0x55bf752d6540
		arg this = a Function
		var result = nil
		var thread = a Thread
		var next = nil
		var wasInProtectedFunc = false
	
CALL STACK:
	DoesNotUnderstandError:reportError
		arg this = <instance of DoesNotUnderstandError>
	Nil:handleError
		arg this = nil
		arg error = <instance of DoesNotUnderstandError>
	Thread:handleError
		arg this = <instance of Thread>
		arg error = <instance of DoesNotUnderstandError>
	Object:throw
		arg this = <instance of DoesNotUnderstandError>
	Function:protect
		arg this = <instance of Function>
		arg handler = <instance of Function>
		var result = <instance of DoesNotUnderstandError>
	Environment:use
		arg this = <instance of Event>
		arg function = <instance of Function>
		var result = nil
		var saveEnvir = <instance of Environment>
	DirtEvent:play
		arg this = <instance of DirtEvent>
	OSCFuncBothMessageMatcher:value
		arg this = <instance of OSCFuncBothMessageMatcher>
		arg msg = [*9]
		arg time = 3868.3698266062
		arg testAddr = <instance of NetAddr>
		arg testRecvPort = 57120
	OSCMessageDispatcher:value
		arg this = <instance of OSCMessageDispatcher>
		arg msg = [*9]
		arg time = 3868.3698266062
		arg addr = <instance of NetAddr>
		arg recvPort = 57120
	Main:recvOSCmessage
		arg this = <instance of Main>
		arg time = 3868.3698266062
		arg replyAddr = <instance of NetAddr>
		arg recvPort = 57120
		arg msg = [*9]
^^ The preceding error dump is for ERROR: Message 'flop' not understood.
RECEIVER: nil

Then I thought that maybe the out argument is mandatory and changed the first part like this:

(
var diversions = ();  // make a dictionary of functions
~diversions = diversions; // make it available out of scope
~diversions[\tlalak] = { |out|
	"hello tlalak".postln;
};
// use the "diversion" key as a hook for playing the synth
~d1.defaultParentEvent[\diversion] = { diversions[~sound].value };
)

...and got: *** ERROR: SynthDef bla not found FAILURE IN SERVER /s_new SynthDef not found

this looks better. At least is a shorter error post.
Now i did (I'm following vivid-synth issue mentioned above to see what I can learn from it ):
SynthDef(\tlalak,{|out|}).send
And re-evaluated the block above and the addSynth part.

Now I get no errors but "hello tlalak" is not being posted.It makes sense, the SynthDef is doing nothing, and SynthDefs are not for posting things. So, I'm clearly lost here.

Any thoughts @telephon? @vivid-synth?

@bgold-cosmos
Copy link
Contributor

bgold-cosmos commented Dec 19, 2018

If I change the ~sound to ~s I can at least get the postln working.

I'm not sure what you're trying to do with addSynth

@gilfuser
Copy link
Author

gilfuser commented Dec 19, 2018

Nice! Thanks @bgold-cosmos.
With addSynth I thought SC would recognise the existence of a "tlalak" Synth and not give me a not found post. But I didn't know if that would make sense.

This suggestion works for my needs, but I'm leaving this opened because someone might want the following to work and it won't:

// execute arbitrary sc code
// you can livecode this
(
~diversions[\tlalak]  = { | out=0 pan=0 sustain=1 amp=1 |
	Pfindur(~sustain,
		Pbind(
			\dur, 0.04,
			\note, Pbrown(-15, 15 ! 5, 0.3, inf) + 16,
			\out, ~out, \pan, ~pan, \amp, ~amp * 0.1
		)
	).play
};
)

It gives me this post:

-> ( 'tlalak': a Function )
ERROR: binary operator '>=' failed.
RECEIVER:
   nil
ARGS:
   Float 0.040000   47AE147B 3FA47AE1
   nil
CALL STACK:
	DoesNotUnderstandError:reportError
		arg this = <instance of BinaryOpFailureError>
	Nil:handleError
		arg this = nil
		arg error = <instance of BinaryOpFailureError>
	Thread:handleError
		arg this = <instance of Thread>
		arg error = <instance of BinaryOpFailureError>
	Thread:handleError
		arg this = <instance of Routine>
		arg error = <instance of BinaryOpFailureError>
	Thread:handleError
		arg this = <instance of Routine>
		arg error = <instance of BinaryOpFailureError>
	Object:throw
		arg this = <instance of BinaryOpFailureError>
	Object:performBinaryOpOnSomething
		arg this = nil
		arg aSelector = '>='
		arg thing = 0.04
		arg adverb = nil
	Pfindur:embedInStream
		arg this = <instance of Pfindur>
		arg event = <instance of Event>
		var item = nil
		var delta = 0.04
		var elapsed = 0.0
		var nextElapsed = 0.04
		var inevent = <instance of Event>
		var localdur = nil
		var stream = <instance of Routine>
		var cleanup = <instance of EventStreamCleanup>
	Routine:prStart
		arg this = <instance of Routine>
		arg inval = <instance of Event>
^^ The preceding error dump is for ERROR: binary operator '>=' failed.
RECEIVER: nil

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants