Cloth $87.00 ISBN: 9780226075075 Published June 1990

Pascal Programming for Music Research

Alexander R. Brinkman

Pascal Programming for Music Research

Alexander R. Brinkman

986 pages | 7 x 10 | © 1989
Cloth $87.00 ISBN: 9780226075075 Published June 1990
Pascal Programming for Music Research addresses those who wish to develop the programming skills necessary for doing computer-assisted music research, particularly in the fields of music theory and musicology. Many of the programming techniques are also applicable to computer assisted instruction (CAI), composition, and music synthesis. The programs and techniques can be implemented on personal computers or larger computer systems using standard Pascal compilers and will be valuable to anyone in the humanities creating data bases.

Among its useful features are:
-complete programs, from simple illustrations to substantial applications;
-beginning programming through such advanced topics as linked data structures, recursive algorithms, DARMS translation, score processing;
-bibliographic references at the end of each chapter to pertinent sources in music theory, computer science, and computer applications in music;
-exercises which explore and extend topics discussed in the text;
-appendices which include a DARMS translator and a library of procedures for building and manipulating a linked representation of scores;
-most algorithms and techniques that are given in Pascal programming translate easily to other computer languages.

Beginning, as well as advanced, programmers and anyone interested in programming music applications will find this book to be an invaluable resource.
Contents
Preface
Acknowledgments

Part I - Getting Started

1. Introduction
1.1. Binary Numbers
1.2. A Simple Computer
Hardware
The Instruction Set
Assembly Language
Simple Decisions
1.3. High Level Languages
1.4. Other Software
1.5. Conclusion
References and Selected Readings Exercises
2. A Tutorial Introduction To Pascal
2.1. Historical Perspective
2.2. Program Structure
2.3. Constants, Variables, and Arithmetic Operators
2.4. Control Statements
The Compound Statement
Program Loops
Decision Statements
2.5. User-Written Functions and Procedures
2.6. Arrays and Other Structured Types
References and Selected Readings
Exercises
3. Pascal Basics and Simple Types
3.1. The Basic Elements of Pascal
Special Symbols
Reserved Words
Comments
Identifiers
Standard Identifiers
Numeric Literals
Boolean Literals
Strings
Delimiters
3.2. The Parts of a Program
3.3. The Assignment Statement and Expressions
3.4. Standard Functions
3.5. Ordinal Types
3.5.1. The Type Integer
Arithmetic Operators
Integer Functions
Integer Expressions
3.5.2. The Type Boolean
Relational Operators
Boolean Operators
Boolean Functions
Boolean Assignment
The in Operator
3.5.3. The Type Char
Character Functions
Comparing Character Data
3.5.4. Enumerated Types
Functions with Enumerated Types
Relational Operators and Enumerated Types
3.5.5. Subrange Types
3.5.6. Named and Anonymous Types
3.6. The Type Real
Arithmetic Operators
Real Functions
Real Expressions
Precision in Real Numbers
References and Selected Readings
Exercises
4. Input and Output
4.1. Program Output: write and writeIn
4.2. Program Input: read and readIn
4.3. The page Function
References and Selected Readings
Exercises
5. Control Statements
5.1. The Compound Statement: begin...end
5.2. The if Statement
5.2.1. Conditional Execution: if...then
5.2.2. Compound if Statement: if...then...else
5.2.3. Chained if Statements:
Type One: if...then...else if
Type Two: if...then if
5.3. The case Statement: case...end
5.4. Program Loops
5.4.1. Testing at the Top of the Loop: while...do
5.4.2. Testing at the End of the Loop: while...do
5.4.3. Ordinal Iteration: for...do
5.4.4. Which Loop to Use
5.4.5. Debugging Loops
5.5. The goto Statement
References and Selected Readings
Exercises
6. Encoding Music
6.1. Numeric Pitch Representation
6.1.1. Pitch Class (pc)
6.1.2. Continuous Pitch Code (cpc)
6.1.3. Name Class (nc)
6.1.4. Continuous Name Code (cnc)
6.2. Binomial Representation (br)
6.2.1. Music Operations
6.2.2. Properties of the Binomial System
6.2.3. A Single Number Binomial Representation (br)
6.2.4. Continuous Binomial Representation (cbr)
6.3. Reciprocal Duration Code (rdc)
6.4. Delimiters
6.5. DARMS Code
6.5.1. Encoding Pitch
6.5.2. Rhythm, Meter, and Bar lines
6.5.3. Other Note Attributes
6.5.4. Parts, Chords, Layers, and Multiple Staves
6.5.5. Comments
6.5.6. Extensions
6.6. Leland Smith's SCORE Code
References and Selected Readings
Exercises
7. Program Design
7.1. Algorithm Defined
7.2. Algorithm Development
Problem Analysis
Design Refinement
Encoding Verification
Documentation
7.3. Examples of Algorithm Development
7.3.1. Program Group One
7.3.2. Program Group Two
7.4. Application: Calculating Fibonacci Numbers
References and Selected Readings
Exercises
8. Eof, Eoln, and Input
8.1. The Structure of a Textfile
8.2. How Pascal Deals with File
8.3. End-of-Fiel and End-of-Line
8.3.1. Testing for End-of-File (eol)
8.3.2. Testing for End-of-Line (eoln)
8.3.3. Eof and Prompting
8.4. Some Final Observations on eof and eoln
8.5. Using input
8.6. The Output Buffer References and Selected Readings Exercises
9. Functions and Procedures
9.1. Functions
9.2. Functions and Top-Down Design
9.3. Functions with Side Effects
9.4. The Scope of Identifiers: Global versus Local Variables
9.5. Procedures
9.6. Value and Variable Parameters
9.7. Procedures and Top-Down Design
9.7.1. Application: Directed Intervals in Melody
9.7.2. Application: Integer Conversion
9.7.3. Application: Converting Note Names to Pitch Classes
9.8. Subprogram Directives
9.8.1. The forward Directive
9.8.2. Other Directives
9.9. Subprograms as Parameters
References and Selected Readings
Exercises

