The Alpha Geek – Geeking Out

Mozzi

Project #16: Sound – White Noise or Wave Packet – Mk17

——

#donluc #sound #whitenoise #mozzi #WavePacket #arduino #sparkfun #project #programming #electronics #microcontrollers #consultant #zoom #patreon #videoblog

——

Wave Packet

——

Wave Packet

——

Wave Packet

——

White Noise

White Noise can be used by all audiences in a variety of ways throughout our daily lives. Whether you’re trying to work, study, relax, or even sleep. Offices can be either too quiet or too noisy. White noise makes it impossible to concentrate. Sound affects many areas of the brain and has an undeniable effect on the body. A good way to test if a particular sound is relaxing to you is to check your pulse, if it slows down, then you have found the sound that is calming you. Keep listening to it and you will relax, reaching a state of increased calmness and reducing your levels of anxiety, stress, or anger.

Wave Packet

In physics, a wave packet is a short burst of localized wave action that travels as a unit. A wave packet can be analyzed into, or can be synthesized from, an infinite set of component sinusoidal waves of different wavenumbers, with phases and amplitudes such that they interfere constructively only over a small region of space, and destructively elsewhere.Each component wave function, and hence the wave packet, are solutions of a wave equation. Depending on the wave equation, the wave packet’s profile may remain constant or it may change while propagating.

DL2104Mk02

1 x Arduino Pro Mini 328 – 5V/16MHz
1 x Mountable Slide Switch
1 x 10K Ohm
2 x LED Green
2 x 270 Ohm
3 x Rotary Potentiometer – 10k Ohm
3 x Knob
1 x Audio Jack 3.5mm
1 x SparkFun Audio Jack Breakout
1 x Hamburger Mini Speaker
12 x Wire Solid Core – 22 AWG
7 x Jumper Wires 3 inches M/M
2 x Jumper Wires 6 inches M/M
1 x Full-Size Breadboard
1 x SparkFun Cerberus USB Cable
1 x SparkFun FTDI Basic Breakout – 5V

Arduino Pro Mini 328 – 5V/16MHz

PO1 – Analog A0
PO2 – Analog A1
PO3 – Analog A2
SPK – Digital 9
LD1 – Digital 6
LD2 – Digital 7
SW1 – Digital 4
VIN – +5V
GND – GND

DL2104Mk02p.ino

// ***** Don Luc Electronics © *****
// Software Version Information
// Project #16: Sound - White Noise - Mk17
// 04-02
// DL2104Mk02p.ino 16-17
// 1 x Arduino Pro Mini 328 - 5V/16MHz
// 1 x Mountable Slide Switch
// 1 x 10K Ohm
// 2 x LED Green
// 2 x 270 Ohm
// 3 x Rotary Potentiometer - 10k Ohm
// 3 x Knob
// 1 x Audio Jack 3.5mm
// 1 x SparkFun Audio Jack Breakout
// 1 x Hamburger Mini Speaker
// 12 x Wire Solid Core - 22 AWG
// 7 x Jumper Wires 3 inches M/M
// 2 x Jumper Wires 6 inches M/M
// 1 x Full-Size Breadboard
// 1 x SparkFun Cerberus USB Cable
// 1 x SparkFun FTDI Basic Breakout - 5V

// Include the Library Code
// Mozzi
#include <MozziGuts.h>
// Mozzi Random
#include <mozzi_rand.h>
// Oscillator template
#include <Oscil.h>
// Mozzi Analog
#include <mozzi_analog.h>
// WavePacket Sample
//#include <WavePacketSample.h>
#include <WavePacket.h>
// Rolling Average
#include <RollingAverage.h>
// Sine table for oscillator whitenoise
#include <tables/whitenoise8192_int8.h>

// Set the input for the knob
#define FUNDAMENTAL_PIN A0
#define BANDWIDTH_PIN A1
#define CENTREFREQ_PIN A2

// for smoothing the control signals
// Rolling Average
RollingAverage <int, 32> kAverageF;
RollingAverage <int, 32> kAverageBw;
RollingAverage <int, 32> kAverageCf;
// SINGLE selects 1 non-overlapping stream
WavePacket <SINGLE> wavey; 

// Oscil <table_size, update_rate> oscilName (wavetable)
Oscil <WHITENOISE8192_NUM_CELLS, AUDIO_RATE> aSin(WHITENOISE8192_DATA);

// Mini Speaker
int SPK = 9;

// Mountable Slide Switch
int iSS1 = 4;
// State
int iSS1State = 0;

// LED Green
int iLEDG1 = 6;
int iLEDG2 = 7;

// Set the input for the volume
// Volume level from updateControl() to updateAudio()
byte vol;

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

void loop() {

  // Slide Switch
  // Read the state of the iSS1 value
  iSS1State = digitalRead(iSS1);
  
  // Audio Hook
  audioHook();
  
}

getMozzi.ino

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

  // If it is the Slide Switch State is HIGH
  if (iSS1State == HIGH) {

    // White Noise
    vol = 255;

  } else {

    // Wavey Set
    wavey.set(kAverageF.next(mozziAnalogRead(FUNDAMENTAL_PIN))+1,
    kAverageBw.next(mozziAnalogRead(BANDWIDTH_PIN)),
    kAverageCf.next(2*mozziAnalogRead(CENTREFREQ_PIN)));
  
  }

}
// Update Audio
int updateAudio()
{

  // If it is the Slide Switch State is HIGH
  if (iSS1State == HIGH) {

    // LED Green
    digitalWrite(iLEDG1, HIGH);
    digitalWrite(iLEDG2, LOW);
    
    // White Noise
    char whitenoise = rand((byte)255) - 128;
    return (((whitenoise * aSin.next())) * vol)>>8;  

  } else {

    // LED Green
    digitalWrite(iLEDG1, LOW);
    digitalWrite(iLEDG2, HIGH);
    
    // AUDIO_MODE STANDARD
    // Wavey Next
    return wavey.next()>>8;
   
  }

}

setup.ino

// Setup
void setup() {

  // Slide Switch
  pinMode(iSS1, INPUT);

  // LED Green
  pinMode(iLEDG1, OUTPUT);
  pinMode(iLEDG2, OUTPUT);

  // Mozzi Start
  startMozzi();
  
  // Set the frequency
  aSin.setFreq(0.05f);
  
}

People can contact us: https://www.donluc.com/?page_id=1927

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

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

Follow Us

J. Luc Paquin – Curriculum Vitae
https://www.donluc.com/DLE/LucPaquinCVEngMk2021a.pdf

Web: https://www.donluc.com/
Web: http://www.jlpconsultants.com/
Web: https://www.donluc.com/DLE/
Web: https://www.donluc.com/DLHackster/
Web: https://www.hackster.io/neosteam-labs
Web: https://zoom.us/
Patreon: https://www.patreon.com/DonLucElectronics
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/neosteamlabs/

Don Luc

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
https://www.donluc.com/DLHackster/LucPaquinCVEngMk2020a.pdf

Web: https://www.donluc.com/
Web: http://www.jlpconsultants.com/
Web: https://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

Categories
Archives