How to use `\degree` and `\scale` with `\dirt` event type?

I’m trying use SuperDirt directly in Supercollider, and I’ve seen that \degree and \scale don’t work with the \dirt event type – they seem to not be implemented. I guess that’s because they are taken care of on the Tidal side of the system, but, is there a workaround to be able to use them like I would with a \note event type?

I extended a class to manually set it, but it’s too hacky for my taste. What would be the right way to implement it?

You could make an EventType (\dirtDegrees maybe) that sets type to \dirt: from the help for Event:

// It is possible to reuse some of another event type's functionality:
(
Event.addEventType(\happyEvent, { |server|
    ~octave = [5, 6, 7]; // always play three octaves
    ~detune = 10.0.rand2; // always play a bit out of tune
    ~type = \note; // now set type to a different one
    currentEnvironment.play;
});
1 Like

I think SuperClean was made partially for solving this. But it’s of course more than that now.

1 Like

ah, right, hadn’t thought of that. Thanks.

Do you know if it’s currently maintained. Last commit is 2 years old.

I think so. @t36s knows!

1 Like

I’ve been looking into this. I checked the parent type of \dirt event type, and it’s \note.

Pbind(\type, \dirt).asEventStreamPlayer.event.parent.type
// -> note

Which means that \degree is already defined. According to the Event help file:

For the usage and meaning of the parent and proto events, see IdentityDictionary

which says:

Looking up a key within a dictionary first checks the dictionary itself. If the key is not found at this level, it looks in the proto , and if still not found, it looks in the parent.

To make sure, I polled \degree and it does indeed already exist.

Pbind(\type, \dirt).asEventStreamPlayer.event.parent.degree
// -> 0
Pbind(\type, \dirt).asEventStreamPlayer.event.parent.bla
// -> nil

So it’s just \dirt ignoring it. I made it work redefining it:

Event.addEventType(
	type: \my_type,
	func: { |server|
		~degree = ~degree ? 0;
		~n = ~n ? ~scale.at(~degree) ? 0;
		~type = \dirt;
		currentEnvironment.play;
	},
);

I have been summoned.
A while back I became frustrated with using SuperDirt so I did what I am told is called a hard fork.

I have done quite a few things in SuperClean to try to get everything usable inside SuperCollider. \degree and \scale work fine for example.

I use it every day. I like it. Let me know if you’d like help getting sat up. I do that kind of thing all the time.

Otherwise, there is also this text walkthrough here, and below that a video with speech synthesis walkthrough:

https://danielmkarlsson.com/superclean-installparty/

6 Likes