From lotus.uwaterloo.ca!math.uwaterloo.ca!mozart.nist.gov!CLOUGH Mon Jun 13 09:10:25 1994 Received: from lotus.uwaterloo.ca ([129.97.140.9]) by watdragon.uwaterloo.ca with SMTP id <88170-2>; Mon, 13 Jun 1994 09:10:22 -0400 Received: from math.uwaterloo.ca ([129.97.140.144]) by lotus.uwaterloo.ca with SMTP id <442>; Mon, 13 Jun 1994 09:09:11 -0400 Received: from ENH.NIST.GOV ([129.6.16.1]) by math.uwaterloo.ca with SMTP id <78381-2>; Mon, 13 Jun 1994 09:09:25 -0400 Received: from sugoi.nist.gov by ENH.NIST.GOV (PMDF V4.2-13 #4653) id <01HDHKZIFIA8005HSZ@ENH.NIST.GOV>; Mon, 13 Jun 1994 09:06:46 EDT Received: from mozart.nist.gov by sugoi.nist.gov (4.1/SMI-4.1) id AA04314; Mon, 13 Jun 94 09:06:55 EST Date: Mon, 13 Jun 1994 10:06:55 -0400 From: CLOUGH@ENH.NIST.GOV (Roger Clough) Subject: samplevision file-reading software to post To: sgroup-owner@lotus.uwaterloo.ca Errors-to: john@sugoi.nist.gov Reply-to: CLOUGH@ENH.NIST.GOV Message-id: <9406131406.AA04314@sugoi.nist.gov> Content-transfer-encoding: 7BIT Status: RO Would you be interested in posting this software I developed? I sent it to you a month or so ago and got no response. Yours, Roger Clough .\.\.\.\.\.\.\.\.] Well, I finally got my program working to write theoretical waveforms on the PC hard disk for Samplevision to read. This works with an S220 (16 bits, 32000+ samples per bank). I think it should also work with the others, too, since all of the pertinent information will be in the header.smp file which you start out with. There are two programs to use. The first you need use only once to make the reuseable header file. 1) First you start by using Samplevision to read your sampler with any file on it. 2) Then use the following program "make_hdr.c" to create a standard header file. The syntax is just "make_hdr". It will ask you what your input file is called (e.g. cello.smp) and it will write out a file called "header.smp" which is then used by the next program, "smp_writ.c". 3) Smp_writ.c is then used with the syntax "smp_writ outfile.smp" producing the output file outfile.smp. This is then read by Samplevision and sent to the sampler. I think you may have to set the loop in samplevision first, say by selecting a portion of it and forcing it to fit as the menu says. The version of smp_writ.c given here is just an example of the kind of waveform you can create mathematically. The sound it makes is like a cheap organ, but it sounded like heaven to me. --Roger Clough /* make_hdr.c--makes a header.smp file to use with smp_writ.c, Which writes theoretical waveforms for Samplevision to read. You need to start with a file on hard disk already gotten from a Roland S220. Then use this to make a header.smp file which is needed for using smp_writ.c Written in Borland C Copyright 1994 by Roger B. Clough --You may use this freely as long as it's not for profit. */ #include #include #include void main(void); void main(void) { char x[200],buf[32]; FILE *inf,*hdr; clrscr(); printf("\nWhat file to use to make a header file,(e.g. cello.smp)?\n%c",62); gets(buf); if((inf=fopen(buf,"rb"))==NULL){ printf("can't open %s",buf); exit(0);} /* write header */ if((hdr=fopen("header.smp","wb"))==NULL){ printf("can't open header file celojnk.smp"); exit(0);} fread(x,sizeof(char),116,inf); fwrite(x,sizeof(char),116,hdr); fcloseall(); } /* smp_writ.c--writes *.smp files for samplevision -> roland sampler Written in Borland C. Copyright 1994 by Roger. B. Clough --you may use freely as long as it's not for profit */ #include #include #include #include void main(int argc, char *argv[]); void main(int argc, char *argv[]) { float n,w,s1,s2,s3,s4,Pi=3.14159; int vi,j,k; char x[200]; FILE *outf,*hdr; clrscr(); if(argc<2){printf("\nsyntax is smp_writ outfile.smp"); exit(0);} if((outf=fopen(argv[1],"wb"))==NULL){ printf("can't open %s",argv[2]); exit(0);} /* write header */ if((hdr=fopen("header.smp","rb"))==NULL){ printf("can't open header file celojnk.smp"); exit(0);} fread(x,sizeof(char),116,hdr); fwrite(x,sizeof(char),116,outf); fclose(hdr); clrscr(); /* write waveform file */ n=-1; for(k=0; k<128;k++){ for(j=0; j<128;j++){ n+=1; w=Pi*n; s1=0.6*sin(.04*w); s2=0.3*sin(.08*w); s3=0.15*sin(.16*w); s4=0.075*sin(.32*w); vi=(int) 8000.*(s1+s2+s3+s4); if(vi<-32000 || vi> 32000) continue; fwrite(&vi,sizeof(int),1,outf); } } fcloseall(); }