Muutke küpsiste eelistusi

Arduino for Musicians: A Complete Guide to Arduino and Teensy Microcontrollers [Kõva köide]

(Associate Professor: jazz studies, theory, composition, Whitworth University)
  • Formaat: Hardback, 454 pages, kõrgus x laius x paksus: 221x282x33 mm, kaal: 1293 g, over 200 illustrations
  • Ilmumisaeg: 26-May-2016
  • Kirjastus: Oxford University Press Inc
  • ISBN-10: 0199309310
  • ISBN-13: 9780199309313
  • Formaat: Hardback, 454 pages, kõrgus x laius x paksus: 221x282x33 mm, kaal: 1293 g, over 200 illustrations
  • Ilmumisaeg: 26-May-2016
  • Kirjastus: Oxford University Press Inc
  • ISBN-10: 0199309310
  • ISBN-13: 9780199309313
Arduino, Teensy, and related microcontrollers provide a virtually limitless range of creative opportunities for musicians and hobbyists who are interested in exploring "do it yourself" technologies. Given the relative ease of use and low cost of the Arduino platform, electronic musicians can now envision new ways of synthesizing sounds and interacting with music-making software. InArduino for Musicians, author and veteran music instructor Brent Edstrom opens the door to exciting and expressive instruments and control systems that respond to light, touch, pressure, breath, and other forms of real-time control. He provides a comprehensive guide to the underlying technologies enabling electronic musicians and technologists to tap into the vast creative potential of the platform.

Arduino for Musicians presents relevant concepts, including basic circuitry and programming, in a building-block format that is accessible to musicians and other individuals who enjoy using music technology. In addition to comprehensive coverage of music-related concepts including direct digital synthesis, audio input and output, and the Music Instrument Digital Interface (MIDI), the book concludes with four projects that build on the concepts presented throughout the book. The projects, which will be of interest to many electronic musicians, include a MIDI breath controller with pitch and modulation joystick, "retro" step sequencer, custom digital/analog synthesizer, and an expressive MIDI hand drum.

Throughout Arduino for Musicians, Edstrom emphasizes the convenience and accessibility of the equipment as well as the extensive variety of instruments it can inspire. While circuit design and programming are in themselves formidable topics, Edstrom introduces their core concepts in a practical and straightforward manner that any reader with a background or interest in electronic music can utilize. Musicians and hobbyists at many levels, from those interested in creating new electronic music devices, to those with experience in synthesis or processing software, will welcome Arduino forMusicians.

Arvustused

"I heartily recommend this book as a way to get started with Arduino or electronics even for non-musicians. But if you ever wanted to make your own Moog synth or Theremin (and who hasn't) then you will love this book."--Dr. Simon Monk, author and maker "A comprehensive and easy to use guide for everything you may need to know about how to use the Arduino for musical applications. The book is well-organized, allowing both technical novices and experienced music technologists to find the information and guidance they may be looking for."--Gil Weinberg, Professor and Director, Georgia Tech Center for Music Technology "Edstrom has developed a very useful resource for musicians interested in using microcomputer controllers and software tools in Arduino for Musicians. This publication, organized in three sections, serves not only as an introduction for those just learning the world of the Arduino, but also for those learning to use the open-source electronics platform to apply creative applications of the core concepts for the more advanced projects. The intermediate and advanced sections are written in a casual narrative style with well-organized sequencing. The book is a welcome addition as a resource or required text for undergraduate or graduate students enrolled in music technology or related courses in multimedia performance."--G. David Peters, Professor and Head of Graduate Studies, Music and Arts Technology, Indiana University - IUPUI

