[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference napalm::commusic_v1

Title:* * Computer Music, MIDI, and Related Topics * *
Notice:Conference has been write-locked. Use new version.
Moderator:DYPSS1::SCHAFER
Created:Thu Feb 20 1986
Last Modified:Mon Aug 29 1994
Last Successful Update:Fri Jun 06 1997
Number of topics:2852
Total number of notes:33157

1059.0. "VAX BASIC Tone Row Generator Program" by ANGORA::JANZEN (Tom LMO2/O23 DTN296-5421) Mon Dec 14 1987 09:02

1 ! Thomas E. Janzen 12-14-87 Serial pitch-class set generator
2 ! VAX BASIC.  Generates 12 numbers 1<=n<=12 one each in random order
3 ! can be interpreted as intervals or pitches in a doedacuple scale
4 ! These sets do not, as a rule, have special features.
100 RANDOMIZE
110 balls = 12
120 ballsdrawn = 12
130 DIM urn(12),result(12)
150 for game = 1 to 20
170 	for index = 1 to balls step 1
180 		urn(index) = index
190 	next index
225	currballs = balls
230 	for index = 1 to ballsdrawn
240		ball = fix (rnd*currballs)
380 		result(index)=urn(ball+1)
400		urn(ball+1) = urn(currballs)
402		currballs = currballs - 1
410 	next index
420 	print
460     for prtnum = 1 to ballsdrawn
470		print result(prtnum);
480	next prtnum
490 next game
500 goto 680
630 swap:
640	tempnum=result(sortpass) 
650     result(sortpass)=result(sorts)
660     result(sorts)=tempnum
670 return
680 end
T.RTitleUserPersonal
Name
DateLines
1059.1Leave your name and number after the tone-rowDRFIX::PICKETTTue Dec 15 1987 09:167
    Which just goes to show you how easy it is to write dodecaphonic
    music. Sch�enberg and Webern had a novel idea in 12 tone music (I
    cannot remember who's idea it was exactly, but those names come
    to mind first) but that was the extent of its significance.
    
    Nifty program, I just loathe 12-tone music and minimalism.
    dp
1059.2PLDVAX::JANZENTom LMO2/O23 DTN296-5421Tue Dec 15 1987 14:519
    It is easy to make a tone-row.  It is very hard to write good 12-tone
    music becuase it is fundamentally contrapuntal, and contrapuntal
    music calls for the greatest gifts in music.  Re: Johann Sebastian
    Bach, Palestrina, Lasso, Hindemith, Webern, & others.
    Pan-tonal music that would sound serial to you was written for 18
    years before Schoenberg formalized it with tonal serialism in 1923,
    by Berg, Webern, and Schoenberg.  Scriabin came very close to the
    same tonal usage as well.  
    Tom
1059.3Like black glass skyscrapersPLDVAX::JANZENTom LMO2/O23 DTN296-5421Tue Dec 15 1987 14:569
    Following Berg, Schoenberg, and Webern were the serialists,
    Luigi Dallipiccola, (I think) Ernst Toch and Ernst Krenek, Milton Babbitt,
    50's Pierre Boulez, 50's Karlheinz Stockhausen, George Perle.
    Elliot Carter has been pantonal, but not a serialist.
    Hundreds of composers around the world have contributed to a vast
    literature of serial music in different idioms and at different
    stages.  This is not a fly-by-night affair.  It is a world music.
    An international style from 1955 to 1970.
    Tom
1059.4Unquestionable influence, Questionable tasteDRFIX::PICKETTTue Dec 15 1987 18:1316
    I realize the impact tone-row techniques have had on 20th century
    music, I just cannot abide the music created this way. Add to your
    list Edgar Varese, and John Cage. Both of them experimented with
    serial techniques, but threw in the added confusion of aleatory.
    
    A technique for computer generatoed aleatory (randomness):
    
    Amplify the noise of a random resistor, and digitize the signal.
    The digitized value will be a non-repeating random sequence. This
    technique was offered by a creatinve person in the USENET cryptography
    conference as a source of random number seeds. He was quoting another
    source at the time. 
    
    Gimmie tonal contrapuntal music any day,
    dp
    
1059.5How About Some BASIC Code?DRUMS::FEHSKENSWed Dec 16 1987 16:297
    Amplified thermal noise is an ancient technique for generating random
    numbers.  However, it does not satisfy the uniqueness requirement
    for tone rows.  I assume Tom's algorithm does (I just wasn't up
    to reading the code).
    
    len.
    
1059.6Seeds not sequencesNAC::PICKETTPlate o&#039; shrimp $1.98Thu Dec 17 1987 11:064
    Just generating seeds, Len. I was, however, unaware of the amount
    of time the resistor technique has been around. 
    
    dp
