0% found this document useful (0 votes)
4 views

Introduction to Digital Music with Python Programming: Learning Music with Code 1st Edition Horn pdf download

Introduction to Digital Music with Python Programming is a beginner-friendly resource that teaches music creation through coding. The book covers fundamental concepts like rhythm, chord structure, and melody, using real-world examples to engage readers. It is suitable for individuals with no prior experience in music or programming, making it accessible to a wide audience including students and aspiring professionals.

Uploaded by

glynpasiak
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Introduction to Digital Music with Python Programming: Learning Music with Code 1st Edition Horn pdf download

Introduction to Digital Music with Python Programming is a beginner-friendly resource that teaches music creation through coding. The book covers fundamental concepts like rhythm, chord structure, and melody, using real-world examples to engage readers. It is suitable for individuals with no prior experience in music or programming, making it accessible to a wide audience including students and aspiring professionals.

Uploaded by

glynpasiak
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

Introduction to Digital Music with Python

Programming: Learning Music with Code 1st


Edition Horn pdf download

https://ebookmeta.com/product/introduction-to-digital-music-with-
python-programming-learning-music-with-code-1st-edition-horn/

Download more ebook from https://ebookmeta.com


We believe these products will be a great fit for you. Click
the link to download now, or visit ebookmeta.com
to discover even more!

Introduction to Digital Music with Python Programming:


Learning Music with Code 1st Edition Michael Horn

https://ebookmeta.com/product/introduction-to-digital-music-with-
python-programming-learning-music-with-code-1st-edition-michael-
horn/

An Introduction to Statistical Learning: with


Applications in Python Gareth James

https://ebookmeta.com/product/an-introduction-to-statistical-
learning-with-applications-in-python-gareth-james/

An Introduction to Programming and Computer Science


with Python First Edition Clayton Cafiero

https://ebookmeta.com/product/an-introduction-to-programming-and-
computer-science-with-python-first-edition-clayton-cafiero/

Testing New Opinions and Courting New Impressions New


Perspectives on Walter Pater 1st Edition Anne Florence
Gillard Estrada Editor Martine Lambert Charbonnier
Editor Charlotte Ribeyrol Editor
https://ebookmeta.com/product/testing-new-opinions-and-courting-
new-impressions-new-perspectives-on-walter-pater-1st-edition-
anne-florence-gillard-estrada-editor-martine-lambert-charbonnier-
Seduced by Days 1st Edition Milly Taiden

https://ebookmeta.com/product/seduced-by-days-1st-edition-milly-
taiden/

Writing by Choice 3rd Edition Eric Henderson

https://ebookmeta.com/product/writing-by-choice-3rd-edition-eric-
henderson/

Further Advances in Internet of Things in Biomedical


and Cyber Physical Systems 193 Intelligent Systems
Reference Library 193 Valentina E. Balas (Editor)

https://ebookmeta.com/product/further-advances-in-internet-of-
things-in-biomedical-and-cyber-physical-systems-193-intelligent-
systems-reference-library-193-valentina-e-balas-editor/

McGraw-Hill Education CCRN Review 1st Edition Michael


Reid

https://ebookmeta.com/product/mcgraw-hill-education-ccrn-
review-1st-edition-michael-reid/

DNS Security For Dummies®, Infoblox Special Edition


Joshua M. Kuo & Robert Nagy & Cricket Liu

https://ebookmeta.com/product/dns-security-for-dummies-infoblox-
special-edition-joshua-m-kuo-robert-nagy-cricket-liu/
Natural Resources S. V. Ciriacy-Wantrup (Editor)

https://ebookmeta.com/product/natural-resources-s-v-ciriacy-
wantrup-editor/
Introduction to Digital Music
with Python Programming

Introduction to Digital Music with Python Programming provides a foundation


in music and code for the beginner. It shows how coding empowers new
forms of creative expression while simplifying and automating many of
the tedious aspects of production and composition.
With the help of online, interactive examples, this book covers the fun-
damentals of rhythm, chord structure, and melodic composition along-
side the basics of digital production. Each new concept is anchored in a
real-world musical example that will have you making beats in a matter
of minutes.
Music is also a great way to learn core programming concepts such as
loops, variables, lists, and functions, Introduction to Digital Music with Python
Programming is designed for beginners of all backgrounds, including high
school students, undergraduates, and aspiring professionals, and requires
no previous experience with music or code.

