Monday, February 27, 2012

glsl-syntax - abandoned

Copperbox revision 2714.

I've partially updated the syntax to make better distinction between declarations and declarators, but I've decided to abandon the project again. Basically I never had a concrete use for a GLSL parser and I was using the project to learn something about the GLSL language. However, the C style syntax for declarations is so horrible that writing a parser is no fun and hardly instructive. My time is better spent on other things.

Sunday, February 26, 2012

glsl-syntax

Copperbox revision 2713.

The parser now works - it must never have been working when I abandoned it as I had to relax the distinction in the parser grammar between identifiers and field selectors - basically the lexer never knows what is a field selector so it has to class everything as an identifier.

The parser isn't going to be robust - I think GLSL code in the wild uses CPP which it obviously can't handle. Also I think the grammar for GLSL has changed vis void main () and void main (void) - as my parser is LALR, which is always a struggle to use, I'm not going to rush to make it handle errors and discrepancies.

Saturday, February 25, 2012

glsl-syntax

Copperbox revision 2712.

I've picked up on the old GL Shading Language parser and pretty printer. It will be useful to change the pretty printer to use hpj-pretty-expr as the GL Shading Language is big enough to be considered industrial strength.

Clearly I hadn't discovered Hughes lists when I first worked on GLSL as I was using Data.Seq in the syntax tree so I could build with snoc-ing.

There is some connection between shading languages and Csound and Supercollider instrument languages. Both types of language essentially describe what goes on in a single iteration of a rendering loop.

hpj-pretty-expr

Copperbox revision 2711.

I've changed languages to only use one module - this should make for a better user API. I've worked up the Ocaml printers, the other languages need work.

Friday, February 24, 2012

hpj-pretty-expr

Copperbox revision 2710.

I've started a new project for pretty printing expressions.

The base code is from Norman Ramsey's paper "Unparsing Expressions With Prefix and Postfix Operators". My hypothesis is that if I define sets of expression / operator printers for languages like C or Haskell people can use the library and get good parenthesized pretty printing with only a little more code than writing a naive (brackets everywhere) pretty printer.

Thursday, February 16, 2012

orchsyn

Copperbox revision 2709.

I've got a bit stuck with Orchsyn due to building code within a monad. The do-notation seems to make the embedded language a statement language, but this means I don't know what types the opcode built-ins should be (so they can account for arity of the result).

As an alternative, I've be experimenting using the tagless-final style to embed an expression language with sharing within normal Haskell (not the do-notation). I'm quite pleased with the results - I've embedded ref cells, lambda and apply, sharing let, if-the-else and primitive apply (for calling built-ins). The only problem is an expression language will need a real compiler - the abstract syntax is too far from Csound's imperative language to just pretty print to Csound.

This commit stores a series of expression languages (adding more features) as I don't want to lose them.

Tuesday, February 14, 2012

orchsyn

Copperbox revision 2708.

I've added an environment for binding pfields to names at init time. User code can now reference declared pfields without the risk of declaring them twice (orchsyn doesn't have a proper notion of scoping).

Monday, February 13, 2012

orchsyn

Copperbox revision 2707.

I've added lvalues to the monadic builder to make it support reassignment. The syntax is not very pleasant as I need to cast lvalues to rvalues on the righthand side. Also I've got rid of some overloading - now there are separate functions to demand variables of different types (rates - I K A).

Sunday, February 12, 2012

orchsyn

Copperbox revision 2706.

I've worked up the Instr monad and added a fairly large set of Csound builtins. Orchsyn is now comparable to ZSnd the previous prototype.

There is still a lot to do with Orchsyn, as I haven't implemented anything of the compiler (which should optimize variable use) or worked out how to build instruments compositionally.

Tuesday, February 7, 2012

functional envelopes

Whilst writing FMSS, I didn't spot that envelopes can be a function from Duration to Signal.

Idiomatic Csound envelopes are defined contingent to note duration - pfield 3:

idur = p3
; pass envelope sweep from 0.0 to 600
linseg 0.01, idur, 600.0


In FMSS, rather than have the note duration as a free variable (which might have lead me to the functional formulation sooner...) I had global reference idur. Maybe the functional view, if it can build other signals, makes it possible for UGen assemblies to be be more compositional.

Monday, February 6, 2012

majalan

I haven't thought enough about "procedural scores" so far - procedural being a score that is somehow run rather than specified as a note list.

The most obvious first procedural score is a click track, here is a Csound instrument for clicks:

sr = 44100
kr = 4410
ksmps = 10
nchnls = 1

; Set the 0dbfs to 1.
0dbfs = 1

;
; A click for click tracks.
;


instr 1
  idur      = p3
  iamp      = p4
  ihdur     = idur * 0.5

  kampenv   expseg 0.01, 0.005, 1.0, ihdur, 0.02, ihdur - 0.005, 0.01
  kbeta     line 0, p3, 1

  ; pass envelope sweep
  kpenv  linseg 0.01, p3, 600.0

  a1        noise     1, kbeta
  abw       butterhp  a1, kpenv
            out       iamp * abw * kampenv
       

endin


Sunday, February 5, 2012

majalan and zmidi-basic

Copperbox revision 2705.

Various updates to Majalan and ZMidi-Basic as I make Majalan more like ZMidi.

I'm a bit at a loss for ideas on high level structures - how to make systems out of events and how to manipulate them, so work has been slower than I hoped.

Friday, February 3, 2012

majalan

Copperbox revision 2704.

I've ported the EventList with efficient concatenation from ZMidi-Basic. This will form the basis of Majalan-Basic, which is pending a rewrite.

Thursday, February 2, 2012

majalan-core

Copperbox revision 2703.

I've tidied up after yesterday's work deleting old modules and renaming others. The work should now be good enough for me to port the score language from ZMidi-Basic to Majalan (Csound).

Wednesday, February 1, 2012

majalan-core

Copperbox revision 2702.

I've hacked Majalan-Core so it works with the new NoteList. This really is a hack - although the code seems to work, much of the odd code has been left it and will need removing.

Blog Archive

About Me

My photo
Disambiguating biog as there are a few Stephen Tetley's in the world. I'm neither a cage fighter or yachtsman. I studied Fine Art in the nineties (foundation Bradford 1992, degree Cheltenham 1992 - 95) then Computing part-time at Leeds Met graduating in 2003. I'm the Stephen Tetley on Haskell Cafe and Stackoverflow.