Csound Csound-dev Csound-tekno Search About

[Cs-dev] Csound 7: Modules

Date2015-08-14 13:27
FromEd Costello
Subject[Cs-dev] Csound 7: Modules
AttachmentsNone  None  
Hi,

I've been looking at Javascript modules systems over the last few weeks, namely those used by node.js and browserify. 
If you are unfamiliar with these systems, basically how they work is:
If you have a Javascript file myClass.js with a class of type myClass, that you want to use in another file, at the end myClass.js you write:

module.exports = myClass

Then in the file you want to use the class you write 

var myClass = require('./myClass.js'). 

How this relates to Csound is that currently I am looking for a way to develop instruments using a live coding style. It would be nice that as I write and save a .orc file, Csound does a recompilation of the instruments I just wrote if the .orc file has been changed.
This would be really handy if you had a different instrument sending 'i' events to the instrument you are editing, each time the instrument changes you would be able to hear those changes when the next i event comes. 
I was thinking a good way to implement this would be to have something like Javascripts require as an opcode. 
You could have a main.csd file which sets up your ksmps, sr, 0dbfs and various CsOptions etc. 
Then in instrument 0, you could just import the instruments you want to use using the require opcode. 
The opcode could use the various file watching apis from Linux, OS X and Windows to check when files have changed and reload those instruments for the next i event. 
Hope that makes sense, anyone have any thoughts?
Cheers
Ed
--
Edward Costello