Michael S. Horn is Associate Professor of Computer Science and Learn-


ing Sciences at Northwestern University in Evanston, Illinois, where he
directs the Tangible Interaction Design and Learning (TIDAL) Lab.

Melanie West is a PhD student in Learning Sciences at Northwestern


University and co-founder of Tiz Media Foundation, a nonproft dedi-
cated to empowering underrepresented youth through science, technol-
ogy, engineering, and mathematics (STEM) programs.

Cameron Roberts is a software developer and musician living in Chicago.


He holds degrees from Northwestern University in Music Performance
and Computer Science.
Introduction to Digital
Music with Python
Programming
Learning Music with Code

Michael S. Horn, Melanie West,


and Cameron Roberts
First published 2022
by Routledge
4 Park Square, Milton Park, Abingdon, Oxon OX14 4RN
and by Routledge
605 Third Avenue, New York, NY 10158
Routledge is an imprint of the Taylor & Francis Group, an informa business
© 2022 Michael S. Horn, Melanie West, and Cameron Roberts
The right of Michael S. Horn, Melanie West, and Cameron
Roberts to be identifed as author of this work has been asserted
in accordance with sections 77 and 78 of the Copyright, Designs
and Patents Act 1988.
All rights reserved. No part of this book may be reprinted
or reproduced or utilised in any form or by any electronic,
mechanical, or other means, now known or hereafter invented,
including photocopying and recording, or in any information
storage or retrieval system, without permission in writing from
the publishers.
Trademark notice: Product or corporate names may be trademarks
or registered trademarks, and are used only for identifcation and
explanation without intent to infringe.
British Library Cataloguing-in-Publication Data
A catalogue record for this book is available from the British Library
Library of Congress Cataloging-in-Publication Data
A catalog record has been requested for this book

ISBN: 978-0-367-47083-8 (hbk)


ISBN: 978-0-367-47082-1 (pbk)
ISBN: 978-1-003-03324-0 (ebk)

DOI: 10.4324/9781003033240

Typeset in Bembo
by codeMantra
Melanie dedicates her contribution of the book to the
memory of her friend, Bernie Worrell, who taught her
how to listen.
Mike dedicates his contribution to his wife, Diana Reed,
and his children, Madeleine and Lucas.
Contents

List of fgures ix
Photo and illustration credits xiii
Foreword xiv
Acknowledgments xvi

1 Why music and coding? 1


Interlude 1: Basic pop beat 12
2 Rhythm and tempo 18
Interlude 2: Custom trap beat 49
3 Pitch, harmony, and dissonance 53
Interlude 3: Melodies and lists 68
4 Chords 71
Interlude 4: Playing chords 84
5 Scales, keys, and melody 88
Interlude 5: Lean on me 100
6 Diatonic chords and chord progressions 103
Interlude 6: Random chord progressions 114
7 Frequency, fourier, and flters 117
Interlude 7: Creative efects 136
8 Note-based production efects 140
Interlude 8: How to make a drum fll 153
9 Song composition and EarSketch 158
viii Contents
Interlude 9: How to make a snare drum riser 172
10 Modular synthesis 177
Interlude 10: Drum machine function 191
11 History of music and computing 194

Appendix A: Python reference 207


Appendix B: TunePad programming reference 231
Appendix C: Music reference 240
Index 255
Figures

1.1 A TunePad program to play a simple rock beat 5


