Professional Documents
Culture Documents
(Download PDF) Haskell School of Music Hudak P Online Ebook All Chapter PDF
(Download PDF) Haskell School of Music Hudak P Online Ebook All Chapter PDF
https://textbookfull.com/product/historical-dictionary-of-sacred-
music-joseph-p-swain/
https://textbookfull.com/product/thinking-functionally-with-
haskell-richard-bird/
https://textbookfull.com/product/haskell-the-ultimate-beginner-s-
guide-to-learn-haskell-programming-step-by-step-1st-edition-
claudia-alves/
https://textbookfull.com/product/growing-musicians-teaching-
music-in-middle-school-and-beyond-1st-edition-sweet/
Programming in Haskell 2nd Edition Graham Hutton
https://textbookfull.com/product/programming-in-haskell-2nd-
edition-graham-hutton/
https://textbookfull.com/product/algorithm-design-with-haskell-
richard-s-bird/
https://textbookfull.com/product/music-theory-analysis-and-
society-selected-essays-1st-edition-robert-p-morgan/
https://textbookfull.com/product/handbook-for-dragon-slayers-1st-
edition-haskell-merrie/
https://textbookfull.com/product/hope-and-wish-image-in-music-
technology-1st-edition-david-p-rando-auth/
The Haskell School of Music
— From Signals to Symphonies —
Paul Hudak
Yale University
Department of Computer Science
Preface xv
2 Simple Music 28
2.1 Preliminaries . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
2.2 Notes, Music, and Polymorphism . . . . . . . . . . . . . . . . 30
2.3 Convenient Auxiliary Functions . . . . . . . . . . . . . . . . . 34
2.3.1 A Simple Example . . . . . . . . . . . . . . . . . . . . 36
2.4 Absolute Pitches . . . . . . . . . . . . . . . . . . . . . . . . . 41
ii
CONTENTS iii
4 A Musical Interlude 66
4.1 Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
4.2 Transcribing an Existing Score . . . . . . . . . . . . . . . . . 68
4.2.1 Auxiliary Functions . . . . . . . . . . . . . . . . . . . 68
4.2.2 Bass Line . . . . . . . . . . . . . . . . . . . . . . . . . 71
4.2.3 Main Voice . . . . . . . . . . . . . . . . . . . . . . . . 71
4.2.4 Putting It All Together . . . . . . . . . . . . . . . . . 72
4.3 Simple Algorithmic Composition . . . . . . . . . . . . . . . . 73
5 Syntactic Magic 76
5.1 Sections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
5.2 Anonymous Functions . . . . . . . . . . . . . . . . . . . . . . 78
5.3 List Comprehensions . . . . . . . . . . . . . . . . . . . . . . . 79
5.3.1 Arithmetic Sequences . . . . . . . . . . . . . . . . . . 81
5.4 Function Composition . . . . . . . . . . . . . . . . . . . . . . 82
CONTENTS iv
6 More Music 86
6.1 Delay and Repeat . . . . . . . . . . . . . . . . . . . . . . . . . 86
6.2 Inversion and Retrograde . . . . . . . . . . . . . . . . . . . . 87
6.3 Polyrhythms . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
6.4 Symbolic Meter Changes . . . . . . . . . . . . . . . . . . . . . 90
6.5 Computing Duration . . . . . . . . . . . . . . . . . . . . . . . 91
6.6 Super-retrograde . . . . . . . . . . . . . . . . . . . . . . . . . 91
6.7 takeM and dropM . . . . . . . . . . . . . . . . . . . . . . . . 92
6.8 Removing Zeros . . . . . . . . . . . . . . . . . . . . . . . . . . 93
6.9 Truncating Parallel Composition . . . . . . . . . . . . . . . . 95
6.9.1 Lazy Evaluation to the Rescue . . . . . . . . . . . . . 96
6.10 Trills . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
6.11 Grace Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
6.12 Percussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
6.13 A Map for Music . . . . . . . . . . . . . . . . . . . . . . . . . 102
6.14 A Fold for Music . . . . . . . . . . . . . . . . . . . . . . . . . 104
6.15 Crazy Recursion . . . . . . . . . . . . . . . . . . . . . . . . . 105
xi
LIST OF FIGURES xii
xiv
Preface
xv
PREFACE xvi
The new Haskell library that incorporates all of this is called Euterpea.
Haskell was named after the logician Haskell B. Curry who, along with
Alonzo Church, helped establish the theoretical foundations of functional
programming in the 1940’s, when digital computers were mostly just a gleam
in researchers’ eyes. A curious historical fact is that Haskell Curry’s father,
Samuel Silas Curry, helped found and direct a school in Boston called the
School of Expression. (This school eventually evolved into what is now Curry
College.) Since pure functional programming is centered around the notion
of an expression, I thought that The Haskell School of Expression would be
a good title for my first book. And it was thus quite natural to choose The
Haskell School of Music for my second!
What is especially beautiful about this quote is that music is also a form
of expression, although Curry was more likely talking about writing and
speaking. In addition, as has been noted by many, music has many ties
to mathematics. So for me, combining the elegant mathematical nature of
Haskell with that of music is as natural as singing a nursery tune.
Using a high-level language to express musical ideas is, of course, not
new. But Haskell is unique in its insistence on purity (no side effects), and
this alone makes it particularly suitable for expressing musical ideas. By
focusing on what a musical entity is rather than on how to create it, we allow
musical ideas to take their natural form as Haskell expressions. Haskell’s
many abstraction mechanisms allow us to write computer music programs
CHAPTER 1. COMPUTER MUSIC, EUTERPEA, AND HASKELL 9
[The End]
INDEX
Aborigines of Australia, the severity with which they punish sexual
offences, 71 sqq.
Abraham and Sarah, 60 sq.
Abyssinia, 66, 81
Action and opinion, their relative values for society, 155
Adulterer and injured husband, physical relationship supposed to
exist between, 104 sq.
—— called a murderer, 65, 104
Adultery, expiation for, 44 sq.; disastrous effects supposed to flow
from, 44 sqq., 60 sq.; punishment of, 46, 50 sq., 63 sqq.;
supposed to be dangerous to the culprits, their spouses, and
their offspring, 102 sqq. See also Infidelity.
Africa, superstitious veneration for kings in, 12 sqq.; superstition as a
support of property in, 38 sqq.; disastrous effects supposed to
flow from sexual immorality in, 54 sqq.; British Central, 66, 79,
105; British East, 77, 81, 92, 105, 115, 123; German East, 92,
105, 106; North, 119
Akamba, the, of British East Africa, 77 sq., 105
Akikuyu, the, of British East Africa, 92, 105, 115, 128
Aleutian hunters, 106
Algonquin Indians, their modes of keeping off ghosts, 139
Amboyna, taboo in, 27 sq.
America, Indians of North, 130 sq.; the discovery of, 173
Amulets for the protection of fruit-trees, 29 sqq.
Analogy between the reproduction of men, animals, and plants, 99
sqq.
Ancestor-worship, 7
Anger of gods or spirits at sexual offences, 44, 46, 47, 50, 51, 54, 55
sq., 57, 61, 63, 107
Angola, 108; Cazembes of, 11
Angoni, the, of British Central Africa, 79, 132
Annam, savages of, 46
Annamites, the, 33
Anne, Queen, 18
Anointing the nail instead of the wound, 166
Antambahoaka, the, of Madagascar, 59
Anthropology, social, the scope of, 157 sqq.
Anyanja, the, of British Central Africa, 66, 79, 105
Arab merchant in Darfur, 39
Araucanians of Chili, 84
Arawaks of British Guiana, 83
Areopagus, trials for murder before the, 156
Argos, massacre at, 115
Aricara Indians, 118
Armenians, their mutilation of the dead, 133
Assam, tribes of, 45
Attic law as to homicides, 114
Atua, guardian spirit, 118
Atua tonga, divinity, 8
Aunt, incest with, 50, 51
Australia, aborigines of, the severity with which they punish sexual
offences, 71 sqq.
——, Western, 74
Australian aborigines, their precautions against ghosts, 137
Avebury, Lord, 159
Avoidance, ceremonial, of relations by marriage, 75 sqq.; a
precaution against incest, 75, 84 sqq., 93; of wife’s mother, 75
sqq., 86 sq., 90 sq.; between father-in-law and daughter-in-law,
76; between various relations, 76 sq.; between father and
daughter, 78, 85, 87; between father-in-law and son-in-law, 79
sq.; of wife of wife’s brother, 80; of brothers-in-law and sisters-
in-law, 81; of future parents-in-law, 81, 83; between woman and
her father-in-law, 82; between a man and his father-in-law, 82,
83; of blood relations, 84 sqq.; between brother and sister, 85,
86, 87, 88, 90; between mother and son, 85, 86, 87
Awemba, the, of Northern Rhodesia, 66, 79, 103 sq., 120