1059.7And pseudorandom tooFROST::HARRIMANHow do I work this?Thu Dec 17 1987 11:3014
    
    Tangentially:
    
       The amplified noise noise generator got
    ever-so-slightly-more-sophisticated back in about 1966 when someone
    got the bright idea that reverse-biased semiconductors made more
    and better noise than resistors.
    
       Of course, this became moot in about 1975 when National
    Semiconductor came out with a pseudo-random noise generator on a
    chip. My Korg used this chip (as well as my Aries). I wish I remembered
    the number.
    
    /pjh
1059.8GO DIGITAL, ALL THE WAY! RAH RAH RAH!MORRIS::JANZENTom LMO2/O23 DTN296-5421Thu Dec 17 1987 12:433
    shift registers with feeback through a divider that puts the
    voltage inside the threshholds is good for direct digital noise.
    Tom
1059.9Once you have a row, you'll want a matrix...KIM::HARMONThu Dec 24 1987 14:45211
Here's a C program that accepts a tone-row as input and outputs (to the
terminal and to a file called matrix.dat) the matrix for the row.  It also 
flags transpositions of the original row that are combinitorial (i.e., none of 
the first 6 pitches in p-n are the same as any of the first 6 pitches in p-0)
by putting an asterisk next to them.

Before you try to compile and link the program, make sure you set up
these logicals:

$ define lnk$library   sys$library:vaxccurse.olb
$ define lnk$library_1 sys$library:vaxcrtlg.olb
$ define lnk$library_2 sys$library:vaxcrtl.olb

/* Program name: MATRIX.C                                                     */
/* Author      : Paul Harmon                                                  */
/* Purpose     : This program accepts a tone-row from the terminal            */
/*               and generates the matrix for the row.  It also               */
/*               scans the matrix for combinitoriality and flags              */
/*               transpositions of p-0 which are combinitorial with           */
/*               p-0.                                                         */
#include curses

WINDOW *m_win;
FILE   *fptr;

char io_array[12][12][3];
int  num_array[12][12];
int  w_row, w_col, i, j, dup[12];

main()
{
char next_row;

fptr = fopen("matrix.dat","w");

initscr();
mvaddstr(2,4,"Enter your tone-row: ");
mvaddstr(4,4,"Use sharps, flats");
mvaddstr(5,4,"or naturals and");
mvaddstr(6,4,"press RETURN");
mvaddstr(7,4,"after each pitch.");
mvaddstr(9,4,"(\"#\" = sharp)");
mvaddstr(10,4,"(\"b\" = flat )");

refresh();

m_win = newwin(12,39,2,30);
do
    {
    get_row();
    create_inversions();
    create_transpositions();
    scan_combin();
    display_matrix();
    mvaddstr(22,21,"Process another row? [Y] ");
    next_row = getch();
    mvaddstr(22,21,"                          ");
    refresh();
    if (next_row != 'N' && next_row != 'n')
        {
        werase(m_win);
        fprintf(fptr,"\n");
        fprintf(fptr,"\n");
        }
    }
while (next_row != 'N' && next_row != 'n');
fclose(fptr);
}

get_row()
{
w_row = 0;
w_col = 0;

for (i=0;i<12;i++)
    {

/* accept original row pitch */

    mvwgetstr(m_win,w_row,w_col,io_array[0][i]);
    io_array[0][i][2] = '\0';
    if (io_array[0][i][1] != '#' && io_array[0][i][1] != 'b')
        io_array[0][i][1] = ' ';
    fprintf(fptr,"%s ",io_array[0][i]);

/* Convert pitch strings to numbers */

    if (io_array[0][i][0] == 'c' || io_array[0][i][0] == 'C')
        num_array[0][i] = 1; else
    if (io_array[0][i][0] == 'd' || io_array[0][i][0] == 'D')
        num_array[0][i] = 3; else
    if (io_array[0][i][0] == 'e' || io_array[0][i][0] == 'E')
        num_array[0][i] = 5; else
    if (io_array[0][i][0] == 'f' || io_array[0][i][0] == 'F')
        num_array[0][i] = 6; else
    if (io_array[0][i][0] == 'g' || io_array[0][i][0] == 'G')
        num_array[0][i] = 8; else
    if (io_array[0][i][0] == 'a' || io_array[0][i][0] == 'A')
        num_array[0][i] = 10; else
    if (io_array[0][i][0] == 'b' || io_array[0][i][0] == 'B')
        num_array[0][i] = 12;
    if (io_array[0][i][1] == '#')
        num_array[0][i] += 1;
    else
        if (io_array[0][i][1] == 'b')
            num_array[0][i] -= 1;
    w_col += 3;
    }
wrefresh(m_win);
fprintf(fptr,"\n");
} /* End of get row procedure */

