I would really like to know how to take some already generated SC code like this http://sccode.org/1-5al#c813 and convert it to Norns. Obviously taking that code and putting in Norns will get a bunch errors. I want to know what syntax to change to get something like that to work and what is compatible between the two codes at the most basic level.
I suggest to have a look at the code for the “PolyPerc”-Engine: https://github.com/monome/dust/blob/master/lib/sc/Engine_PolyPerc.sc
It’s extremely simple and as such is a great example for the specific syntax you need. You can easily exchange the synthdef for something else and change the parameters and functions to fit your new synthdef.
Thanks - I’ll check it out.
I guess the point I’m making is there are years of code already out there, and at first, I want to be able to do something using existing code, rather than trying to reinvent the wheel. If I can see / modify existing code first, then it gives me ideas to reinvent the wheel
Basically I treat the code like I would a modular synth - each different piece of code being a module and I want to know how to combine them to make a patch - a little bit like what was done with that great Karplus patch posted a few weeks ago. Using an existing Karplus algorithm, adding a different filter code etc to make a final patch. Mixing a matching different UGen’s as it were.
Maybe I am under a huge misconception here but I assumed it would be possible to use pregenerated SC code within norns with just programming a few connections to the lua surface? Or does norns use a different SC version?
If you put that code i listed in Maiden, the first error would be on line 1 - it doesn’t like “//” but from the tutorial that would need to be “- -” instead. Its small things like this I would like to know to get patches to work. The syntax is slightly different from what I gather
If you look at the Dust repo link as @x2mirko suggests, that’s exactly the comment syntax used. The double dash is a Lua comment syntax, not SC. @Leverkusen I see nothing in the code that suggests that existing SC code cannot be used without some additional code to exposure the workings out to Lua. Don’t panic just yet, and perhaps just wait until @tehn gets to it in the Studies?
Are you even supposed to edit sc-files in maiden? I was under the impression so far that it was just used for lua editing. I did all my sc programming on norns so far with vim via ssh
Thanks, will do
I think that’s the bit I really need to know the most.
I guess it’s more to highlight some thing’s I hope it will be addressed at some stage in future studies. Appreciate everyone’s help on what is obviously early days on a huge project
I have absolutely no idea! I thought maiden was for everything program related. So for SC I should use vim? And lua use Maiden?
Any text editor will do, I just personally prefer vim, but someone else might say emacs or nano or notepad or whatever else you can find that edits text files. vim (and emacs) might actually not be what you want. They both use rather arcane commands that are fast if you’ve practiced using them a whole lot, but they’re not necessarily what one might choose just to edit a file from time to time.
Ach, I wouldn’t call it panic. The next opportunity to get a Norns will be in autumn anyway unless one pops up somewhere on the european used market.
Loosely following the discussion till then is confusing sometimes as I want to keep track and figure out if it really is what I imagine it is, while I cannot just try things out and learn what it is…
this should probably be all moved to a new topic…
(perhaps time for a norns:supercollider/crone topic?)
heres what I found when I started to mess with SC a bit on norns.
(someone feel free to correct me if Ive got this wrong/incorrect)
No…for a couple of reasons… but main ones are, maiden doesn’t know SC format, you can’t place files where they need to go, and it would need to restart crone/scsynth.
what maiden does provide is a way of seeing SC errors on the sc tab.
anyway some random findings:
Engines need to be placed in ~/dust/lib/sc
how you edit these (i.e. editor choice, and locally or remotely , is up to you )
(not sure if sub directories are allowed, could get crowded in one directory)
Crone (and I think matron) need to be restarted to add new engines (and edits)
on the norns box, this is
~/norns/stop.sh ; ~/norns/start.sh
Errors (debugging etc)
if you have an error in your SC , you’ll be able to see this in the sc tab of maiden.
however, I found when I accidentally forgot to rename the Engine, this cause crone(actually scsynth) to fail to start… so I got audio engine failed to load … so I guess there are a class of errors when this might happen.
(to ‘debug’ these I found the easiest way was to just run sclang, and see what errors it threw up)
(hopefully over time the above ‘workflow’ could be refined a bit… currently, I found I just left an ssh logged into norns to do this all, but would nice if this could all be done via maiden)
apart from that, creating engines from existing SC code, should not be too difficult
basically the process is, create a new ‘Engine’ derived off CroneEngine, this can ‘wrap’ the existing code.
this wrapper does a few things… sets the in/out contexts, allows you to ‘addCommands’ which are what you map to parameters on the lua side.
Its also a good idea to check out a few of the Engine SC classes , as they all seem to do things slightly different.
I guess perhaps due to when they were written and by who… but I find it a bit confusing
e.g. I see a few calling synthdef() .add() , but some do CroneDefs.add(synthdef)
perhaps ‘best practices’ will become clearer during the studies.
that said my SC is rusty, so perhaps when Im more back in the flow with it, it’ll become clearer.
Okay, I understood that my questions have been uninformed and might only have been loosely attached to the topic. Nevertheless I find it not very polite to just delete them! Thanks.
I didn‘t get removed.
Just moved: Norns: crone/supercollider
Oh, all good then - I just could not find the conversation anymore and thought it was gone.
just want to make this very clear: maiden is for editing lua scripts. you’re trying to run SC code in the lua interpreter.
the information you need is already in the thread but to sum up:
- put new engines in
- use a text editor, not maiden.
- restart the norns when you make changes (we’re working on better tooling for this, slowly)
- see this post for a commented engine template: https://github.com/monome/norns/wiki/FAQ
- direct link to simple passthrough example on gist: https://gist.github.com/catfact/c08ec86bd7def0a1b072925e1287a4af
Engine_Glut, &c for respectively more sophisticated examples.
- you should be able to wrap pretty much any SC code in a new engine.
if you do the former, the synthdef will be compiled and sent on engine init.
if you do the latter (which i prefer) the defs will be compiled and sent on startup, incurring no runtime overhead.
it’s not a big deal either way.
Thanks for the info - the info about how to edit sc and lua is clear
Yesterday, I did start using the editor that is built into the Supercollider program on os-x to edit sc, as that allows to check bad code and listen to the results. Are there any issues doing it this way? Or best to stick to a text editor? If using a standard text editor what text format to save it as, as there are many options?
no that works fine.
my suggestion would be to use the norns SC classes and develop engine using scide (or your preferred editor) on laptop, then copy them to norns.
just gearing up for a couple of projects. Couple of questions
running the SC classes on my laptop - should be able to manipulate them using OSC right? is there any nice (preferably command line) tool for doing that that anyone knows of? (Edit: this assumes that my reading of the engine.lua code is right. Ie it takes all the osc commands and exposes them as methods of engine)
CroneGenEngine - this looks like it’s meant to wrap a lot of boiler plate logic for a synth engine but it also looks very unfinished is this under development? part of the direction things are heading in? (not important for the current project I’m working on because that’s going to need its own engine for reasons but just interested)