The Alpha Geek – Geeking Out

Wave Packet

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

Categories
Archives