Project #16: Sound – Mozzi – Mk09

——

#donluc #sound #simplekeyboard #synthesizer #mozzi #programming #arduino #fritzing #electronics #microcontrollers #consultant #vlog

——

Mozzi

——

Mozzi

——

Mozzi

——

Mozzi

——

Mozzi

Currently your Arduino can only beep like a microwave oven. Mozzi brings your Arduino to life by allowing it to produce much more complex and interesting growls, sweeps and chorusing atmospherics. These sounds can be quickly and easily constructed from familiar synthesis units like oscillators, delays, filters and envelopes. You can use Mozzi to generate algorithmic music for an installation or performance, or make interactive sonifications of sensors, on a small, modular and super cheap Arduino, without the need for additional shields, message passing or external synths.

Wavepacket Synthesis Arduino

Wavepacket synthesis, with two overlapping streams of wave packets. Each packet is an enveloped grain of a sin (or cos) wave. The frequency of the wave, the width of the envelopes and the rate of release of envelopes are the parameters which can be changed. Potentiometer A0 Fundamental, the rate at which packets are produced. Potentiometer A1 Bandwidth, the width of each packet. A lower value allows more of the centre frequency to be audible, a rounder sound. A higher value produces narrower packets, a more buzzing sound. Potentiometer A2 Centrefreq, the oscillation frequency within each packet.

DL2011Mk03

1 x Arduino Uno
3 x Potentiometer
3 x Knob
1 x Audio Jack 3.5mm
1 x SparkFun Audio Jack Breakout
1 x Speaker
7 x Jumper Wires 3in M/M
6 x Jumper Wires 6in M/M
1 x Half-Size Breadboard
1 x SparkFun Cerberus USB Cable

Arduino Uno

SPK – Digital 9
PO0 – Analog A0
PO1 – Analog A1
PO2 – Analog A2
VIN – +5V
GND – GND

DL2011Mk03p.ino

// ***** Don Luc Electronics © *****
// Software Version Information
// Project #16: Sound - Mozzi - Mk09
// 11-03
// DL2011Mk03p.ino 16-09
// 1 x Arduino Uno
// 3 x Potentiometer
// 3 x Knob
// 1 x Audio Jack 3.5mm
// 1 x SparkFun Audio Jack Breakout
// 1 x Speaker
// 7 x Jumper Wires 3in M/M
// 6 x Jumper Wires 6in M/M
// 1 x Half-Size Breadboard
// 1 x SparkFun Cerberus USB Cable

// Include the Library Code
#include 
#include 
#include 
#include 

// Set the input for the potentiometer fundamental to analog pin 0
const int PotFun = A0;
// Set the input for the potentiometer for bandwidth to analog pin 1
const int PotBan = A1;
// Set the input for the potentiometer for centre_freq to analog pin 2
const int PotFre = A2;

// Min and Max values of synth parameters
// to map AutoRanged analog inputs to
// Fundamental
const int MIN_F = 20;
const int MAX_F = 150;
// Bandwidth
const int MIN_BW = 20;
const int MAX_BW = 150;
//Centre Frequency
const int MIN_CF = 20;
const int MAX_CF = 150;

// For smoothing the control signals
// RollingAverage  myThing
// Fundamental
RollingAverage  kAverageF;
// Bandwidth
RollingAverage  kAverageBw;
//Centre Frequency
RollingAverage  kAverageCf;

// Intmap is a pre-calculated faster version of Arduino's map
IntMap kMapF(0,1023,MIN_F,MAX_F);
// AutoMap adapts to range of input as it arrives
AutoMap kMapBw(0,1023,MIN_BW,MAX_BW);
AutoMap kMapCf(0,1023,MIN_CF,MAX_CF);

// DOUBLE selects 2 overlapping streams
WavePacket  wavey;

// Software Version Information
String sver = "16-09";

void loop() {

  // Audio Hook
  audioHook();

}

getMozzi.ino

// Mozzi
// Update Control
void updateControl(){

  // Fundamental
  int fundamental = mozziAnalogRead( PotFun )+1;
  fundamental = kMapF(fundamental);
  
  // Bandwidth
  int bandwidth = mozziAnalogRead( PotBan );
  bandwidth = kMapBw(bandwidth);

  //Centre Frequency
  int centre_freq = mozziAnalogRead( PotFre );
  centre_freq = kMapCf(centre_freq);
  
  // Wavey
  wavey.set(fundamental, bandwidth, centre_freq);
  
}
// Update Audio 
int updateAudio(){

  // >>8 for AUDIO_MODE STANDARD
  return wavey.next()>>8;
  
}

setup.ino

// Setup
void setup() {

  // Wait before starting Mozzi to receive analog reads,
  // so AutoRange will not get 0
  delay(200);
  startMozzi();
  
}

Technology Experience

  • Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
  • Robotics
  • Research & Development (R & D)
  • Desktop Applications (Windows, OSX, Linux, Multi-OS, Multi-Tier, etc…)
  • Mobile Applications (Android, iOS, Blackberry, Windows Mobile, Windows CE, etc…)
  • Web Applications (LAMP, Scripting, Java, ASP, ASP.NET, RoR, Wakanda, etc…)
  • Social Media Programming & Integration (Facebook, Twitter, YouTube, Pinterest, etc…)
  • Content Management Systems (WordPress, Drupal, Joomla, Moodle, etc…)
  • Bulletin Boards (phpBB, SMF, Vanilla, jobberBase, etc…)
  • eCommerce (WooCommerce, OSCommerce, ZenCart, PayPal Shopping Cart, etc…)

Instructor

  • Arduino
  • Raspberry Pi
  • Espressif
  • Robotics
  • DOS, Windows, OSX, Linux, iOS, Android, Multi-OS
  • Linux-Apache-PHP-MySQL

Follow Us

J. Luc Paquin – Curriculum Vitae
http://www.donluc.com/DLHackster/LucPaquinCVEngMk2020a.pdf

Web: http://www.donluc.com/
Web: http://www.jlpconsultants.com/
Web: http://www.donluc.com/DLHackster/
Web: https://www.hackster.io/neosteam-labs
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/luc.paquin/

Don Luc