Thursday, June 30, 2011

zsnd

Copperbox revision 2479.

I've added some more opcodes to Core - the physical model of vibes and others. This is so I've some default instruments to use for building the higher-level layers.

Also I've added OnsetNotelist to Basic. This is a note list for instruments without dynamic prolongation like vibes, each note has the same duration but the onsets can start with different advances.

Wednesday, June 29, 2011

zsnd-core

Copperbox revision 2478.

I've changed the IRate phantom unit to IInit as the i-prefix in Csound doesn't actually correspond to a rate (i is initialization time).

Also I've added some more filter opcodes.

zsnd-core

Copperbox revision 2477.

I've added pseudo-opcodes for assignment, these produce assignment statements in the generated Csound code, but are treated exactly like declarations in ZSnd (so the Click language can schedule them when all ports are saturated).

Tuesday, June 28, 2011

zsnd-core

Copperbox revision 2476.

I've extended the arity of the index functions to go up to 11 -  this should cover all but pathological cases.

zsnd-core

Copperbox revisions 2474 and 2475.

I've changed the Inst directory to CsoundInst so the naming scheme for scores and instruments is more uniform. Also Inst.HighLevel becomes CsoundInst.Typed and Inst.MonadicDefn becomes CsoundInst.Monadic.

zsnd-core

Copperbox revision 2473.

I've updated all the opcodes to work with the new Click representation and reimplemented the monadic layer (so definitions can use the do-notation).

Monday, June 27, 2011

zsnd-core

Copperbox revision 2472.

I've replaced the old implementation of Click with the code from ClickNew and deleted ClickNew. The helpers that were in the working example NewPortSpec have been put into their own modules.

Note - there is still a lot of code to move over to the new Click implementation - the monadic layer which allows Inst definitions to be built with the do-notation and all the opcodes.

zsnd-core

Copperbox revision 2471.

I've sorted out dependency resolution in the new Click implementation, so the example now works properly.

Sunday, June 26, 2011

zsnd-core

Copperbox revision 2470.

I've added a new version of Click that builds the result Csound instrument from a dependency graph rather than generating 1-1 a statement for each declaration (regardless of whether the declaration is used).

The new Click code is unfinished - port assignment doesn't work.

Saturday, June 25, 2011

zsnd-core

Copperbox revision 2469.

I've added local variable declarations to the Click Inst definitions. I haven't tested them yet to see if the make complex instrument definitions easier. Hopefully global variables should follow the pattern used for local variables when I come to add them.

zsnd-core

Copperbox revision 2468.

Work tidying up the Inst code.

I'm looking towards adding variables into the Inst definition - translating the Xanadu instrument without them was too difficult. But, I'm not sure where variables should fit in the syntax, so I've tidied up the code and removed some out-of-date comments first.

zsnd-core

Copperbox revision 2467.

I've now replaced the old instrument definition with the new Click port style definition. All the opcodes have been updated, which was quite a slog, and ZSnd-Core is functional again (no broken code or examples).

Friday, June 24, 2011

zsnd-core

Copperbox revision 2466.

I've added a typed monadic layer for the Click instrument language, so the Click language is nearly powerful enough to replace the original instrument language.

zsnd-core

Copperbox revision 2465.

I've changed the representation of Click syntax to be a list of statements rather than a nested Let-declaration. This simplifies the current code and should make it easier to add a monadic layer on top for building instruments.

zsnd-core

Copperbox revision 2464.

I've added automatic parens insertion to the expression pretty printer.

Thursday, June 23, 2011

zsnd-core

Copperbox revision 2463.

The previous translation from Click to Inst definition had severe problems that I didn't spot whilst coding it. I've replaced it wholesale with a new translation scheme. Note, in the new version there is a bug with embedded ports where the port is within a larger expression that needs to be ironed out.

Wednesday, June 22, 2011

zsnd-core

Copperbox revision 2462.

Port assignment now works when generating code from the Click style definitions.

Next, I've got to re-implement expression handling and all the named opcodes...

zsnd-core

Copperbox revision 2461.

I've worked up the translation from Click style definitions to Csound instruments so that is accurate - opcode invocations are in the right place and only one is generated.

Ports still need to be handled, so I cannot generate working instrument definitions just yet.

Tuesday, June 21, 2011

zsnd-core

Copperbox revision 2460.

Initial work on building instruments with syntax patterned after the Click modular router configuration language, rather than using do notation syntax. This might lead to more manageable instrument definitions. 

There is a lot of work to do as I haven't worked out the details of the translation scheme or how to represent Ports in the Click language.

Sunday, June 19, 2011

zsnd-basic

Copperbox revision 2458.

I've changed the context so there is a concrete system context for tempo and a parametric user context for instrument specific parameters. The system context will be extended with the staccato_factor from the AdvNotelist.