1.2 Typical DAW software 6
1.3 TunePad project workspace 13
1.4 Selecting instruments in TunePad 13
1.5 Parts of a TunePad cell 14
1.6 Python syntax error in TunePad 15
1.7 Selecting an instrument’s voice in TunePad 16
2.1 TunePad project information bar. You can click on the
tempo, time signature, or key to change the settings for
your project 19
2.2 Standard notation example 20
2.3 Waveform representation of Figure 2.2 21
2.4 Piano or MIDI roll representation of Figure 2.2 21
2.5 Common note symbols starting with a whole note (four
beats) on the top down to 16th notes on the bottom.
The notes on each new row are half the length of the
row above 23
2.6 Drums in a typical drum kit 26
2.7 Roland 808 drum sequencer 28
2.8 Changing an instrument’s voice in TunePad 28
2.9 Example of a Python syntax error in TunePad. This line
of code was missing a parenthesis symbol 29
2.10 Calling the playNote function in TunePad with two
parameters inside the parentheses 30
2.11 How to show the print output of your code in a TunePad cell 35
2.12 Anatomy of a for loop in Python 36
2.13 Example of a Python syntax error. The command
‘ployNote’ should instead say ‘playNote’ 39
2.14 Example of a Python syntax error. Here the problem is
actually on line 1, not line 2 39
2.15 TunePad composer interface provides drum and
bass sequencers 47
x Figures
2.16 Basic drum pattern 50
2.17 Declaring a for loop for hi-hat runs in Python 51
2.18 Hi-hat stutter patterns 51
3.1 Sound is made up of compression waves of air molecules
that expand outward at a speed of around 343 meters
per second. The frequency of a sound wave refers to
how fast it vibrates; amplitude refers to the intensity of
the sound; and wavelength refers to the length of one
complete cycle of the waveform 54
3.2 Drawing of the cochlea (inner ear) 54
3.3 A waveform with varying amplitude 56
3.4 A half step is the distance between two adjacent piano
keys, measured in semitones 58
3.5 The harmonic series 60
3.6 Two waves at an interval of an octave 63
3.7 The ratio between the note C 262 Hz and the note
G 393 Hz is considered a perfect ffth 65
3.8 Select the 808 Bass voice 70
4.1 C major chord with MIDI note numbers 72
4.2 Creating chords as lists of numbers in Python. Each
major chord follows the same pattern 73
4.3 How to declare a user-defned function in
Python 74
4.4 C major chord 77
4.5 D minor chord 77
4.6 B diminished chord 78
4.7 C major 7th chord 79
4.8 D minor 7th chord 79
4.9 G dominant 7th chord 80
4.10 Csus2 chord 81
4.11 Csus4 chord 81
4.12 C augmented chord 82
5.1 Whole step and half step intervals of the C major scale 89
5.2 C Major Pentatonic Scale (top) and F♯ Major Pentatonic
Scale (bottom) 91
5.3 A representation of a list with values and indices 94
5.4 The Circle of Fifths arranges musical keys 96
6.1 The seven diatonic chords of C major 104
6.2 The dominant V and viio chords share two notes in
common. This is easy to see when you line piano
diagrams up vertically 107
6.3 Flowcharts for generating chord progressions in major
and minor keys 108
6.4 Example of using the fowchart to generate a chord
progression 108
Figures xi
6.5 C major chord in root position (top), frst inversion
(bottom left), and second inversion (bottom right) 109
6.6 Chord progression I-V-vi-IV without voice leading (top)
and with voice leading (bottom). Chords V, vi, and IV
are inverted to reduce the pitch range and to minimize
the movement of individual voices “singing” the notes
of the chords 110
7.1 Sound energy generated by a fute playing a single
note. The sound contains a series of spikes at regular
“harmonic” frequency intervals 118
7.2 Frequency combinations: fundamentals, partials,
harmonic, and inharmonic 119
7.3 A square wave (or any other audio signal) can be described
as a series of sine waves making up the partial frequencies 121
7.4 ADSR envelope 122
7.5 A spectrogram shows the intensity of frequencies in an
audio signal over time. The heatmap colors correspond
to intensity or energy at diferent frequencies. Time
is represented on the horizontal axis and frequency in
kilohertz on the vertical axis 123
7.6 Mixing console with magnetic tape 124
7.7 The mixing interface in TunePad allows you to adjust
gain, pan, and frequency response for each track
in a mix 126
7.8 Lowpass flter response curve 129
7.9 Highpass flter response curve 130
7.10 Bandpass flter response curve 131
7.11 Notch flter response curve 132
7.12 Peaking flter response curve 132
7.13 Low shelf and high shelf response curves 133
7.14 Graph of two methods for fading audio in 137
8.1 Intermediate pitches between C and C 141
8.2 Code cell in TunePad showing import statement 154
8.3 Drum fll pattern A 154
8.4 Drum fll pattern B 155
9.1 Songs are composed of nested and repeating notes,
phrases, and sections 159
9.2 The main EarSketch interface features a large library
of samples (left), an interactive timeline (middle top), a
code editor (center), and extensive documentation and
curriculum (right) 162
9.3 Close-up screenshot of EarSketch’s DAW 164
9.4 Using the ftMedia function in EarSketch 165
9.5 Snare drum riser pattern 172
9.6 Alternative snare drum riser pattern 173
xii Figures
10.1 Moog System 55 modular synthesizer 178
10.2 Audio signal from a microphone (top) and an audio
signal from an electric circuit 179
10.3 A simple Modular Synthesis patch created in TunePad 179
10.4 A patch with a delay efect 182
10.5 Two variations of an Additive Synthesis patch 184
10.6 A simple Subtractive Synthesis patch 185
10.7 An FM Synthesis patch where one sine wave is fed into
the frequency input socket of another sine wave 185
10.8 A more complex FM Synthesis patch 186
10.9 An example of physical modeling to create complex
string-like sounds 187
10.10 Complete Basic Poly/Lead patch in TunePad 188
10.11 Complete FM Synthesis example 189
11.1 The IBM 7094 computer at NASA. Public domain.
Available at Wikipedia 197
11.2 The Yamaha DX-7 200
11.3 Opcode’s Vision software for Macintosh in 1989 202
11.4 Screenshot of Teropa’s Music Mouse emulator 204
11.5 Jazz trombonist and scholar George Lewis working
on the IRCAM project. Image Credit: Michel Waisvisz
archives, ca. 1985 (used with permission) 205
A3.1 Parts of an audio wave 241
A3.2 ADSR envelope 242
A3.3 Natural notes on a keyboard 246
A3.4 Natural notes for a Treble Clef (top) and natural notes
for a Bass Clef (bottom) 247
A3.5 Circle of Fifths 250
Photo and illustration credits

