Csound Csound-dev Csound-tekno Search About

a simple score generator

Date1997-10-22 03:52
FromArne Hanna
Subjecta simple score generator
Below is a simple little Csound score generator posted some time ago by
Dave Madole (I think).

As I'm still a beginner as far as 'C' goes, if it's not too much to ask,
could someone comment this code and send it back to me?

Also, the output regarding start times(p2) is not chronological.  Any tips
on how to change this would, as always, be greatly appreciated.

Cheers
Arne



/*
        Csound score generator;
        use with simple oscil instrument
*/

#include "time.h"
#include "stdio.h"
#include "stdlib.h"

#define MAXRUN 12
#define MINSTART 0.
#define MAXSTART 4./* was 44 */
#define MINDUR 0.
#define MAXDUR 2.
#define MINAMP 1000
#define MAXAMP 10000
#define MINFREQ 220
#define MAXFREQ 660

float fran(); /*function declaration*/

main(argc,argv)
int argc;
char *argv[];
{
        int i,n;
        float nstart,nlength;
        int kamp,kfreq,ifnc;

        FILE *fp;
        fp=fopen(argv[1],"w");

        fprintf(fp,"f1 0 8192 10 1\n");
        fprintf(fp,"f2 0 8192 10 1 .9 .8 .7 .6 .5 .4 .3 .2 .1\n");
        fprintf(fp,"f3 0 8192 10 .1 .2 .3 .4 .5 .6 .7 .8 .9 1\n");
        fprintf(fp,"f4 0 8192 10 .1 .3 .5 .7 .9 1 .8 .6 .4 .2\n");
        fprintf(fp,"\n");
        fprintf(fp,";inst  start length kamp  kfreq  ifnc\n");
        fprintf(fp,";p1    p2    p3     p4    p5     p6\n");
        fprintf(fp,"\n");

        srand(time(0));

        nstart==0;

        for (i=0;i