Part II - Structured Types

10. The Array and List Processing
10.1. Properties of Arrays
10.2. Using Arrays
10.3. List Defined
10.4. Reading and Writing Lists
10.5. Simple Operations with Lists
10.6. Using Arrays to Count or Check List Elements
10.7. Specialized Lists
10.7.1. Stacks
10.7.2. Queues
10.8. Searching Lists
10.8.1. Linear Search
10.8.2. Binary Search
10.9. Sorting Lists in Arrays
10.9.1. A Simple Exchange Sort
10.9.2. Shell Sort
10.9.3. Merge Sort
References and Selected Readings
Exercises
11. Other Uses for the Array
11.1. Packed Arrays and Character Strings
11.1.1. Functions and Procedures for Strings Handling
11.1.2. Lexicographic Setting
11.1.3. Indirect Sorting
11.2. Internal Buffers
11.3. Pattern Matching
11.4. Arrays and Lookup Tables
11.5. Application: Interpreting DARMS Pitch Codes
11.6. Matrices
11.6.1. Reading and Printing Matrices
11.6.2. Processing Matrices
11.6.3. Application: Twelve-Tone Dimensions
11.7. Arrays in More than Two Dimensions
References and Selected Readings
Exercises
12. Set Types
12.1. Set Constructors
12.2. Operations on Sets
12.3. Application: Processing Pitch-Class Sets
References and Selected Readings
Exercises
13. Record Types
13.1. Fixed Records
13.1.1. Anonymous Records
13.1.2. The with Statement
13.2. Procedures for Rational Arithmetic
13.3. Rational Duration Representation (rdr)
13.4. Grouplets in rdr
13.5. Application: Interpreting DARMS Duration Codes
13.6. Variant Records
References and Selected Readings
Exercises
14. File Types
14.1. External Files
14.1.1. Using eoln and eof with External Files
14.1.2. Files as Arguments to Subroutines
14.2. Internal Files
14.3. Binary Files
References and Selected Readings
Exercises
15. Recursive Algorithms
15.1. Using Recursion
15.2. Tracing Recursive Algorithms
15.3  Examples of Direct Recursion
15.3.1. Function affirmative
15.3.2. Procedure getint
15.3.3. Reciprocal Duration Code Revisited
15.4. Indirect Recursion: Processing Grouplets in rdc
15.5. Permutations and Combinations
15.5.1. A Procedure for Calculating Permutations
15.5.2. Algorithms for Computing Combinations
15.6. Threading a Maze
15.7. Quicksort
References and Selected Readings
Exercises
16. Linked Data Structures
16.1. Overview
16.2. Basic Operations
16.3. Linked Stacks
16.4. Storage Management
16.5. Linked Lists
16.5.1. Simple Lists
Iterative Traversals
Concatenating Lists
Recursive Traversals
16.5.2. Lists with Pointers to Beginning and End
16.5.3. Linked Queues
16.5.4. Circular Lists
16.5.5. Bidirectional Lists
16.5.6. Doubly Linked Circular Lists
16.5.7. Doubly Linked Rings with Head Nodes
16.6 Trees
16.6.1  Binary Trees
16.6.2  Traversing Binary Trees
16.6.3  Application: treesort
16.6.4  Application: treesearch
16.6.5  Application: Contour Counting
16.7 Multilinked and Hybrid Structures
16.7.1  Hash Tables
16.7.2  Application: A Thematic Index
References and Selected Readings
Excercises

Part III Applications

17 Prime-Form Algorithms
17.1 Binary Representation of Pitch-Class Sets
17.2 Starr's Prime-Form Algorithm
17.3 Program SetId: Specifications
Function
Input
Output
17.4 Implementation
17.5 The Program
17.6 Other Approaches
17.6.1  Forte's Prime-Form Algorithm
17.6.2  Alphonce's Prime Form-Algorithm
17.6.3  Rahn's Normal Form
References and Selected Readings
Excercises
18 A Matrix Searching program
18.1 Terminal Control Functions
18.2 Bit Maps
18.3 A Matrix-Searching Program
Function
Input
Output
18.4 Implementation
18.5 The Program
References and Selected Readings
Excercises
19 Spelling Pitch Structures
19.1 Generating Random Numbers
19.2 Manipulating cbrs
19.3 Representing Pitch Sctructures
19.4 Program Muspell: Specifications
Function
Input
Output
19.5 Implementation
19.6 The Program
References and Selected Readings
Excercises
20 Score Processing
20.1 The DARMS Interpreter
20.2 The Score Structure
20.2.1  Building the Structure
20.2.2  Special Cases
20.3 Using the Data Structure
20.3.1  Traversing the Data Structure
20.3.2  Matching Melodic Contours
20.3.3  Vertical Segmentation of Scores
20.3.4  Some Other Segmentation Techniques
20.3.5  Locating Arbitrary Sets in the Score
20.3.6  Simple Harmonic Analysis
20.3.7  A Graphic Representation of Scores
References and Selected Readings
Excercises

APPENDIX A: The ASCII Character Set
APPENDIX B: Type Compatibility and Operator Precedence
APPENDIX C: A DARMS Interpreter
APPENDIX D: A Program Library
APPENDIX E: Score Programs From Chapter 20

Glossary
Index to Programs, Subprograms, and Algorithms
General Index
For more information, or to order this book, please visit http://www.press.uchicago.edu
Google preview here

Chicago Manual of Style |

Chicago Blog: Music

Events in Music

Keep Informed

JOURNALs