O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Digital Electronics for Musicians

Book Description

Digital Electronics for Musicians is the perfect book for musicians who want to dive into the world of computer music and physical computing. This book is aimed at adventurous musicians who want to learn about music programming with Arduino, sensors, and Pure Data, and how to make new interfaces and even new instruments with that knowledge.

You’ll learn the basics of the Pure Data and Arduino languages, how to incorporate sensors into your musical projects, and how to use embedded computers, like the Raspberry Pi, to create stand-alone projects. Along the way, you’ll learn how to create a variety of innovative (Mark, Michelle, I guess they are innovative, but not 100% sure) musical projects, including an interactive bow for stringed instruments, a MIDI clavier synthesizer, an interactive drum set, a patch-bay matrix synthesizer, a guitar looper, and even a DIY theremin.

If you are a musician or tinkerer who wants to explore the world of electronic and electroacoustic music and musical interfaces with Arduino, sensors, and Pure Data, Digital Electronics for Musicians is the book for you.

Table of Contents

  1. Cover
  2. Title
  3. Copyright
  4. Contents at a Glance
  5. Contents
  6. About the Author
  7. About the Technical Reviewer
  8. Acknowledgments
  9. Introduction
  10. Chapter 1: Introduction to Pure Data
    1. Pd Basics: How It Works
    2. Our First Patch
      1. The Control Domain
      2. Execution Order
      3. Bang!
    3. Getting Help
    4. GUIs
      1. Pd Patches Behave Like Text Files
    5. Making Oscillators in Pd
      1. Making a Triangle Wave Oscillator
      2. Making a Sawtooth Oscillator
      3. Making a Square Wave Oscillator
    6. Using Tables in Pd
    7. Subpatches and Abstractions
    8. Control Domain vs. Signal Domain
    9. Audio Input in Pd
    10. Basic Electronic Music Techniques
      1. Additive Synthesis
      2. Ring Modulation
      3. Amplitude Modulation
      4. Frequency Modulation
      5. Envelopes
      6. Delay Lines in Pd
      7. Reverb
      8. Filters
    11. Making Wireless Connections
      1. Audio and MIDI Settings
    12. Additional Thoughts
    13. Conclusion
  11. Chapter 2: Introduction to Arduino
    1. Arduino Jump Start
    2. Parts List
    3. The Blink Sketch
    4. Digital Input
      1. Defining Variables in Arduino
      2. Further Explanation of the Code
      3. Classes in Arduino and the Serial Communication
      4. Further Explanation
      5. Building Circuits on a Breadboard
    5. Pull-up vs. Pull-down Resistors
    6. Both Digital Input and Output
    7. Analog Input
    8. Analog Input and Output
    9. Reading More Than One Pin, Arrays, and the for Loop
      1. Explaining the for Loop
      2. Using Arrays in Arduino
    10. Analog and Digital Input
    11. Communicating with Pd
    12. Sending Data from Pd to Arduino
    13. Conclusion
  12. Chapter 3: Embedded Computers and Going Wireless
    1. Before You Begin
    2. Parts List
    3. Why Use Embedded Computers?
      1. Which Embedded Computer?
    4. Getting Started with the Pi
      1. Getting Your Computer’s IP
      2. Logging in the Pi from OS X and Linux
      3. Logging in from Windows
      4. Configure the Pi
    5. Navigating Through the Linux system
      1. Editing Text Files in Linux
    6. Installing Software
      1. Installing Pd
      2. Launching Pd
      3. Setting up External Libraries in Pd
      4. Installing Arduino
      5. Let’s Talk About Versions
    7. Exchanging Files Between Your Computer and the Pi
      1. Transfer Files from OS X and Linux to the Pi, and Vice Versa
      2. Transfer Files from Windows to the Pi and Vice Versa
    8. Changing the IP of the Pi
      1. Setting a Static IP on Linux
      2. Setting a Static IP on OS X
      3. Setting a Static IP on Windows
      4. Log in to the Pi Without a Router
    9. Shutting Down the Pi
    10. Going Wireless
      1. Bluetooth vs. XBee
      2. Using a Bluetooth Module with Arduino
      3. Using the XBee with Arduino
    11. Conclusion
  13. Chapter 4: Getting Started with Musical Applications
    1. Parts List
    2. Phase Modulation Interface
      1. How Phase Modulation Works
      2. Making the Pd Patch
      3. Arduino Code for Phase Modulation Patch
      4. Circuit for Arduino Code
    3. A Simple Drum Machine Interface
      1. Building the Pd Patch
      2. Arduino Code for Drum Machine Patch
    4. Drum Machine and Phase Modulation Combination
      1. Arduino Code
      2. Arduino Circuit
      3. Pd Patch for Drum Machine-Phase Modulation Interface
    5. Conclusion
  14. Chapter 5: A Simple Synthesizer Using a MIDI Keyboard and Arduino
    1. Parts List
    2. What Is MIDI?
    3. Pd and MIDI
      1. How [notein] Works
      2. Using a Different Tuning and an Amplitude Envelope with [notein]
      3. Polyphony with MIDI in Pd
      4. MIDI Control Messages in Pd
      5. Pitch Bend Messages in Pd
      6. Program Change MIDI Messages in Pd
    4. Arduino Code
      1. Explaining the Code
    5. Pd Patch
      1. The arduino_stuff Subpatch
      2. The create_envelope and generic_data Subpatches
      3. The [poly_synth~] Abstraction
      4. The [pd $0-voice_creation_loop] subpatch
      5. How Dollar Signs Work in Pd
      6. The [synth_voice~] Abstraction
      7. The filter~ Subpatch
      8. Done with Patching, Time to Test
    6. Arduino Receiving MIDI Messages from the MIDI Keyboard
      1. Arduino Circuit Additions
      2. Arduino Code Additions
      3. Pd Patch Receiving MIDI Data from Arduino
    7. Running the Pd patch on Raspberry Pi
      1. Launching Pd on Boot with the Raspbian Jessie Image
      2. Launching Pd on Boot with the Raspbian Wheezy Image or with Another Embedded Computer Running Debian Jessie
      3. Shutting Down the Pi (or Any Embedded Computer) While Running Headless
      4. A Small Caveat for the Raspbian and Debian Wheezy Images
      5. Using an External Sound Card with the Pi
      6. Editing the Pd Patch When Pd is Running on Boot
    8. Enclosing the Pi in the Keyboard
      1. Choosing the Perforated Board
    9. Reducing the Wires of Your Circuit Board
      1. Choosing the Right Power Supply and Getting Access to the Power Pins
      2. Accessing the MIDI Pins
      3. Bringing the Power Input and Audio Output out of the Enclosure
    10. Conclusion
  15. Chapter 6: An Interactive Bow
    1. Parts List
    2. Writing Custom Functions
      1. A Function of the Data Type void
      2. Actual Code for the Project
      3. The Test Circuit of the Accelerometer
      4. The Test Pd Patch
    3. Building the Pd Patch
      1. How to Use the Graph-On-Parent Feature
      2. Setting the Properties of the GOP GUIs
      3. What We Have Achieved So Far in this Project’s Pd Patch
      4. Using the Canvas to Create Visual Feedback
      5. Building the Audio Processing Part of the Patch
      6. The Finished Patch
    4. Additions to the Arduino Sketch
    5. Finalizing the Circuit
      1. Using Bluetooth and a Voltage Divider Instead of the XBee
    6. Conclusion
  16. Chapter 7: An Interactive Drum Set
    1. Parts List
    2. Other Things We’ll Need
    3. First Approach to Detecting Drum Hits
      1. First Version of the Circuit
      2. Read the Drum Hits in Pd
      3. Getting the Maximum Value in Arduino
      4. Getting the Maximum Value in Pd
    4. Having Some Fun Before We Finalize
      1. Working Further with the Circuit and Arduino Code
      2. Adding Switches and LEDs to the Circuit and Code
    5. Building the Final Pd Patch
      1. Building the Audio File Abstraction
      2. Building the Abstraction to Receive Input from the Arduino
      3. Sending the Threshold and Debounce Values to the Arduino
      4. The Main Patch
    6. Finalizing the Arduino Code
    7. Making the Circuit Enclosure
    8. Conclusion
  17. Chapter 8: A DIY Theremin
    1. Parts List
    2. Using a Proximity Sensor with the Arduino
      1. Refreshing Our Memory on Serial.write
      2. Proximity Sensor Circuit
      3. Pd Patch That Reads the Proximity Sensor Data
      4. Smoothing out the Sensor Values
    3. Using Two Proximity Sensors and Four Potentiometers
      1. The Arduino Code
      2. The Circuit
      3. The Pd Patch
    4. Building the Oscillators for the Theremin
      1. Creating Band-Limited Waveforms
      2. Reading the Stored Band-Limited Waveforms
    5. Finalizing the Interface
      1. Adding Push Buttons to the Arduino Code to Control the Waveforms of the Oscillators
      2. Making the Circuit
      3. Putting It All Together
    6. Enclosing the Project with an Embedded Computer
      1. Adding a Push Button for Switching off the Embedded Computer
      2. Reading the Extra Push Button in Pd
      3. Writing the Script to Shut the Embedded Computer Down
      4. Loading the Pd Patch on Boot
    7. Conclusion
  18. Chapter 9: Making a Looper
    1. Parts List
    2. What Is a Looper?
    3. Recording Our First Sounds in Pd
      1. Playing Back the Recorded Sound
      2. Changing the Direction of the Playback
    4. Making Recordings of Arbitrary Lengths
      1. Retrieving the Length of the Recording
    5. Overdubbing
      1. Getting Rid of Clipping
      2. Getting the Start Position of the Overdubbing
      3. Knowing When to Stop Overdubbing
    6. Synchronizing End of Recording with Beginning of Playback
    7. Start Building the Interface
      1. Writing the Arduino Code
      2. Building the Circuit on a Breadboard
    8. Working Further on the Pd Patch
      1. The Recording Module
      2. The Phase Module
      3. The Playback Module
      4. The Overdub Module
      5. The Overdub Position Module
      6. The Arduino Module
      7. The Table Copying Module
      8. Putting It All Together
    9. Making Some Final Improvements
      1. Modifying the Arduino Code
      2. Modifying the Pd Patch
    10. Enclosing the Circuit in a Box
    11. Conclusion
  19. Chapter 10: A Patch-Bay Matrix Synthesizer
    1. Parts List
    2. What We Want to Achieve in this Chapter
    3. Extending the Arduino Analog Pins
      1. How a Multiplexer Works
      2. Writing Code to Control a Multiplexer
      3. Wiring 16 Potentiometers to the Multiplexer
      4. Reading the 16 Potentiometers in Pd
    4. Extending the Arduino Digital Pins
      1. Using the Input Shift Register
      2. Using the Output Shift Register
      3. Combining the Input and Output Shift Registers
    5. Making a Patch-Bay Matrix
      1. Implementing a Patch-Bay Matrix with the Arduino
      2. Making the Pd Patch That Reads the Connections
      3. Making the Patch-Bay Matrix Circuit
    6. Start Building the Audio Part of the Pd Patch
      1. A Signal Matrix in Pd
      2. Building the Modules for the Synthesizer
    7. The Final Patch
      1. The arduino_stuff Subpatch
    8. The Final Arduino Code
      1. Using Binary Numbers for Masking
      2. The check_connections Function
      3. The Main loop Function
      4. Controlling the LEDs with the Switches of the Shift Registers
    9. The Final Circuit
    10. Making an Enclosure
      1. Shutting down the Embedded Computer
    11. Conclusion
  20. Index