The Alpha Geek – Geeking Out

Project #16: Sound – Music Acoustics – Mk18

——

#DonLucElectronics #DonLuc #Sound #WhiteNoise #Mozzi #WavePacket #Arduino #Project #Programming #Electronics #Microcontrollers #Consultant #VideoBlog

——

Music Acoustics

——

Music Acoustics

——

Music Acoustics

——

Music Acoustics

——

Music Acoustics

Music acoustics is a multidisciplinary field that combines knowledge from physics, psychophysics, physiology, and signal processing among other disciplines. As a branch of acoustics, it is concerned with researching and describing the physics of music, how sounds are employed to make music. Examples of areas of study are the function human voice (the physics of speech), computer analysis, and in the clinical.

DL2106Mk05

1 x Arduino Pro Mini 328 – 5V/16MHz
2 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
2 x Battery Holder – 2 x AAA
4 x Alkaline Battery – AAA
1 x JST Jumper 2 Wire Assembly
19 x Wire Solid Core – 22 AWG
8 x Screw, 1/4 inches, 4-40
8 x Nut, Nylon Locknut, 4-40
3 x Standoff, Metal 4-40, 3/8 inches
1 x Adafruit Perma-Proto Quarter-sized Breadboard PCB
1 x Bakelite Perfboard
1 x Hamburger Mini Speaker
1 x ABS Plastic Multi-Purpose Enclosures
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

DL2106Mk05p.ino

// ***** Don Luc Electronics © *****
// Software Version Information
// Project #16: Sound - Music Acoustics - Mk18
// 06-05
// DL2106Mk05.ino 16-18
// 1 x Arduino Pro Mini 328 - 5V/16MHz
// 2 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
// 2 x Battery Holder - 2 x AAA
// 4 x Alkaline Battery - AAA
// 1 x JST Jumper 2 Wire Assembly
// 19 x Wire Solid Core - 22 AWG
// 8 x Screw, 1/4 inches, 4-40
// 8 x Nut, Nylon Locknut, 4-40
// 3 x Standoff, Metal 4-40, 3/8 inches
// 1 x Adafruit Perma-Proto Quarter-sized Breadboard PCB
// 1 x Bakelite Perfboard
// 1 x Hamburger Mini Speaker
// 1 x ABS Plastic Multi-Purpose Enclosures
// 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 <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-18";

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 – 2021 English & Español
https://www.jlpconsultants.com/CV/LucPaquinCVEngMk2021c.pdf
https://www.jlpconsultants.com/CV/LucPaquinCVEspMk2021c.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

Leave a Reply

Your email address will not be published. Required fields are marked *

Categories
Archives