[sdiy] (OT) theory of programming/philosophy of programming books?

Noah Vawter nvawter at media.mit.edu
Tue Feb 7 17:16:11 CET 2012


If you're going to go for the long-haul, I recommend checking out "antlr." 
http://www.antlr.org/download.html 

It's a free academic project and is essentially a way to parse anything and then translate it into anything else.
It's kind of a hardcore CS project to an EE like me, but I am getting up to speed on it after learning its key vocab.  
It's really just a big state machine with a very helpful user interface.  It has shown me similarities between so many kinds of data structures, and I'm just getting started.  It also encourages writing parseable computer languages and possibly even more spontaneous computer languages…  But I think it in practical reality, it's more often used for refactoring large projects…   Personally, I'm trying to design a high-level music DSP language.  e.g.

my high-level generic DSP code:

cb  = circBuff(256)
rc0 = RCStage(0.5);
rc1 = RCStage(0.5);

mainLoop
{
    cb.add(in1);      // write input1 to circularBuffer cb

    rc0(in1);        // apply rc stage to in1

    rc1(rc0.l);        // apply rc stage to rc0

    out1 = rc1.out;    // hear 
}


which can be antlr-converted into many different languages, from perl to C to 56k assembly.



e.g.  off-line simulation in perl:

#!/usr/bin/perl

# initialize circularBuffer cb(256)
$cbIdx = 0;
$cbMask = 0xff;   

# initialize RCState rc0
$rc0Out=0;
$rc0Coeff=20000/44100;   # greater than .5 at first

# initialize RCState rc1
$rc1Out=0;
$rc1Coeff= 20000/44100;

# main loop: highpass, lowpass
while(<>)
{
    $t++;
    chomp;
    $in1=$_;

    # write input1 to circularBuffer cb
    $cbIdx = ($cbIdx + 1)&$cbMask;
    $cb[$cbIdx]=$in1;

    # RC stage rc0  - operates on input -
    $rc0l = (1-$rc0Coeff) * $rc0l + $rc0Coeff * $in1;
    $rc0h = $in1 - $rc0l;

    # RC stage rc1 - operates on rc0h
    $rc1l = (1-$rc1Coeff) * $rc1l + $rc1Coeff * $rc0h;
    $rc1h = $rc0h - $rc1l;

    # listen to ...
    $out1 = $rc1h;

    # print it
    if($t>10000){print "$out1\n";}
}




or C for MaxMSP:

////////////////////////// object struct
typedef struct _simplemsp 
{
        t_pxobject                                      ob;                     // the object itself (t_pxobject in MSP)
        float                                           offset; 

    float rc0Coeff;   
    float rc0l,rc0h;
    float rc1Coeff;
    float rc1l,rc1h;
} t_simplemsp;

t_float filterQueue(t_simplemsp *x,float in)
{
    // RC stage rc0  - lowpass
    x->rc0l = (1.0 - x->rc0Coeff) * x->rc0l + x->rc0Coeff * in;
    x->rc0l = enforce_safety(x->rc0l);
    x->rc0h = in - x->rc0l;
    
    // RC stage rc1 - highpass
    x->rc1l = (1.0 - x->rc1Coeff) * x->rc1l + x->rc1Coeff * x->rc0l;
    x->rc1l = enforce_safety(x->rc1l);
    x->rc1h = x->rc0l - x->rc1l;
    
    // listen to ...
    return(x->ap0Out);
}



…. or possibly even an analog schematic?!?!?!     



On Feb 7, 2012, at 10:58 AM, dan snazelle wrote:

> I have been spending a lot of time lately with C, mainly for the AVR, and I am learning a lot of the commands, and am getting pretty good at modifying other peoples code.
> But I am looking for some books which might go beyond just learning one particular language, books which might give some insight into how to attack specific types of problems, etc.
> 
> Philosophy of programming? or theory books.
> 
> I looked on Amazon but there were so many books I didnt know where to start.
> 
> 
> any advice appreciated.
> 
> 
> 
> 
> _______________________________________________
> Synth-diy mailing list
> Synth-diy at dropmix.xs4all.nl
> http://dropmix.xs4all.nl/mailman/listinfo/synth-diy

Noah Vawter

http://www.antlr.org/download.html  <-    use to translate a language into others 
http://forums.openmusiclabs.com/viewtopic.php?f=21&t=272     <- Guitar stompbox chaos hacking
http://forums.openmusiclabs.com/viewtopic.php?f=11&t=256   <-  Commodore 1541 floppy audio
http://web.media.mit.edu/~nvawter  <-   Media Lab documentation
http://exertion.pbworks.com   <-    Ph.D. research
http://Synthshopping.com   <-    My commercial site
http://diydsp.com   <-   commercial educational 
http://kaptheshampoo.com   <-   webcomic
http://youtube.com/diydsp        <-  My youtube channel




















More information about the Synth-diy mailing list