Xy / PreProcessor

xy is a live coding & sequencing language which serves as a reference for the PreProcessor.sc class extension.

If anyone here is new… to install an extension:

+ PreProcessor

You must install ‘git’, which is the software version handling protocol used by ‘GitHub’, from the same author as Linux. It’s as easy as installing SC.

Preprocessors are universally recognized across programming languages… allowing one to create custom & unique forms of behavior.

In SC, the interpreter is accessible through the keyword this, and the interpreter’s .preProcessor function (which all interpreted code can be forcibly piped through) exists in the core library.

	|code| inform(code)
	// the final value must be the code to execute
	// the code can be forcibly modified using 
	// any form of text or string manipulation
	// and the interpreter itself is available 
	// as the last of *two* arguments defined in 
	// it's source function: arg code, interpreter;

The PreProcessor quark aims to extend the functionality of SC’s core .preProcessor for the interpreter.

xy was made to serve as a point of reference, & as a skeleton/template, or foundation, for one’s further vision.


		;x =
					|code event|

					var separate = split(code,$,)
					var instr = separate[0].asSymbol
					var xy = separate[1].asList	collect: switch
						$`, 0,
						$x, 1,
						$y, 1.177)
							\y, Pbind
								\amp, Pseq(xy, inf),
								\instrument, instr,
								\dur, 1/4
// `,bass,x`xy,`.(x).y.play

*xy is adapted from lvm’s xoxo, a (very similar language written in one line…

alternate delimiter syntax using core functionality:

		if(code.beginsWith("<|") and: code.endsWith("|>")){/*
		// custom behavior */}{ code }

alternate xy syntax with #'s 0-9:

var xy = separate[1].as(List).collect
		$x, 1,
		$y, 0,
		xy, digit(xy))

I’m having a hard time understanding this, but I’m intrigued. Seems like you’re intending it for short-handing code or functions? I would love to see/hear about how you’re using this and applying it.

The extent of my intention ends in this thread… it’s true purpose is to serve as a reference for others to build their own implementation, using xy as a skeleton project, or template.

It runs out of the box, and it’s last line will fire up a beat:

It’s for sequencing notes & all synthdefs… for a pure SC version of Tidal, or a similar target.

1 Like

The possibility of intercepting code using the preProcessor is something that I always wished to do. It can really open up things for creating small DSLs but I never took the time to do something that is carefully thought and designed. I am following with a particular attention all the projects that are playing around with the preProcessor (all available on GitHub) :

There are some other projects that are further away from core SCLang but that are still very interesting. The one I find the most intriguing and fruitful is Ziffers, built around Sonic Pi as some sort of numerical / algorithmic language for generating patterns. Amiika once started implementing the basic mechanism for Ziffers on SC but I understand that he did not wished to push forward.

Thanks for the ressources! I will have to play around with this! :slight_smile:

That’s tight… in a way, I sort of expected there to be more in this area from the community, but it seems almost esoteric.

The use of the backtick & comma characters for splitting & delimiting xy IMO is apex.

  • No shift required
  • No visual / flow static

The hand posture:

  • Left ring on backtick
  • left index on x
  • right index on comma
  • left middle finger on 1 (option)
  • left index still on x…

One or x for hits, and the rest is wide open…


Ahh cool. I finally had a chance to install the Quark and test your code. Very interesting. I’ll need to check the other links Bubo posted too. I like the ergonomics for sure. With these it’s always interesting in how to add a bit more complexity then essentially an XOX sequencer while remaining light on the typing and easy on the readability.

Would still love to see/hear how you’re putting this to use!