George Folz (georgefolz.com) created original illustrations for


this book featured in Interludes 2, 4, and 8.
The photograph at the beginning of Chapter 3 is by
(unsplash.com/@jonathanvez)
The photograph at the beginning of Chapter 4 is by
(unsplash.com/@markus_gjengaar)
The photograph at the beginning of Chapter 5 is by
(unsplash.com/@jasmund)
The photograph at the beginning of Chapter 6 is by
(unsplash.com/@efrenbarahona3)
The photograph at the beginning of Chapter 7 is by
(unsplash.com/@pablodelafuente)
The photograph at the beginning of Chapter 8 is by
(unsplash.com/@makuph)
The photograph at the beginning of Chapter 10 is by
(unsplash.com/@didierjoomun)
The photograph at the beginning of Interlude 9 is by
(unsplash.com/@halacious)
The photograph at the beginning of Chapter 11 is by deepsonic
(fickr.com/people/73143485@N02). Creative
Commons License creativecommons.org/licenses/by/2.0.
Foreword

When I was a kid growing up in Texas, I “learned” how to play viola. I


put learned in quotes because it was really just a process of rote memori-
zation—hours and hours of playing the same songs over and over again.
I learned how to read sheet music, but only to the extent that I knew the
note names and could translate them into the grossest of physical move-
ments. I never learned to read music as literature, to understand its deeper
meaning, structure, or historical context. I never understood anything
about music theory beyond being annoyed that I had to pay attention to
accidentals in diferent keys. I never composed anything, not even infor-
mally scratching out a tune. I never developed habits of deep listening,
of taking songs apart in my head and puzzling over how they were put
together in the frst place. I never played just for fun. And, despite the best
intentions of my parents and teachers, I never fell in love with music.
Learning how to code was the complete opposite experience for me. I
was largely self-taught. The courses I took in school were electives that I
chose for myself. Teachers gave me important scafolding at just the right
times, but it never felt forced. I spent hours working on games or other
projects (probably when I should have been practicing viola). I drew art-
work, planned out algorithms, and even synthesized my own rudimentary
sound efects. I had no idea what I was doing, but that was liberating. No
one was around to point out my mistakes or to show me how to do things
the “right” way (at least, not until college). I learned how to fgure things
out for myself, and the skills I picked up from those experiences are still
relevant today. I fell in love with coding.1
But I know many people whose stories are fipped 180 degrees. For
them, music was so personally, socially, and culturally motivating that
they couldn’t get enough. They’d practice for hours and hours, not just for
fun but for something much deeper. For some it was an instrument like
the guitar that got them started. For others it was an app like GarageBand
that gave them a playful entry point into musical ideas. To the extent that
they had coding experiences, those experiences ranged from uninspiring
to of-putting. It’s not that they necessarily hated coding, but it was some-
thing they saw as not being for them.
Other documents randomly have
different content
back
back

You might also like