Iam also beginning to create sound design for use in a theatre production, and I am planning on using the Arduino Uno as the heart of a real-time digital signal processing station. The audio that I am using as input signal will be live conversation between two actors and (maybe, if it's not too complicated) a small ensemble of instruments.
I am planning on engineering an audio input unit from a microphone cable to transmit the audio signal from the actors to the Uno, which will process the audio based on the currently unwritten program. The output will be sent to a mixer in order for me to shape the volume, EQ and pan of the output before amplification into the theatre.
I also have a very little amount of coding experience, but I will try my best to learn. Could a user please advise on a starter project along these lines so I can learn a little more about real-time digital audio processing?
How much do you know about digital signal processing?
With the basic Arduino framework, the best you've got is 10 bit audio data at a bandwidth of, at best, about 4 kHz, which is a little better than telephony quality.
Technically, I have little experience with the software that powers digital audio processing and as much practical experience as just having spent time as an amateur musician who has seen a lot of guitar pedals and effects in action.
I know that there are Shields out there that are specialized for audio application. Could you recommend one, because I would definitely need a little more quality than that. I actually would be interested to learn about different ways to process digital signals for a live audio application, if that makes sense. Alternatively, a better question would be what are the practical uses of digital signals for gathering raw data to support programs on the Uno designed to perform diverse functions not limited to audio output?
DSP is an advanced programming topic. If you were studying university computer science or engineering it's probably a 4th year class. There is a [u]free online DSP book[/u] if you want to look into it.
I wouldn't recommend real-time audio processing on a regular computer either. It can be done but the multitasking operating system means you need input & output buffers, and buffers are delays. People who do real time audio through a computer often struggle to get the latency (delay) down to an acceptable level.
Most of these shields have all of the electronics for playing an audio file. There's memory, a clock, and a digital-to-analog converter. The Arduino isn't even "seeing" the audio, it's just selecting a file and starting/stopping playback (and maybe volume control or some other control-inputs to the audio shield).
Alternatively, a better question would be what are the practical uses of digital signals for gathering raw data to support programs on the Uno designed to perform diverse functions not limited to audio output
The Arduino can do things like sound activated lighting. I've made some sound-activated lighting effects with the Arduino. The effects I've made only depend on "loudness", but you can do some frequency analysis in hardware or software. For my effects, I use a circuit called a peak detector, that puts-out a varying DC voltage that follows the peak signal level... That way my Arduino can sample the "loudness" slowly (about 10 times per second) and I don't have to read or "process" the actual audio signal.
Why doesn't a University DSP course at least provide you with a processor that has DSP instructions so that you can do something reasonably meaningful?
A Teensy3.6 with audio board, for example, would allow some nifty DSP stuff.
The 10-bit ADC probably has enough resolution to "demonstrate something" but the ATmega datasheet says you loose resolution above a sample rate of 15kHz so that's another limitation on the signals you can process.
Did you cover anything in your class about processing speed/processing power? My gut-feeling is that the regular Arduino isn't powerful enough for "audio processing" (in addition to the ADC limitations). So, you might need to work at (relatively) lower frequencies. I assume it is powerful enough to filter lower audio frequencies.
People do make audio "spectrum analyzers" with the Arduino and you can find examples on YouTube, but these are spectrum analyzer effects, not a true spectrum analyzer instrument. It might make an acceptable demonstration project.
This Arduino-powered vocal effects box pitch shifts and distorts incoming audio signals to produce a wide variety of vocal effects. It samples an incoming microphone signal at a rate of about 40 kHz, manipulates the audio digitally, and then outputs 8 bit audio at 40 kHz through an R2R resistor ladder DAC. To minimize the amount of computation required by the Arduino, I used a technique called granular synthesis to process the incoming signal. Essentially, as audio comes into the Arduino it gets cut up and stored as small (millisecond or microsecond sized) samples called "grains." These grains are then individually manipulated and played back; they may be lengthened or shortened, stretched or compressed, played back in reverse, copied several times, or mixed with other grains. You can hear a (somewhat nightmare-inducing) audio sample from the effects box below. Download the .wav file here. The whole project is documented on Instructables. with parts lists, schematics, code, and step by step build instructions.
An experiment pushing the limits of the Arduino Uno's memory. The glitchbox is an Arduino-powered, sample-based drum machine used for live audio sequencing. The buttons on the front of the instrument play back nine audio samples stored in memory. A switch on top records, quantizes, and loops sequences of these samples. Once a sequence is recorded, additional samples may be layered and automatically looped on top. Recorded sequences may also be temporarily muted or cleared and rerecorded. Two knobs on top of the instrument control volume and tempo. Complete build documentation can be found on Instructables
Information about generating 44.1kHz stereo audio with an 8 bit dual output DAC IC. Includes code and circuits for generating binaural beats and panning between left and right channels. Find it on Instructables.
As a follow up to my Arduino Audio Input tutorial, I wrote a sketch that analyzes a signal coming into the Arduino's analog input and determines the fundamental frequency. The code uses a sampling rate of 38.5kHz and is generalized for arbitrary waveshapes. I've also included code for setting up an LED clipping indicator and attack detection. Find it on Instructables.
An Instructable documenting how to amplify and bias an audio signal so that it can be sampled by one of the Arduino's analog input pins. Includes code for manually setting the Arduino's ADC for a sampling rate of up to 38.5kHz at 8-bit precision. Used in my Arduino vocal effects box and Arduino frequency detection projects. Find it on Instructables.
An Instructable explaining how to set up a simple 8 bit R2R DAC on pins 0-7 of an Arduino (PORTD). This DAC is used in many of my projects including the glitchbox, waveform generator, and vocal effects box. Includes code for sampling rates of up to 40 kHz using interrupts. Find it on Instructables.
When I think of Bluetooth I think of music but sadly most microcontrollers can't play music via Bluetooth. The Raspberry Pi can but that is a computer. I want to develop an Arduino based framework for microcontrollers to play audio via Bluetooth. To fully flex my microcontroller's muscles I'm going to add real-time Digital Signal Processing (DSP) to the audio (high-pass filtering, low-pass filtering and dynamic range compression). For the cherry on top, I will add a webserver that can be used to configure the DSP wirelessly. The embedded video shows the basics of Bluetooth audio in action. It also shows me using the webserver to perform some high-pass filtering, low-pass filtering and dynamic range compression. The first use of Dynamic range compression purposefully causes distortion as an example of poor parameter choices. The second example eliminates this distortion.
For this project, the ESP32 is the microcontroller of choice. It costs less than 10 and is feature-packed with ADCs, DACs, Wifi, Bluetooth Low Energy, Bluetooth Classic and a 240MHz dual-core processor. The onboard DAC can technically play audio but it won't sound great. Instead, I'll use the Adafruit I2S stereo decoder to produce a line-out signal. This signal can easily be sent to any HiFi system to instantly add wireless audio to your existing HiFi system.
Hopefully, most makers will have breadboards, jumpers, USB cables, power supply soldering irons and will only have to spend 15 on the ESP32 and the stereo decoder. If not, all the parts required are list below.
If you have a soldering iron, solder the pins to the stereo decoder according to the instructions on the Adafruit website. At the time of writing my soldering iron was at work which was locked down. I didn't want to pay for a temporary soldering iron so I cut up some push headers from pimoroni. I cut them up so they would fit to the stereo decoder. This is not the best solution (and not how the headers were intended to be used) but it is the cheapest alternative to a soldering iron. Slot the cut-up header on to the breadboard. You should only need 1 line of 6 pins for the decoder. You can add another six to the other side for stability but this isn't necessary for this prototype system. The pins to slot the headers into are vin, 3vo, gnd, wsel, din and bclk.
3a8082e126