| Thank you. This is most helpful. I'll have follow up questions.
On Tue, Apr 24, 2012 at 12:39 PM, Michael Gogins
wrote:
> OK, the semantics. Csound has 2 languages: the orchestra language
> typically in a .orc file and the score language typically in a .sco
> file.
>
> A parser is a piece of code, the parser, that understands the syntax
> of the language. It does this by separating the code into "tokens" or
> keywords, variable names, constants, etc. and then assembling these
> tokens into a "parse tree" or "abstract syntax tree" that represents
> the grammatical relationship between the tokens. It's just like
> diagramming a sentence in grade school.
>
> A parser can merely "recognize" code (i.e. just parse it and say that
> it is valid) or it can "compile" the code (i.e. attach some little
> piece of code that actually does something, called a "semantic
> action," to each node of the parse tree).
>
> In Csound, the semantic actions invoked by the parser build the actual
> "graph" which represents the instruments, ftables, and opcodes. This
> can be considered a translation of the parse tree into another sort of
> tree. In this graph or tree (a tree is a kind of graph), the Csound
> engine automatically starts running; every kperiod it runs down all
> the instr nodes, and for each instr it runs down all the opcode nodes,
> and for each opcode it invokes the opadr function. At this point, the
> opcodes are actually carrying out the semantic actions specified by
> the syntax tree, in a repetitive sort of way.
>
> Looping over the tree of instrs and opcodes is what the "engine" or
> "runtime" does. There's not really much to it, most of the complexity
> comes in managing the creation and activation of instrument instances
> to handle score events that come from various sources. This usually
> results in the insertion of a new instr instance into the list the
> "engine" loops over. The actual performance loop is ridiculously
> simple, just iterating down lists of pointers and calling a function
> off each pointer.
>
> The "rendering" is happens when the out opcodes in the "engine" tree
> write audio to a file or device.
>
> Csound used to have a handwritten parser; code originally written by
> Barry Vercoe would read the orc file and build the runtime lists of
> instrs and opcodes. The new parser uses the, well, parser, to turn orc
> code into an abstract syntax tree and the semantic actions on the
> nodes build the runtime lists in a hopefully more reliable and
> flexible manner.
>
> The important thing to understand is that in a normal computer
> language, when the parser is done, nothing happens until the user runs
> the compiled program, which could do anything you tell it to do. With
> csound, there is this implicit assumption that the compiled program
> will begin running automatically and that it will be a signal
> processing graph attached to outputs.
>
> Nobody ever seems to spell out all these little assumptions, but
> they're vital to understanding what is really going on.
>
> What will be different in Csound 6?
>
> That is what we are trying to figure out -- what WILL be different in Csound 6?
>
> We are sure about one thing -- we want the abstract syntax tree to be
> exposed to programmers and composers via the API. This will make it
> possible for example to have plugin instruments written in C or
> whatever as well as the plugin opcodes we now have.
>
> My thinking about LLVM is, well, maybe we can replace the existing
> parser and the Csound language itself with a superset of the Csound
> language that includes all the regular stuff in other high-level
> languages as well as being backward compatible with all extant sco and
> orc, and replace the Csound parser with the LLVM back end that will
> take care of exposing the syntax tree for us. Then you won't need an
> API to access the tree, or for that matter the engine, you will be
> able to do it right from Csound code. You will still be able to do it
> from other languages as well.
>
> All the opcodes, drivers, etc. would remain as they are, but as
> libraries for the LLVM back end.
>
> The projects mentioned by Tito do something much like this, but
> instead of using a parser for the Csound language they use parsers for
> Lisp or Scheme. At least I think that is what they do. I don't know
> what they do for the performance loop, that is something I will be
> looking into.
>
> Hope this helps,
> Mike
>
> Hope this helps,
> Mike
>
> On Tue, Apr 24, 2012 at 3:00 PM, Jacob Joaquin wrote:
>> I'm working my way through the semantics here. What happens between
>> the parsing of an orchestra/score and the rendering within the synth
>> engine? How will this be different in Csound6?
>>
>>
>> On Tue, Apr 24, 2012 at 9:49 AM, Michael Gogins
>> wrote:
>>> Core csound is the ability to take a text file containing valid orc
>>> and sco code, and optionally MIDI files or real-time events, and
>>> produce a soundfile or realtime audio stream rendering that data. How
>>> it happens is beside the point. APIs and such are on top of the core,
>>> whatever it is.
>>>
>>> At one time, there were several implementations of Csound, some quite
>>> different internally (e.g. written in C++) from what we now have. But
>>> since they could all do the above (more or less), they were all
>>> implementations of core Csound.
>>>
>>> So no, the parser is not core Csound.
>>>
>>> The "engine" is not part of core Csound, either. Theoretically, it
>>> would be possible to implement the Csound language by compiling it,
>>> not into a list of instr templates instances and opcodes, but into C
>>> code that would be compiled and run as a separate program. A successor
>>> to Csound, SAOL, had an implementation, SAOLC, that did just that.
>>> Most of the opcodes in SAOLC were actually repackaged Csound opcode
>>> source code.
>>>
>>> "Core csound" is a formal language, and a specification for what that
>>> language must do.
>>>
>>> Regards,
>>> Mike
>>>
>>> On Tue, Apr 24, 2012 at 12:06 PM, Victor Lazzarini
>>> wrote:
>>>> For Csound 6, the plan is to separate them.
>>>>
>>>> Victor
>>>> On 24 Apr 2012, at 16:11, Jacob Joaquin wrote:
>>>>
>>>>> Conceptually, do developers consider the orchestra parser as it stands
>>>>> now part of core Csound? Or as a layer that sits on top of the engine?
>>>>>
>>>>> On Tue, Apr 24, 2012 at 8:03 AM, Victor Lazzarini
>>>>> wrote:
>>>>>> I agree. I had a Csound server based on Python back in 2006. I think something like that can be built with Csound, but should not be imposed.
>>>>>>
>>>>>> Victor
>>>>>> On 24 Apr 2012, at 15:45, Steven Yi wrote:
>>>>>>
>>>>>>> Hi Jake,
>>>>>>>
>>>>>>> I disagree somewhat with what you are saying. I think to force the
>>>>>>> sound server model would greatly limits the design and usage of
>>>>>>> csound. A server model can be added on top of a synchronous API, as
>>>>>>> can an asynchronous model. The design must instead be layered. The
>>>>>>> internal core of csound should be simple; all other things can then be
>>>>>>> built on top of it. Adding things like JSON or OSC as a primary
>>>>>>> interface into the core is, in my opinion, limiting.
>>>>>>>
>>>>>>> However, there is no reason a server model could not and should not be
>>>>>>> made. Rather, a server application can be done that it itself uses
>>>>>>> the same core Csound API, and this application can be distributed with
>>>>>>> Csound. It could be made to communicate via OSC, JSON, etc., and can
>>>>>>> be designed to use the API to internally communicate with an instance
>>>>>>> of Csound, as well as handle communications with a client application.
>>>>>>>
>>>>>>> In essence, by minimizing what Csound does in its core, we effectively
>>>>>>> increase its usability. We start with the design that has the least
>>>>>>> amount of latency and can introduce unknowns like network protocols on
>>>>>>> top of it. We can embed Csound directly or decide to use it in a
>>>>>>> separate process. (This is especially important for mobile
>>>>>>> applications, where interprocess communication is prohibited or very
>>>>>>> limited).
>>>>>>>
>>>>>>> Thanks,
>>>>>>> steven
>>>>>>>
>>>>>>> On Tue, Apr 24, 2012 at 3:27 PM, Jacob Joaquin wrote:
>>>>>>>> I'm in the process of writing Python prototype scripts and pseudocode
>>>>>>>> in attempt to gain a better understanding of what is needed to build a
>>>>>>>> better bridge between a lower level synth engine to a higher level
>>>>>>>> language for users. With the right bridge, I believe we could simply
>>>>>>>> the process of integrating Csound into higher level languages and even
>>>>>>>> creating a "Csound Lite/Logo" type language.
>>>>>>>>
>>>>>>>> In particular I strongly believe that a sound server model, similar to
>>>>>>>> the one employed by SuperCollider, could drastically improve the
>>>>>>>> orc/sco paradigm. Imho, the scsynth/sclang and the orc/sco paradigms
>>>>>>>> are already conceptually very similar. The difference is that
>>>>>>>> SuperCollider has great communication between the two. For example, it
>>>>>>>> isn't one-way. This is just for the orc/sco, I'm not including the
>>>>>>>> Csound API in this.
>>>>>>>>
>>>>>>>> If Csound6 supported JSON, and not just peripherally, it would be much
>>>>>>>> easier for users to do things at a higher level. I'm going with JSON
>>>>>>>> mostly because it's very lightweight and well supported, and maybe a
>>>>>>>> good match for the Csound6 API.
>>>>>>>>
>>>>>>>> For example. Let's say every unit generator in Csound6 had a
>>>>>>>> corresponding JSON data structure that throughly described its
>>>>>>>> interface, including human readable descriptions of what the unit
>>>>>>>> generator does and descriptions of each input/output. A structure like
>>>>>>>> this could be used by a language like Python to create automatically
>>>>>>>> generate classes for everything.
>>>>>>>>
>>>>>>>> Then inside inside Python, users could describe graphs / design
>>>>>>>> instruments without even considering what native Csound syntax looks
>>>>>>>> like. When it's time to compile an orchestra, or modify the current
>>>>>>>> synth runtime if Csound6 supports dynamic loading, unloading, Python
>>>>>>>> wraps it up in JSON, sends it to the server. This could potentially be
>>>>>>>> a near seamless process for users.
>>>>>>>>
>>>>>>>> Being JSON, the same principle could be applied to other languages,
>>>>>>>> like javascript or ruby.
>>>>>>>>
>>>>>>>> Best,
>>>>>>>> Jake
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On Tue, Apr 24, 2012 at 4:44 AM, Richard Dobson
>>>>>>>> wrote:
>>>>>>>>> I certainly don't wish to put a damper on any of these discussions, and
>>>>>>>>> I see all of the attractions of a 'common language" for engine and
>>>>>>>>> "pieces", but I still very much value the distinctiveness of the
>>>>>>>>> synthesis language and the scoring language(s), including in the
>>>>>>>>> latter's simplest form of note list, and in my own usage it very often
>>>>>>>>> arises that a common orchestra is used with many alternative scores,
>>>>>>>>> whether bundled in a csd or written separately. I hope that the
>>>>>>>>> principle of the orchestra and score is not consigned to the waste bin
>>>>>>>>> of history as being in any way obsolete or deprecated. Conceptually it
>>>>>>>>> still has all the merits and virtues it always had. Whatever changes are
>>>>>>>>> made, I hope the identity, character and idiom of Csound is retained,
>>>>>>>>> and that Csound6 does not become (yet) another attempt to change the
>>>>>>>>> language into something else. There will never come a time when it is
>>>>>>>>> not possible to invent new languages!
>>>>>>>>>
>>>>>>>>> I remain of the opinion that Csound is already very well placed to be,
>>>>>>>>> so to speak, a backend for higher-level languages (not least, SAOL) that
>>>>>>>>> can do whatever it is people want to do, and that, as ever, backwards
>>>>>>>>> compatibility remains a founding principle.
>>>>>>>>>
>>>>>>>>> With the new parser in place, there is also plenty of scope to consider
>>>>>>>>> perhpas in the longer term a formal reimplementation using whatever
>>>>>>>>> modern programming techniques and languages are presently in fashion. I
>>>>>>>>> am as it happens interested in the broader aspects of educational
>>>>>>>>> outreach, where a reduced and simplified language model ("Csound Lite")
>>>>>>>>> might be of great value in schools as a way to introduce music
>>>>>>>>> computing, supporting the new UK initiatives for CS in schools, for
>>>>>>>>> example; aiming at, say, Year 5s onwards.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Richard Dobson
>>>>>>>>>
>>>>>>>>> ------------------------------------------------------------------------------
>>>>>>>>> Live Security Virtual Conference
>>>>>>>>> Exclusive live event will cover all the ways today's security and
>>>>>>>>> threat landscape has changed and how IT managers can respond. Discussions
>>>>>>>>> will include endpoint security, mobile security and the latest in malware
>>>>>>>>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>>>>>>>>> _______________________________________________
>>>>>>>>> Csound-devel mailing list
>>>>>>>>> Csound-devel@lists.sourceforge.net
>>>>>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> codehop.com | #code #art #music
>>>>>>>>
>>>>>>>> ------------------------------------------------------------------------------
>>>>>>>> Live Security Virtual Conference
>>>>>>>> Exclusive live event will cover all the ways today's security and
>>>>>>>> threat landscape has changed and how IT managers can respond. Discussions
>>>>>>>> will include endpoint security, mobile security and the latest in malware
>>>>>>>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>>>>>>>> _______________________________________________
>>>>>>>> Csound-devel mailing list
>>>>>>>> Csound-devel@lists.sourceforge.net
>>>>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>>>
>>>>>>> ------------------------------------------------------------------------------
>>>>>>> Live Security Virtual Conference
>>>>>>> Exclusive live event will cover all the ways today's security and
>>>>>>> threat landscape has changed and how IT managers can respond. Discussions
>>>>>>> will include endpoint security, mobile security and the latest in malware
>>>>>>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>>>>>>> _______________________________________________
>>>>>>> Csound-devel mailing list
>>>>>>> Csound-devel@lists.sourceforge.net
>>>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>>
>>>>>> Dr Victor Lazzarini
>>>>>> Senior Lecturer
>>>>>> Dept. of Music
>>>>>> NUI Maynooth Ireland
>>>>>> tel.: +353 1 708 3545
>>>>>> Victor dot Lazzarini AT nuim dot ie
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> ------------------------------------------------------------------------------
>>>>>> Live Security Virtual Conference
>>>>>> Exclusive live event will cover all the ways today's security and
>>>>>> threat landscape has changed and how IT managers can respond. Discussions
>>>>>> will include endpoint security, mobile security and the latest in malware
>>>>>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>>>>>> _______________________________________________
>>>>>> Csound-devel mailing list
>>>>>> Csound-devel@lists.sourceforge.net
>>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> codehop.com | #code #art #music
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Live Security Virtual Conference
>>>>> Exclusive live event will cover all the ways today's security and
>>>>> threat landscape has changed and how IT managers can respond. Discussions
>>>>> will include endpoint security, mobile security and the latest in malware
>>>>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>>>>> _______________________________________________
>>>>> Csound-devel mailing list
>>>>> Csound-devel@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>
>>>> Dr Victor Lazzarini
>>>> Senior Lecturer
>>>> Dept. of Music
>>>> NUI Maynooth Ireland
>>>> tel.: +353 1 708 3545
>>>> Victor dot Lazzarini AT nuim dot ie
>>>>
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Live Security Virtual Conference
>>>> Exclusive live event will cover all the ways today's security and
>>>> threat landscape has changed and how IT managers can respond. Discussions
>>>> will include endpoint security, mobile security and the latest in malware
>>>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>>>> _______________________________________________
>>>> Csound-devel mailing list
>>>> Csound-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>
>>>
>>>
>>> --
>>> Michael Gogins
>>> Irreducible Productions
>>> http://www.michael-gogins.com
>>> Michael dot Gogins at gmail dot com
>>>
>>> ------------------------------------------------------------------------------
>>> Live Security Virtual Conference
>>> Exclusive live event will cover all the ways today's security and
>>> threat landscape has changed and how IT managers can respond. Discussions
>>> will include endpoint security, mobile security and the latest in malware
>>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>>
>>
>> --
>> codehop.com | #code #art #music
>>
>> ------------------------------------------------------------------------------
>> Live Security Virtual Conference
>> Exclusive live event will cover all the ways today's security and
>> threat landscape has changed and how IT managers can respond. Discussions
>> will include endpoint security, mobile security and the latest in malware
>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>
>
> --
> Michael Gogins
> Irreducible Productions
> http://www.michael-gogins.com
> Michael dot Gogins at gmail dot com
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
--
codehop.com | #code #art #music
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/lis |