{"id":3152,"date":"2022-08-20T05:58:10","date_gmt":"2022-08-20T12:58:10","guid":{"rendered":"https:\/\/www.donluc.com\/?p=3152"},"modified":"2022-08-20T05:58:10","modified_gmt":"2022-08-20T12:58:10","slug":"project-22-synthesizer-adsr-envelope-mk10","status":"publish","type":"post","link":"https:\/\/www.donluc.com\/?p=3152","title":{"rendered":"Project #22: Synthesizer &#8211; ADSR Envelope &#8211; Mk10"},"content":{"rendered":"<div style=\"width: 720px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-3152-1\" width=\"720\" height=\"480\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/08\/DL2208Mk03W.mp4?_=1\" \/><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/08\/DL2208Mk03W.mp4\">https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/08\/DL2208Mk03W.mp4<\/a><\/video><\/div>\n<p>&#8212;&#8212;<\/p>\n<p>#DonLucElectronics #DonLuc #Synthesizer #Mozzi #Keyboard #ADSREnvelope #Arduino #SparkFunRedBoard #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant<\/p>\n<p>&#8212;&#8212;<\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/08\/DL2208Mk03a.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/08\/DL2208Mk03a.png\" alt=\"ADSR Envelope\" width=\"720\" height=\"556\" class=\"alignnone size-full wp-image-3154\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/08\/DL2208Mk03a.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/08\/DL2208Mk03a-300x232.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p>&#8212;&#8212;<\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/08\/DL2208Mk03b.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/08\/DL2208Mk03b.png\" alt=\"ADSR Envelope\" width=\"720\" height=\"480\" class=\"alignnone size-full wp-image-3155\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/08\/DL2208Mk03b.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/08\/DL2208Mk03b-300x200.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p>&#8212;&#8212;<\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/08\/DL2208Mk03c.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/08\/DL2208Mk03c.png\" alt=\"ADSR Envelope\" width=\"720\" height=\"480\" class=\"alignnone size-full wp-image-3156\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/08\/DL2208Mk03c.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/08\/DL2208Mk03c-300x200.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p>&#8212;&#8212;<\/p>\n<p><strong>What Is an Envelope in Music?<\/strong><\/p>\n<p>An envelope is a term used to describe the evolution of a sound in a piece of music. Envelopes are fed through an envelope generator, the component within an analog synthesizer that signals when and how a sound should change. The envelope defines the trajectory and modulation of a sound, while the envelope generator controls the behavior of the envelope.<\/p>\n<p><strong>What Is an ADSR Envelope?<\/strong><\/p>\n<p>An ADSR envelope is a type of envelope control mechanism commonly found in the synthesizer and samplers used in electronic music. ADSR stands for the envelope&#8217;s four stages of modulation: attack, decay, sustain, and release. These stages control the level of the sound from the moment you press a key or advance a music sequencer.<\/p>\n<p>In sound design, ADSR envelopes are typically used to control the loudness of a sound. ADSR envelopes typically produce a sound that takes the shape of a waveform rising in the attack stage, slightly declining during the decay stage, plateauing during the sustain stage, and finally falling at the return stage.<\/p>\n<p><strong>DL2208Mk03<\/strong><\/p>\n<p>1 x SparkFun RedBoard<br \/>\n7 x Momentary Button &#8211; Panel Mount (Blue)<br \/>\n5 x Momentary Button &#8211; Panel Mount (Black)<br \/>\n12 x 10K Ohm Resistor<br \/>\n5 x 10k Ohm Slide Linear Taper Pot &#8211; X-Large<br \/>\n5 x Slide Potentiometer Knob &#8211; X-Large<br \/>\n1 x Perfboard 13.5 cm x 11 cm<br \/>\n1 x SparkFun Solderable Breadboard<br \/>\n1 x Audio Jack 3.5mm<br \/>\n1 x SparkFun Audio Jack Breakout<br \/>\n1 x SparkFun ProtoShield<br \/>\n1 x Insignia Speakers<br \/>\n1 x SparkFun Cerberus USB Cable<\/p>\n<p><strong>SparkFun RedBoard<\/strong><\/p>\n<p>LP0 &#8211; Analog A0 &#8211; Blue<br \/>\nLP1 &#8211; Analog A1 &#8211; Green<br \/>\nLP2 &#8211; Analog A2 &#8211; Grey<br \/>\nLP3 &#8211; Analog A3 &#8211; Yellow<br \/>\nLP4 &#8211; Analog A4 &#8211; Purple<br \/>\nKY1 &#8211; 1<br \/>\nKY2 &#8211; 2<br \/>\nKY3 &#8211; 3<br \/>\nKY4 &#8211; 4<br \/>\nKY5 &#8211; 5<br \/>\nKY6 &#8211; 6<br \/>\nKY7 &#8211; 7<br \/>\nKY8 &#8211; 8<br \/>\nSPK &#8211; 9<br \/>\nKY10 &#8211; 10<br \/>\nKY11 &#8211; 11<br \/>\nKY12 &#8211; 12<br \/>\nKY13 &#8211; 13<br \/>\nVIN &#8211; +5V<br \/>\nGND &#8211; GND<\/p>\n<p>&#8212;&#8212;<\/p>\n<p><strong>DL2208Mk03p.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/* ***** Don Luc Electronics \u00a9 *****\r\nSoftware Version Information\r\nProject #22: Synthesizer - ADSR Envelope - Mk10\r\n22-10\r\nDL2208Mk03p.ino\r\n1 x SparkFun RedBoard\r\n7 x Momentary Button - Panel Mount (Blue)\r\n5 x Momentary Button - Panel Mount (Black)\r\n12 x 1K Ohm Resistor\r\n5 x 10k Ohm Slide Linear Taper Pot - X-Large\r\n5 x Slide Potentiometer Knob - X-Large\r\n1 x Perfboard 13.5 cm x 11 cm\r\n1 x SparkFun Solderable Breadboard\r\n1 x Audio Jack 3.5mm\r\n1 x SparkFun Audio Jack Breakout\r\n1 x SparkFun ProtoShield\r\n1 x Insignia Speakers\r\n1 x SparkFun Cerberus USB Cable\r\n*\/\r\n\r\n\/\/ Include the Library Code\r\n\/\/ Pitches\r\n#include &quot;pitches.h&quot;\r\n\/\/ Mozzi\r\n#include &lt;MozziGuts.h&gt;\r\n\/\/ Oscillator\r\n#include &lt;Oscil.h&gt;\r\n\/\/ Sine Wave Table For Oscillator\r\n#include &lt;tables\/sin2048_int8.h&gt;\r\n\/\/ ADSR envelope generator\r\n#include &lt;ADSR.h&gt;\r\n\r\n\/\/ Simple Keyboard\r\n\/\/ Minimum reading of the button that generates a note\r\nconst int iKeyboard1 = 1;\r\nconst int iKeyboard2 = 2;\r\nconst int iKeyboard3 = 3;\r\nconst int iKeyboard4 = 4;\r\nconst int iKeyboard5 = 5;\r\nconst int iKeyboard6 = 6;\r\nconst int iKeyboard7 = 7;\r\nconst int iKeyboard8 = 8;\r\nconst int iKeyboard10 = 10;\r\nconst int iKeyboard11 = 11;\r\nconst int iKeyboard12 = 12;\r\nconst int iKeyboard13 = 13;\r\n\/\/ Button is pressed\r\nint iB1 = 1;\r\nint iB2 = 1;\r\nint iB3 = 1;\r\nint iB4 = 1;\r\nint iB5 = 1;\r\nint iB6 = 1;\r\nint iB7 = 1;\r\nint iB8 = 1;\r\nint iB10 = 1;\r\nint iB11 = 1;\r\nint iB12 = 1;\r\nint iB13 = 1;\r\n\r\n\/\/ Set the input for the potentiometer for Frequency to analog pin 3\r\n\/\/const int potFreq = A3;\r\nint iFreg = 1;\r\nint iNoteA = 0;\r\nint iNoteAS = 0;\r\nint iNoteB = 0;\r\nint iNoteC = 0;\r\nint iNoteCS = 0;\r\nint iNoteD = 0;\r\nint iNoteDS = 0;\r\nint iNoteE = 0;\r\nint iNoteF = 0;\r\nint iNoteFS = 0;\r\nint iNoteG = 0;\r\nint iNoteGS = 0;\r\n\r\n\/\/ Potentiometer\r\nint iPot2 = A2;\r\nint iPot3 = A3;\r\nint iPot4 = A4;\r\n\r\n\/\/Oscillator Functions declared for output envelope 1 \r\n\/\/ Sine Wave\r\nOscil &lt;2048, AUDIO_RATE&gt; aSin1(SIN2048_DATA);\r\n\r\n\/\/ ADSR declaration\/definition\r\n\/\/ Comment out to use control rate of 128\r\n#define CONTROL_RATE 128\r\nADSR &lt;CONTROL_RATE, CONTROL_RATE&gt; envelope1;\r\n\r\n\/\/ Set the input for the potentiometer Attack to analog pin 1\r\nconst int potAttack = A0;\r\n\/\/ Attack\r\nint attack_level = 0;\r\nint iAttack = 0;\r\n\r\n\/\/ Set the input for the potentiometer for Decay to analog pin 2\r\nconst int potDecay = A1;\r\n\/\/ Decay\r\nint decay_level = 0;\r\nint iDecay = 0;\r\n\r\n\/\/ Software Version Information\r\nString sver = &quot;22-10&quot;;\r\n\r\nvoid loop() {\r\n\r\n  \/\/ Audio Hook\r\n  audioHook();\r\n  \r\n}\r\n<\/pre>\n<p><strong>getKeyboard.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ getKeyboard\r\n\/\/ setupKeyboard\r\nvoid setupKeyboard() {\r\n\r\n  \/\/ Initialize the button pin as an input\r\n  pinMode(iKeyboard1, INPUT_PULLUP);\r\n  pinMode(iKeyboard2, INPUT_PULLUP);\r\n  pinMode(iKeyboard3, INPUT_PULLUP);\r\n  pinMode(iKeyboard4, INPUT_PULLUP);\r\n  pinMode(iKeyboard5, INPUT_PULLUP);\r\n  pinMode(iKeyboard6, INPUT_PULLUP);\r\n  pinMode(iKeyboard7, INPUT_PULLUP);\r\n  pinMode(iKeyboard8, INPUT_PULLUP);\r\n  pinMode(iKeyboard10, INPUT_PULLUP);\r\n  pinMode(iKeyboard11, INPUT_PULLUP);\r\n  pinMode(iKeyboard12, INPUT_PULLUP);\r\n  pinMode(iKeyboard13, INPUT_PULLUP);\r\n \r\n}\r\n\/\/ isKeyboard\r\nvoid isKeyboard() {\r\n\r\n  \/\/ Choose envelope levels\r\n  \/\/ attack_level\r\n  iAttack = mozziAnalogRead( potAttack );\r\n  attack_level = map( iAttack, 0, 1023, 0, 255);\r\n  \/\/ decay_level\r\n  iDecay = mozziAnalogRead( potDecay );\r\n  decay_level = map( iDecay, 0, 1023, 0, 255);\r\n  \/\/ set AD Levels\r\n  envelope1.setADLevels(attack_level,decay_level);\r\n\r\n  \/\/ Read the state of the button value 1\r\n  if ( digitalRead(iKeyboard1) == HIGH ) {\r\n\r\n    \/\/ Button is pressed - pullup keeps pin high normally 1\r\n    iB1 = iB1 + 1;\r\n    \/\/ ADSR declaration\/definition\r\n    envelope1.noteOn();\r\n    aSin1.setFreq(iNoteA);\r\n\r\n  }\r\n  else\r\n  {\r\n    \r\n    iB1 = iB1 - 1;\r\n\r\n  }\r\n\r\n  \/\/ Read the state of the button value 2\r\n  if ( digitalRead(iKeyboard2) == HIGH ) {\r\n\r\n    \/\/ Button is pressed - pullup keeps pin high normally 2\r\n    iB2 = iB2 + 1;\r\n    \/\/ ADSR declaration\/definition\r\n    envelope1.noteOn();\r\n    aSin1.setFreq(iNoteAS);\r\n\r\n  }\r\n  else\r\n  {\r\n    \r\n    iB2 = iB2 - 1;\r\n \r\n  }\r\n\r\n  \/\/ Read the state of the button value 3\r\n  if ( digitalRead(iKeyboard3) == HIGH ) {\r\n\r\n    \/\/ Button is pressed - pullup keeps pin high normally 3\r\n    iB3 = iB3 + 1;\r\n    \/\/ ADSR declaration\/definition\r\n    envelope1.noteOn();\r\n    aSin1.setFreq(iNoteB);\r\n\r\n  }\r\n  else\r\n  {\r\n    \r\n    iB3 = iB3 - 1;\r\n \r\n  }\r\n\r\n  \/\/ Read the state of the button value 4\r\n  if ( digitalRead(iKeyboard4) == HIGH ) {\r\n\r\n    \/\/ Button is pressed - pullup keeps pin high normally 4\r\n    iB4 = iB4 + 1;\r\n    \/\/ ADSR declaration\/definition\r\n    envelope1.noteOn();\r\n    aSin1.setFreq(iNoteC);\r\n\r\n  }\r\n  else\r\n  {\r\n    \r\n    iB4 = iB4 - 1;\r\n \r\n  }\r\n\r\n  \/\/ Read the state of the button value 5\r\n  if ( digitalRead(iKeyboard5) == HIGH ) {\r\n\r\n    \/\/ Button is pressed - pullup keeps pin high normally 5\r\n    iB5 = iB5 + 1;\r\n    \/\/ ADSR declaration\/definition\r\n    envelope1.noteOn();\r\n    aSin1.setFreq(iNoteCS);\r\n\r\n  }\r\n  else\r\n  {\r\n    \r\n    iB5 = iB5 - 1;\r\n \r\n  }\r\n\r\n  \/\/ Read the state of the button value 6\r\n  if ( digitalRead(iKeyboard6) == HIGH ) {\r\n\r\n    \/\/ Button is pressed - pullup keeps pin high normally 6\r\n    iB6 = iB6 + 1;\r\n    \/\/ ADSR declaration\/definition\r\n    envelope1.noteOn();\r\n    aSin1.setFreq(iNoteD);\r\n\r\n  }\r\n  else\r\n  {\r\n    \r\n    iB6 = iB6 - 1;\r\n\r\n  }\r\n\r\n  \/\/ Read the state of the button value 7\r\n  if ( digitalRead(iKeyboard7) == HIGH ) {\r\n\r\n    \/\/ Button is pressed - pullup keeps pin high normally 7\r\n    iB7 = iB7 + 1;\r\n    \/\/ ADSR declaration\/definition\r\n    envelope1.noteOn();\r\n    aSin1.setFreq(iNoteDS);\r\n\r\n  }\r\n  else\r\n  {\r\n    \r\n    iB7 = iB7 - 1;\r\n \r\n  }\r\n\r\n  \/\/ Read the state of the button value 8\r\n  if ( digitalRead(iKeyboard8) == HIGH ) {\r\n\r\n    \/\/ Button is pressed - pullup keeps pin high normally 8\r\n    iB8 = iB8 + 1;\r\n    \/\/ ADSR declaration\/definition\r\n    envelope1.noteOn();\r\n    aSin1.setFreq(iNoteE);\r\n\r\n  }\r\n  else\r\n  {\r\n    \r\n    iB8 = iB8 - 1;\r\n\r\n  }\r\n\r\n  \/\/ Read the state of the button value 10\r\n  if ( digitalRead(iKeyboard10) == HIGH ) {\r\n\r\n    \/\/ Button is pressed - pullup keeps pin high normally 10\r\n    iB10 = iB10 + 1;\r\n    \/\/ ADSR declaration\/definition\r\n    envelope1.noteOn();\r\n    aSin1.setFreq(iNoteF);\r\n\r\n  }\r\n  else\r\n  {\r\n    \r\n    iB10 = iB10 - 1;\r\n\r\n  }\r\n\r\n  \/\/ Read the state of the button value 11\r\n  if ( digitalRead(iKeyboard11) == HIGH ) {\r\n\r\n    \/\/ Button is pressed - pullup keeps pin high normally 11\r\n    iB11 = iB11 + 1;\r\n    \/\/ ADSR declaration\/definition\r\n    envelope1.noteOn();\r\n    aSin1.setFreq(iNoteFS);\r\n\r\n  }\r\n  else\r\n  {\r\n    \r\n    iB11 = iB11 - 1;\r\n \r\n  }\r\n\r\n  \/\/ Read the state of the button value 12\r\n  if ( digitalRead(iKeyboard12) == HIGH ) {\r\n\r\n    \/\/ Button is pressed - pullup keeps pin high normally 12\r\n    iB12 = iB12 + 1;\r\n    \/\/ ADSR declaration\/definition\r\n    envelope1.noteOn();\r\n    aSin1.setFreq(iNoteG);\r\n\r\n  }\r\n  else\r\n  {\r\n    \r\n    iB12 = iB12 - 1;\r\n    \r\n  }\r\n\r\n  \/\/ Read the state of the button value 13\r\n  if ( digitalRead(iKeyboard13) == HIGH ) {\r\n\r\n    \/\/ Button is pressed - pullup keeps pin high normally 13\r\n    iB13 = iB13 + 1;\r\n    \/\/ ADSR declaration\/definition\r\n    envelope1.noteOn();\r\n    aSin1.setFreq(iNoteGS);\r\n\r\n  }\r\n  else\r\n  {\r\n    \r\n    iB13 = iB13 - 1;\r\n\r\n  }\r\n\r\n}\r\n<\/pre>\n<p><strong>getMozzi.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ Mozzi\r\n\/\/ Update Control\r\nvoid updateControl(){\r\n\r\n  \/\/ Frequency\r\n  isPitches();\r\n  \r\n  \/\/ Keyboard\r\n  isKeyboard();\r\n\r\n}\r\n\/\/ Update Audio\r\nint updateAudio()\r\n{\r\n\r\n  \/\/ Update Audio\r\n  \/\/ ADSR declaration\/definition\r\n  envelope1.update();\r\n  \/\/ &gt;&gt;8 for AUDIO_MODE STANDARD\r\n  return (int) (envelope1.next() * aSin1.next())&gt;&gt;8;\r\n\r\n}\r\n<\/pre>\n<p><strong>getPitches.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ Pitches\r\n\/\/ isPitches\r\nvoid isPitches(){\r\n  \r\n  \/\/ Frequency\r\n  \/\/ Value is 0-1023\r\n  \/\/iFreg = mozziAnalogRead(potFreq);\r\n  \/\/iFreg = map(iFreg, 0, 1023, 3, 6);\r\n  iFreg = 5;\r\n\r\n  \/\/ Range Frequency Note Low =&gt; High\r\n  switch ( iFreg ) {\r\n    case 1:\r\n      \/\/ NOTE A1\r\n      iNoteA = NOTE_A1;\r\n      iNoteAS = NOTE_AS1;\r\n      iNoteB = NOTE_B1;\r\n      iNoteC = NOTE_C2;\r\n      iNoteCS = NOTE_CS2;\r\n      iNoteD = NOTE_D2;\r\n      iNoteDS = NOTE_DS2;\r\n      iNoteE = NOTE_E2;\r\n      iNoteF = NOTE_F2;\r\n      iNoteFS = NOTE_FS2;\r\n      iNoteG = NOTE_G2;\r\n      iNoteGS = NOTE_GS2;\r\n      break;\r\n    case 2:\r\n      \/\/ NOTE A2\r\n      iNoteA = NOTE_A2;\r\n      iNoteAS = NOTE_AS2;\r\n      iNoteB = NOTE_B2;\r\n      iNoteC = NOTE_C3;\r\n      iNoteCS = NOTE_CS3;\r\n      iNoteD = NOTE_D3;\r\n      iNoteDS = NOTE_DS3;\r\n      iNoteE = NOTE_E3;\r\n      iNoteF = NOTE_F3;\r\n      iNoteFS = NOTE_FS3;\r\n      iNoteG = NOTE_G3;\r\n      iNoteGS = NOTE_GS3;\r\n      break;\r\n    case 3:\r\n      \/\/ NOTE A3\r\n      iNoteA = NOTE_A3;\r\n      iNoteAS = NOTE_AS3;\r\n      iNoteB = NOTE_B3;\r\n      iNoteC = NOTE_C4;\r\n      iNoteD = NOTE_D4;\r\n      iNoteDS = NOTE_DS4;\r\n      iNoteE = NOTE_E4;\r\n      iNoteF = NOTE_F4;\r\n      iNoteFS = NOTE_FS4;\r\n      iNoteG = NOTE_G4;\r\n      iNoteGS = NOTE_GS4;\r\n      break;\r\n    case 4:\r\n      \/\/ NOTE A4\r\n      iNoteA = NOTE_A4;\r\n      iNoteAS = NOTE_AS4;\r\n      iNoteB = NOTE_B4;\r\n      iNoteC = NOTE_C5;\r\n      iNoteCS = NOTE_CS5;\r\n      iNoteD = NOTE_D5;\r\n      iNoteE = NOTE_E5;\r\n      iNoteF = NOTE_F5;\r\n      iNoteFS = NOTE_FS5;\r\n      iNoteG = NOTE_G5;\r\n      iNoteGS = NOTE_GS5;\r\n      break;\r\n    case 5:\r\n      \/\/ NOTE A5\r\n      iNoteA = NOTE_A5;\r\n      iNoteAS = NOTE_AS5;\r\n      iNoteB = NOTE_B5;\r\n      iNoteC = NOTE_C6;\r\n      iNoteCS = NOTE_CS6;\r\n      iNoteD = NOTE_D6;\r\n      iNoteDS = NOTE_DS6;\r\n      iNoteE = NOTE_E6;\r\n      iNoteF = NOTE_F6;\r\n      iNoteFS = NOTE_FS6;\r\n      iNoteG = NOTE_G6;\r\n      iNoteGS = NOTE_GS6;\r\n      break;\r\n    case 6:\r\n      \/\/ NOTE A6\r\n      iNoteA = NOTE_A6;\r\n      iNoteAS = NOTE_AS6;\r\n      iNoteB = NOTE_B6;\r\n      iNoteC = NOTE_C7;\r\n      iNoteCS = NOTE_CS7;\r\n      iNoteD = NOTE_D7;\r\n      iNoteDS = NOTE_DS7;\r\n      iNoteE = NOTE_E7;\r\n      iNoteF = NOTE_F7;\r\n      iNoteFS = NOTE_FS7;\r\n      iNoteG = NOTE_G7;\r\n      iNoteGS = NOTE_GS7;\r\n      break;\r\n  }\r\n  \r\n}\r\n<\/pre>\n<p><strong>pitches.h<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/*****************************************************************\r\n * Pitches NOTE_B0 &lt;=&gt; NOTE_DS8 - NOTE_A4 is &quot;A&quot; measured at 440Hz\r\n *****************************************************************\/\r\n\r\n#define NOTE_B0  31\r\n#define NOTE_C1  33\r\n#define NOTE_CS1  35\r\n#define NOTE_D1  37\r\n#define NOTE_DS1  39\r\n#define NOTE_E1  41\r\n#define NOTE_F1  44\r\n#define NOTE_FS1  46\r\n#define NOTE_G1  49\r\n#define NOTE_GS1  52\r\n#define NOTE_A1  55\r\n#define NOTE_AS1  58\r\n#define NOTE_B1  62\r\n#define NOTE_C2  65\r\n#define NOTE_CS2  69\r\n#define NOTE_D2  73\r\n#define NOTE_DS2  78\r\n#define NOTE_E2  82\r\n#define NOTE_F2  87\r\n#define NOTE_FS2  93\r\n#define NOTE_G2  98\r\n#define NOTE_GS2  104\r\n#define NOTE_A2  110\r\n#define NOTE_AS2  117\r\n#define NOTE_B2  123\r\n#define NOTE_C3  131\r\n#define NOTE_CS3  139\r\n#define NOTE_D3  147\r\n#define NOTE_DS3  156\r\n#define NOTE_E3  165\r\n#define NOTE_F3  175\r\n#define NOTE_FS3 185\r\n#define NOTE_G3  196\r\n#define NOTE_GS3  208\r\n#define NOTE_A3  220\r\n#define NOTE_AS3  233\r\n#define NOTE_B3  247\r\n#define NOTE_C4  262\r\n#define NOTE_CS4  277\r\n#define NOTE_D4  294\r\n#define NOTE_DS4 311\r\n#define NOTE_E4  330\r\n#define NOTE_F4  349\r\n#define NOTE_FS4  370\r\n#define NOTE_G4  392\r\n#define NOTE_GS4  415\r\n#define NOTE_A4  440\r\n#define NOTE_AS4  466\r\n#define NOTE_B4  494\r\n#define NOTE_C5  523\r\n#define NOTE_CS5  554\r\n#define NOTE_D5  587\r\n#define NOTE_DS5  622\r\n#define NOTE_E5  659\r\n#define NOTE_F5  698\r\n#define NOTE_FS5  740\r\n#define NOTE_G5  784\r\n#define NOTE_GS5  831\r\n#define NOTE_A5  880\r\n#define NOTE_AS5  932\r\n#define NOTE_B5  988\r\n#define NOTE_C6  1047\r\n#define NOTE_CS6  1109\r\n#define NOTE_D6  1175\r\n#define NOTE_DS6  1245\r\n#define NOTE_E6  1319\r\n#define NOTE_F6  1397\r\n#define NOTE_FS6  1480\r\n#define NOTE_G6  1568\r\n#define NOTE_GS6  1661\r\n#define NOTE_A6  1760\r\n#define NOTE_AS6  1865\r\n#define NOTE_B6  1976\r\n#define NOTE_C7  2093\r\n#define NOTE_CS7  2217\r\n#define NOTE_D7  2349\r\n#define NOTE_DS7  2489\r\n#define NOTE_E7  2637\r\n#define NOTE_F7  2794\r\n#define NOTE_FS7  2960\r\n#define NOTE_G7  3136\r\n#define NOTE_GS7  3322\r\n#define NOTE_A7  3520\r\n#define NOTE_AS7  3729\r\n#define NOTE_B7  3951\r\n#define NOTE_C8  4186\r\n#define NOTE_CS8  4435\r\n#define NOTE_D8  4699\r\n#define NOTE_DS8  4978\r\n<\/pre>\n<p><strong>setup.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ Setup\r\nvoid setup() {\r\n\r\n  \/\/ Setup Keyboard\r\n  setupKeyboard();\r\n\r\n  \/\/ Mozzi Start\r\n  startMozzi( CONTROL_RATE );\r\n  \/\/ Sets Attack and Decay Levels; assumes Sustain, Decay, and Idle times\r\n  envelope1.setADLevels(200,200);\r\n  \/\/ Sets Decay time in milliseconds\r\n  envelope1.setDecayTime(100);\r\n  \/\/ Sustain Time setting for envelope1\r\n  envelope1.setSustainTime(32500);\r\n\r\n}\r\n<\/pre>\n<p>&#8212;&#8212;<\/p>\n<p><strong>People can contact us:<\/strong> https:\/\/www.donluc.com\/?page_id=1927<\/p>\n<p><strong>Technology Experience<\/strong><\/p>\n<ul>\n<li>Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc&#8230;)<\/li>\n<li>IoT<\/li>\n<li>Robotics<\/li>\n<li>Camera and Video Capture Receiver Stationary, Wheel\/Tank and Underwater Vehicle<\/li>\n<li>Unmanned Vehicles Terrestrial and Marine<\/li>\n<li>Research &#038; Development (R &#038; D)<\/li>\n<\/ul>\n<p><strong>Instructor and E-Mentor<\/strong><\/p>\n<ul>\n<li>IoT<\/li>\n<li>PIC Microcontrollers<\/li>\n<li>Arduino<\/li>\n<li>Raspberry Pi<\/li>\n<li>Espressif<\/li>\n<li>Robotics<\/li>\n<\/ul>\n<p><strong>Follow Us<\/strong><\/p>\n<p><strong>J. Luc Paquin \u2013 Curriculum Vitae &#8211; 2022 English &#038; Espa\u00f1ol<\/strong><br \/>\nhttps:\/\/www.jlpconsultants.com\/luc\/<\/p>\n<p><strong>Web:<\/strong> https:\/\/www.donluc.com\/<br \/>\n<strong>Web:<\/strong> https:\/\/www.jlpconsultants.com\/<br \/>\n<strong>Facebook:<\/strong> https:\/\/www.facebook.com\/neosteam.labs.9\/<br \/>\n<strong>YouTube:<\/strong> https:\/\/www.youtube.com\/channel\/UC5eRjrGn1CqkkGfZy0jxEdA<br \/>\n<strong>Twitter:<\/strong> https:\/\/twitter.com\/labs_steam<br \/>\n<strong>Pinterest:<\/strong> https:\/\/www.pinterest.com\/NeoSteamLabs\/<br \/>\n<strong>Instagram:<\/strong> https:\/\/www.instagram.com\/neosteamlabs\/<\/p>\n<p><strong>Don Luc<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8212;&#8212; #DonLucElectronics #DonLuc #Synthesizer #Mozzi #Keyboard #ADSREnvelope #Arduino #SparkFunRedBoard #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant &#8212;&#8212; &#8212;&#8212; &#8212;&#8212; &#8212;&#8212; What Is an Envelope in Music? An envelope is a term used to describe the evolution of a sound in a piece of music. Envelopes are fed through an envelope generator, the component within an analog &#8230; <a title=\"Project #22: Synthesizer &#8211; ADSR Envelope &#8211; Mk10\" class=\"read-more\" href=\"https:\/\/www.donluc.com\/?p=3152\" aria-label=\"Read more about Project #22: Synthesizer &#8211; ADSR Envelope &#8211; Mk10\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[205,50,49,38,59,5,7,58,10,43,57,51],"tags":[230,6,102,4,19,85,24,25,9,27,109,8,127,33,34],"class_list":["post-3152","post","type-post","status-publish","format-standard","hentry","category-synthesizer","category-arduino","category-consultant","category-digitalelectronics","category-fritzing","category-microcontrollers","category-musical-instruments","category-arduino-programming","category-projects","category-sparkfun","category-steren","category-synth","tag-adsr-envelope","tag-arduino","tag-components","tag-consultant","tag-electronics","tag-fritzing","tag-microcontroller","tag-musical-instruments-2","tag-programming","tag-projects-2","tag-sparkfun","tag-synth","tag-synthesizer","tag-technology","tag-video-blog"],"_links":{"self":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/3152","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3152"}],"version-history":[{"count":2,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/3152\/revisions"}],"predecessor-version":[{"id":3468,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/3152\/revisions\/3468"}],"wp:attachment":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3152"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3152"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3152"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}