Update - revision 2459. AdvNotelist now uses staccato_factor from the system context.

zsnd-basic

Copperbox revision 2457.

Work extending the AdvNotelist - I've added a transformer version and made the interface more comparable to the Notelist monad.

zsnd-basic

Copperbox revision 2456.

I've added a new notelist object based on concatenation rather than time-line positioning.

Saturday, June 18, 2011

zsnd

Copperbox revision 2455.

I've moved the symbolic pitch modules into a new package zsnd-symbolic, this is will form the analogue to wumpus-drawing.

Thursday, June 16, 2011

zsnd-core

Copperbox revision 2454.

Some work tidying the Inst code. I can encode yesterdays experiment with the Inst builder as it is, but I'm still not really satisfied with way of defining instruments. I've been working with a CPS implementation but so far the results aren't especially promising.

Wednesday, June 15, 2011

zsnd-core

Copperbox revision 2453.

I've added an experiment in designing a new notation for instruments. Rather than define a instrument as a graph within the do-notation, I'm trying to get a more linear definition similar to ChucK. Graph definitions don't really seem composable, whereas a linear definition might be more promising - in Haskell, Lava seems to be an obvious precedent.

Tuesday, June 14, 2011

zsnd

Copperbox revision 2452.

Minor updates - changed naming scheme of Gen routines in zsnd-core, and removed commented out code in zsnd-basic.

Sunday, June 12, 2011

zsnd-basic

Copperbox revision 2451.

I've reworked the Score datatype - it now supports composition (overlay, concatenation).

zsnd-basic

Copperbox revision 2450.

I've added new modules PosEvent, which is PosObject in Wumpus, and Concat. It looks like the current Score datatype will need a rework as currently it is incompatible with the concat type classes.

Saturday, June 11, 2011

zsnd-basic

Copperbox revision 2449.

I've added some more of the Wumpus objects - AdvObject, Connector, TraceLoc - and a symbolic pitch type.

I'm not sure whether AdvObject with have a reasonable use-cases for modelling events. Connector might be interesting though - it seems like it could be used for interpolations. TraceLoc might actually be more idiomatic for modelling note lists than TraceNotelist.

Friday, June 10, 2011

zsnd-basic

Copperbox revision 2448.

I've added a module of gen routines - these are the same as the gen routines in ZSnd-Core, but they are lifted to LocEvent so they can be used in the TraceNotelist monad. With this in place, I can now generate scores in the high level language.

zsnd-basic

Copperbox revision 2447.

I've added the TraceNotelist module which is analogue to TraceDrawing in Wumpus-Basic. This provides the Notelist monad - the main monad to build note lists with.

Thursday, June 9, 2011

zsnd-basic

Copperbox revision 2446.

I've started a new project zsnd-basic, building a higher level layer on top of zsnd-core. Unlike ZMidi, there is a much better analogue to Wumpus-Basic. The major difference is that there isn't a unified context, cf. the DrawingContext in Wumpus-Basic - instruments are expected to have their own context.

Wednesday, June 8, 2011

zsnd-core

Copperbox revision 2445.

Various updates to the Inst / orchestra code. I've recreated a more substantial example from the Csound demos (the Zanadu FM synthesizer) which revealed some problems. Some I've fixed - allowing the int pretty printer to print negative numbers and printing floats in decimal notation, but others are more pernicious. As  a quick work around I've added a parens combinator to draw parens in the output code. This could be achieved with a proper unparser for arithmetic expressions that adds parens automatically, but I'm not minded to write one at the moment. The other problem is I seem need transparent casts in the Haskell code:
inst3 :: Inst
inst3 = runInstBuilder 3 $ do 
    ishift        <- ivar 0.00666667
    ipch          <- ivar (cpspch $ pfield 5)
    ioct          <- ivar (octpch $ pfield 5)
    (kadsr::Kr)   <- linseg 0 (pfield 3 / 3) 1.0 
                              [ ((pfield 3 / 3), 1.0), ((pfield 3 / 3), 0)]
    (kmodi::Kr)   <- linseg 0 (pfield 3 / 3) 5 
                              [ ((pfield 3 / 3), 3), ((pfield 3 / 3), 0)]
    (kmodr::Kr)   <- linseg (pfield 6) (pfield 3) (pfield 7) [] 
    a1            <- avar $ castAR $ kmodi*(parens ((kmodr-1)/kmodr))/2
    a1ndx         <- avar $ abs ((a1 * 2) / 20)
    a2            <- avar $ castAR $ kmodi*(parens ((kmodr+1)/kmodr))/2
    a3            <- tablei_ a1ndx 3 1 0 0
    (ao1::Ar)     <- oscil a1 ipch 2
    a4            <- avar $ exp((-0.5) * a3 + ao1)
    ao2           <- oscil (a2 * castAR ipch) ipch 2
    (aoutl::Ar)   <- oscil (1000*(castAR kadsr)*a4) 
                           (ao2 + castAR (cpsoct(ioct+ishift))) 1
    (aoutr::Ar)   <- oscil (1000*(castAR kadsr)*a4) 
                           (ao2 + castAR (cpsoct(ioct-ishift))) 1
    outs [aoutl, aoutr]