create_inversions()
{
int subno;

for (i=1;i<12;i++)
    {
    subno = num_array[0][i] - num_array[0][0];
    if (subno <= 0) subno += 12;
    num_array[i][0] = num_array[0][0] - subno;
    if (num_array[i][0] <= 0) num_array[i][0] += 12;
    }
} /* End of create inversion procedure */

create_transpositions()
{

int calc_num;

for (i=1;i<12;i++)
    {
    calc_num = num_array[i][0] - num_array[i-1][0];
    if (calc_num < 1) calc_num += 12;
    for (j=1;j<12;j++)
        {
        num_array[i][j] = num_array[i-1][j] + calc_num;
        if (num_array[i][j] > 12) num_array[i][j] -= 12;
        }
    }
} /* End of create transpositions procedure */

scan_combin()
{
int k;

for (i=0;i<6;i++) dup[i] = 1;
for (i=6;i<12;i++) dup[i] = 0;
for (k=0;k<6;k++)
    {
    for (i=6;i<12;i++)
        {
        for (j=0;j<6;j++)
            {
            if (! dup[i])
                dup[i] = (num_array[0][k] == num_array[i][j]);
            }
        }
    }
} /* End of scan for combinitoriality procedure */

display_matrix()
{
w_row = 1;
for (i=1;i<12;i++)
    {
    w_col = 0;
    for (j=0;j<12;j++)
        {
        switch(num_array[i][j])
            {
            case  1 : strcpy(io_array[i][j],"c \0");
                      break;
            case  2 : strcpy(io_array[i][j],"c#\0");
                      break;
            case  3 : strcpy(io_array[i][j],"d \0");
                      break;
            case  4 : strcpy(io_array[i][j],"d#\0");
                      break;
            case  5 : strcpy(io_array[i][j],"e \0");
                      break;
            case  6 : strcpy(io_array[i][j],"f \0");
                      break;
            case  7 : strcpy(io_array[i][j],"f#\0");
                      break;
            case  8 : strcpy(io_array[i][j],"g \0");
                      break;
            case  9 : strcpy(io_array[i][j],"g#\0");
                      break;
            case 10 : strcpy(io_array[i][j],"a \0");
                      break;
            case 11 : strcpy(io_array[i][j],"a#\0");
                      break;
            case 12 : strcpy(io_array[i][j],"b \0");
                      break;
            } /* End case */
        mvwaddstr(m_win,w_row,w_col,io_array[i][j]);
        fprintf(fptr,"%s ",io_array[i][j]);
        w_col += 3;
        } /* endfor */
    if (! dup[i])
        {
        w_col += 2;
        mvwaddch(m_win,w_row,w_col,'*');
        fprintf(fptr,"  *");
        }
    w_row += 1;
    fprintf(fptr,"\n");
    } /* endfor */
wrefresh(m_win);
} /* End of display matrix procedure */
1059.10note names nistead of numbersPLDVAX::JANZENTom LMO2/O23 DTN296-5421Thu Dec 24 1987 15:1743
1 ! this program is like the one in .0, that generates a screen of random
2 ! serial pitch-class sets, but it prints out notes names rather than numbers.
3 ! tom janzen digital equipment corp 12-24-87
10 declare string note_names(12)
20 note_names(1)="C  "
25 note_names(2)="C# "
30 note_names(3)="D  "
35 note_names(4)="D# "
40 note_names(5)="E  "
45 note_names(6)="F  "
50 note_names(7)="F# "
55 note_names(8)="G  "
60 note_names(9)="G# "
65 note_names(10)="A  "
70 note_names(11)="A# "
75 note_names(12)="B  "
100 RANDOMIZE
110 balls = 12
120 ballsdrawn = 12
130 DIM urn(12),result(12)
150 for game = 1 to 20
170 	for index = 1 to balls step 1
180 		urn(index) = index
190 	next index
225	currballs = balls
230 	for index = 1 to ballsdrawn
240		ball = fix (rnd*currballs)
380 		result(index)=urn(ball+1)
400		urn(ball+1) = urn(currballs)
402		currballs = currballs - 1
410 	next index
420 	print
460     for prtnum = 1 to ballsdrawn
470		print NOTE_NAMES(result(prtnum));
480	next prtnum
490 next game
500 goto 680
630 swap:
640	tempnum=result(sortpass) 
650     result(sortpass)=result(sorts)
660     result(sorts)=tempnum
670 return
680 end