Preface xxi
Acknowledgments xxvii
About the Companion Website xxix
1 Getting Started
1(12)
Who This Book Is For
1(1)
What Is Arduino?
2(1)
What You Can Do with Arduino
2(1)
What You Can't Do with Arduino
3(1)
The Lay of the Land
3(4)
The Arduino Family
3(3)
Programming and the Arduino IDE
6(1)
Circuitry
6(1)
Review
7(1)
Design Cycle
7(1)
Organization of the Book
8(2)
Things You Will Need to Get Started
10(2)
Beginner
10(1)
Intermediate
11(1)
Advanced
11(1)
Purchasing Parts
12(1)
Conclusion
12(1)
2 Introduction to Programming
13(42)
What Is a Programming Language?
14(1)
Why the C Language?
14(1)
Getting Started
15(1)
Writing Your First Sketch
16(3)
Error Messages
17(1)
Uploading a Program
18(1)
"Hello, world!" in Detail
19(3)
Functions
19(1)
Serial Output
20(2)
Adding Comments
22(1)
Code Improvisation
22(1)
Variables, Data Types, and Operators
22(1)
Initializing Variables
23(4)
Operators
23(1)
Code Improvisation
24(1)
Data Types
24(1)
Signed and Unsigned Data Types
25(1)
Universal Data Types
26(1)
Constants
27(1)
Enumerations
27(1)
Comparison Operators and Control Structures
28(2)
"If" Statements
29(1)
Boolean Operators
30(1)
Switch Statements
31(1)
Code Improvisation
31(1)
Control Loops
32(3)
While Loop
33(1)
Do While Loop
33(1)
For Loop
34(1)
Endless Loops
35(1)
Practical Application
35(2)
Code Improvisation
37(1)
Writing a First Function
37(5)
Function Parameters
38(1)
Using a Custom Function
38(4)
A First Sketch Involving Hardware
42(2)
Introduction to Arrays
44(4)
Array Syntax
44(1)
Array Initialization
45(3)
The Ugly Truth: Working with Text in C
48(2)
String Literals
48(1)
Character Arrays
48(1)
An Easier Way: Using the String Class
49(1)
String Class Example
49(1)
A Complete Demonstration Program
50(4)
Playing the Tempo Game
51(1)
Setup
51(1)
newGame() Function
52(1)
Helper Functions
52(1)
Main loop()
53(1)
Conclusion
54(1)
3 Introduction to Electronics
55(27)
Overview
55(1)
Pep Talk
55(1)
Safety Warning
56(1)
Tools and Process
57(1)
A First Circuit
58(2)
9V Battery
58(1)
SPST Switch
59(1)
Resistor
59(1)
LED
59(1)
Using a Breadboard
60(1)
A First Breadboard Project
60(1)
Ohm's Law
61(2)
Conceptualizing Voltage, Current, and Resistance
61(1)
Using Ohm's Law
62(1)
Units of Measurement
63(2)
Practical Example of Ohm's Law
64(1)
Using a Digital Multimeter
65(6)
Measuring Voltage
65(1)
Measuring Current
66(1)
Measuring Resistance
67(1)
A Word About Resistor Color Codes
68(2)
Safety Diode and Potentiometer
70(1)
Emergency Music Stand Light
71(2)
Transistors
72(1)
Incorporating a Photoresistor and Transistor
73(1)
Cigar Box Amplifier
73(6)
Operational Amplifier
74(1)
Capacitors
75(1)
Calculating Capacitance
76(1)
Connecting an Audio Signal to the Amplifier
77(1)
Completed Project
77(2)
Simple Theremin
79(1)
Hex Inverter
79(1)
Phase-Locked Loop IC
80(1)
Mocking Up the Simple Theremin
80(1)
Conclusion
80(2)
4 Interfacing with Arduino
82(15)
Overview of Arduino UNO
83(1)
A Caution
84(1)
Overview of the Metronome Project
84(12)
Metronome with Speaker
84(1)
Metronome with Potentiometer
85(3)
Metronome with Pushbutton Switch
88(4)
Complete Source Code
92(2)
Metronome with Quadrature Rotary Encoder
94(2)
Conclusion
96(1)
5 Music Instrument Digital Interface I/O
97(31)
What Is MIDI?
97(1)
MIDI Ports
98(1)
MIDI OUT Port
98(1)
MIDI IN Port
98(1)
MIDI THRU Port
99(1)
MIDI Messages
99(1)
Status Byte
99(1)
Data Byte
100(1)
Channel Messages and System Messages
100(9)
Channel Voice Messages
100(7)
Other Control Changes and Mode Changes
107(1)
Channel Mode Messages
108(1)
System Messages
109(5)
System Common Messages
109(1)
System Real-Time Messages
109(1)
System Exclusive Messages
110(1)
Universal System Exclusive Messages
111(3)
MIDI Hardware
114(10)
MIDI Output
114(6)
MIDI Receiver Circuit
120(1)
MIDI THRU
120(1)
Creating Permanent MIDI Circuits
120(4)
USB MIDI with Teensy
124(3)
Configuring Teensy
125(2)
Conclusion
127(1)
6 Real-Time Input: Musical Expression
128(15)
Force-Sensitive Resistor
129(3)
Wiring an FSR
129(1)
Force-Sensitive Drum Pad
130(2)
Nintendo DS Touch Screen
132(3)
Wiring
132(1)
Reading the X and Y Positions
133(2)
Pressure Sensor
135(2)
Pressure Sensor Unit
135(1)
Wiring the Pressure Sensor
135(1)
Reading Values from the Pressure Sensor
135(2)
Joystick
137(2)
Wiring a Joystick
137(1)
Reading Values from a Joystick
137(2)
Joystick Sensitivity
139(1)
Wii Nunchuck
139(2)
Nunchuck Library
140(1)
Conclusion
141(2)
7 Music-Making Shields
143(30)
Overview
143(1)
Music Instrument Shield (SparkFun Electronics)
143(6)
Using the Shield
144(3)
"Steve Reich" Sketch
147(2)
Adafruit Wave Shield
149(6)
Wave Shield Library
149(1)
Pin Assignments
150(1)
Preparing Audio Files for Use with the Wave Shield
150(1)
Loading a File
151(1)
WaveHC Member Functions and Data Members
152(1)
Demonstration Sketch
153(2)
GinSing
155(7)
Voice Mode
156(2)
Synthesizer Mode
158(1)
Mini Synthesizer Project
159(3)
Gameduino
162(8)
Using the Gameduino
163(1)
Additive Synthesis
164(1)
Additive Gameduino Synthesizer
164(1)
Using a Structure and an Array
164(2)
Main Loop()
166(4)
Codec Shield
170(1)
Using the Codec Shield
170(1)
Conclusion
171(2)
8 Introduction to C++ Programming
173(24)
Overview: Moving Away from a Procedural Approach
173(1)
Using Objects
173(1)
Moving to C++
174(1)
Classes
174(10)
Anatomy of a Class
175(1)
Member Variables
176(1)
Public and Private Keywords
177(1)
Constructors and Destructors
177(1)
Source File
178(1)
Destructor
179(1)
Class Methods
180(3)
Using a Class
183(1)
More on Overriding Methods
183(1)
Other Topics
184(1)
Developing a Rotary Encoder Class
184(3)
trackShaftPosition()
186(1)
Using RotaryEncoder
187(1)
Making Your Own Library
187(1)
Developing a 12-Tone Matrix Class
188(8)
Tone Row
188(2)
Overview of Design
190(1)
Header File
191(1)
Source File
192(2)
Using ToneRow in a Sketch
194(2)
Conclusion
196(1)
9 Audio Output and Sound Synthesis
197(47)
Analog vs. Digital
197(1)
Sample Rate and Resolution
198(1)
Resolution
199(1)
Conceptualizing a Digital Audio Converter
199(1)
Digital Audio Conversion
200(10)
R2R Ladder
200(9)
DAC Integrated Circuit
209(1)
TLC7226 Pinout
209(1)
Sound Synthesis
210(4)
Waveforms
211(1)
Generating a Waveform
212(1)
Synthesizing a Ramp Waveform
213(1)
Fixed-Point Math
214(2)
Example 1
215(1)
Example 2
216(1)
Tuning Oscillator
216(3)
Volatile Variables
217(2)
Developing an Oscillator Class
219(12)
Inheritance
219(1)
An Oscillator Base Class
220(4)
Using Inheritance to Create a Ramp Oscillator
224(1)
Sawtooth Oscillator
225(1)
Pulse-Width Oscillator
225(2)
Triangle Oscillator
227(1)
Noise Generator
228(1)
Using a Lookup Table
229(2)
Using Oscillators
231(3)
Modulation
233(1)
Introduction to Mozzi
234(2)
Pulse-Width Modulation
234(1)
Circuit for PWM Output
235(1)
A First Mozzi Sketch
236(5)
Incorporating a Filter
239(1)
Summing Signals and Adjusting Levels
240(1)
Further Exploration
241(1)
Audio Output with Teensy 3
241(3)
Exploring Teensy 3
243(1)
10 Audio Input
244(31)
Overview
244(1)
Analog-to-Digital Conversion
244(9)
Preparing a Signal for Input
245(3)
Setting Up a Timer for Analog-to-Digital Conversion
248(3)
Building a Simple Arduino Preamp
251(1)
Building an Electret Microphone
252(1)
Visualizing Audio Data
253(4)
Interfacing with Processing
254(3)
Testing Waveform View
257(1)
Fourier Transform
257(5)
Using Data from the FHT
259(1)
Spectrum Analyzer
259(2)
Other Uses for FFT and FHT
261(1)
A Brief Introduction to Signal Processing
262(7)
A Few Words About Buffers
262(1)
Delay
263(1)
Variable Delay
264(3)
Tremolo
267(2)
High-End Audio Using the Open Music Labs Codec Shield for Real-Time Processing
269(3)
Using Mozzi for Audio Input and Processing
272(2)
Hardware Setup
272(1)
Software Setup
272(1)
Setting Up a Low-Pass Filter
272(1)
updateControl() Mechanism
273(1)
Using mozziAnalogRead()
273(1)
Scaling Amplitude in updateAudio()
273(1)
Conclusion
274(1)
11 Finalizing Projects
275(17)
Creating a Permanent Project
275(1)
Personal Safety
275(1)
Fire Safety
276(1)
Protecting Sensitive Electronic Components
276(1)
Tools
276(1)
Essential Tools
276(1)
Helpful Tools
277(1)
Visualizing a Final Project
277(2)
Prototype
277(1)
Component Connections
277(1)
Attaching Components
278(1)
Consider the Enclosure
278(1)
Paper Panel Mock-up
278(1)
Print Drilling/Cutting Guides
278(1)
Test Drill Bits
279(1)
Moving from a Solderless Breadboard to a Solder Breadboard
279(4)
Staying Neat: Layout and Wires
279(1)
Consistent Layout
280(1)
IC Sockets
280(1)
Solder Breadboard Options
280(2)
Homemade Printed Circuit Boards
282(1)
Ordering Online Printed Circuit Boards
282(1)
Soldering
283(2)
Solder
284(1)
Tinning
284(1)
Soldering Process
284(1)
Speed
285(1)
Appearance
285(1)
Holding Parts in Place
285(1)
Practical Application
285(2)
Soldering Etude 1
286(1)
Soldering Etude 2
286(1)
Project Boxes
287(2)
Wood Box
287(2)
Plexiglas Enclosure
289(1)
Front Panels
289(3)
Conclusion
290(2)
12 Standalone Arduino
292(14)
Why Standalone Arduino?
292(1)
Parts
292(4)
7805 Voltage Regulator
293(1)
ATmega328
294(2)
Burning a Bootloader to a Blank ATmega328
296(4)
Programming Options
297(2)
Other Programming Options
299(1)
A Demonstration Project
300(6)
Rotary Encoder with Switch
300(1)
Complete Circuit
301(1)
Code
301(2)
7-Segment Serial Display
303(1)
Finalizing the Project
303(3)
13 MIDI Hand Drum Project
306(23)
Overview
306(1)
Mongo: MIDI Bongo Drum
307(1)
Hardware
308(2)
Getting Started
308(1)
Making Connections
309(1)
Developing the Mongo Firmware
310(14)
Software Setup, Global Constants, and Variables
311(2)
TouchPad Class
313(2)
Program Logic
315(6)
Storing Data
321(1)
Helper Functions
322(2)
Building the Mongo Drum
324(5)
Circuit Design
324(1)
Creating an Enclosure
325(1)
Joining the Sides
325(1)
Attaching the Bottom
326(1)
Adding Corner Posts and Circuit Base
326(1)
Installing Components on the Face Plate
326(1)
Finishing the Build
327(1)
Moving On
328(1)
14 Stella Synthesizer Project
329(19)
Stella Digital/Analog Synthesizer
329(5)
Front Panel
330(2)
Circuitry
332(1)
Software: Encoders and Buttons
333(1)
Serial7Segment Class
334(1)
Preamble
335(2)
Setup()
337(9)
Stella Synth Tasks
338(5)
SetFrequencyFromMidiNote()
343(2)
updateAudio()
345(1)
Stella Synth in Action
346(1)
Enhancements
347(1)
Conclusion
347(1)
15 Step Sequencer Project
348(22)
Hardware and Function
348(1)
Getting Started
349(18)
Making Connections
350(3)
Step Sequencer Software
353(4)
Program Logic
357(8)
Using the Shift Out IC: turnOnLED()
365(1)
Playback
366(1)
Building the Step Sequencer
367(2)
Primary Circuit
367(1)
LED Circuit
368(1)
Shift-Register Circuit
368(1)
Enclosure
368(1)
Other Enhancements
369(1)
16 Emote MIDI Controller
370(9)
Circuit
370(1)
Enclosure
371(1)
Code
372(6)
Constants and Variables
372(1)
MIDI Breath Controller Class
372(2)
MIDI Joystick Class
374(1)
Mapping Modulation Values (Y-Axis)
374(2)
Mapping Pitch Bend (X-Axis)
376(1)
Main loop()
377(1)
Conclusion
378(1)
Conclusion 379(2)
Appendix A MIDI Control Changes 381(7)
Appendix B MMC Commands 388(2)
Appendix C Introduction to Bit Twiddling 390(9)
Notes 399(6)
Bibliography 405(6)
Index 411
Brent Edstrom is the author of several books, including Recording on a Budget and Musicianship in the Digital Age. An avid programmer, he has used a variety of programming languages to create custom ear training, music synthesis, and music notation applications, and has taught courses in music and computer science. He is a professor of music at Whitworth University.