I think it will be a good idea to allow instrument definitions in native Csound to be combined with scores in Haskell. Whilst embedding the instrument language in Haskell was an interesting technical challenge, instruments are generally going to be easier to define with Csound rather than Haskell.

zsnd-core

Copperbox revisions 2443 and 2444.

I've added a module for the signal modifier opcodes (envelopes, delays etc.). I'd never noticed before that Csound has nullary opcodes, e.g. delayw, fortunately as opcodes are represented with a list of results, nullary opcodes are just the empty list. 

Tuesday, June 7, 2011

zsnd-core

Copperbox revision 2442.

Now that I have a rate polymorphic opcode function, I've been able to replace the code duplication where I had to make a class for functions that could return either at AR (audio rate) or KR (control rate) but not IR (init rate).

zsnd-core

Copperbox revision 2441.

I've changed opcode so it is overloaded. The previous version didn't actually work for functions that were totally rate polymorphic as it always generated i-prefixed variables.

zsnd-core

Copperbox revision 2440.

I've split the opcodes into multiple files - there are so many of them that they need their own organization.

Monday, June 6, 2011

zsnd-core

Copperbox revision 2439.

Work implementing opcodes. Unfortunately this is going to be a very laborious task as the tricks to get some static typing in the instrument definitions make the opcode definitions repetitive. And there are a lot of opcodes.

zsnd-core

Copperbox revision 2438.

More gen routines - I've now wrapped all the ones listed in the Csound book. One problem with the Csound book and manual is that they rarely mention whether arguments are integral or floating types - it's quite likely I've made a number of wrong guesses in the types of the Haskell wrapping functions.

zsnd-core

Copperbox revision 2437.

I've added more gen routines and made table number assignment implicit in the monad as numbering is usually sequential from 1. Numbering can be controlled with a setter if necessary.

Sunday, June 5, 2011

zscore - now zsnd-core

Copperbox revision 2436.

I've renamed ZScore, it is now ZSnd-Core. If the project grows, it is expected to follow the Wumpus pattern - Core for the code that directly generates output, Basic for a high level layer that is feasible to program with.

zscore

Copperbox revision 2435.

I've added a top-level shim module and renamed the CsoundGens module to GenRoutines. As I've noted previously, the whole project will actually need a new name as it generates both scores and orchestras...

zscore

Copperbox revision 2434.

The Inst example now generates a valid .csd file, which can be run with Csound.

zscore

Copperbox revision 2433.

I've added carry shorthand to the score file output. This should make the generated scores a bit easier to read.

Saturday, June 4, 2011

zscore

Copperbox revision 2432.

I've added a typed layer to the Inst language to differentiate signal rates. Plus, I've simplified the Score syntax and added a monadic builder (Writer).

zscore

Copperbox revision 2431.

I've added a module for opcodes. Plus I've decided to generate variable names rather than annotate them directly as Strings, the example from yesterday now becomes:

demo01 :: Doc
demo01 = format $ runInstBuilder 199 $ do
   iamp <- ivar $ pfield 4
   ifrq <- ivar $ cpspch (pfield 5)   
   a1   <- oscil iamp ifrq 1
   out a1

Friday, June 3, 2011

zscore

Copperbox revision 2430.

I've started a new music experiment ZScore to generate Csound - I'll rename it soon as will have the capability to generate both score and orchestra files. Orchestra generation seems to work quite well in the do-notation, with one unfortunate exception - variable names can't be reified, so they must be duplicated as Strings:


demo01 :: Doc
demo01 = runInstBuilder 199 $ do
   iamp <- var "iamp" $ pfield 4
   ifrq <- var "ifrq" $ cpspch (pfield 5)   
   a1   <- oscil "a1" [iamp, ifrq, 1]
   out a1

Thursday, June 2, 2011

wumpus-tree

Copperbox revision 2429.

Some tidying up. I'm still not sure how I intended to handle references in Wumpus-Tree, so as a prelude I've tidied up some of rough edges in the code.

Wednesday, June 1, 2011

wumpus-tree

Copperbox revision 2428.

Initial work adding references to the intermediate tree. This work is intended to replace the current monadic tree building as do-notation is more a hindrance than help for building trees, but I've got a lot of details to work out.

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.