{"id":3173,"date":"2022-09-10T06:45:51","date_gmt":"2022-09-10T13:45:51","guid":{"rendered":"https:\/\/www.donluc.com\/?p=3173"},"modified":"2022-09-10T06:45:51","modified_gmt":"2022-09-10T13:45:51","slug":"project-22-synthesizer-wave-mk13","status":"publish","type":"post","link":"https:\/\/www.donluc.com\/?p=3173","title":{"rendered":"Project #22: Synthesizer &#8211; Wave &#8211; Mk13"},"content":{"rendered":"<div style=\"width: 720px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-3173-1\" width=\"720\" height=\"480\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/09\/DL2208Mk06W.mp4?_=1\" \/><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/09\/DL2208Mk06W.mp4\">https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/09\/DL2208Mk06W.mp4<\/a><\/video><\/div>\n<p>&#8212;&#8212;<\/p>\n<p>DonLucElectronics #DonLuc #Synthesizer #Mozzi #Keyboard #ADSREnvelope #Oscillators #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\/09\/DL2208Mk06a.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/09\/DL2208Mk06a.png\" alt=\"Wave\" width=\"720\" height=\"579\" class=\"alignnone size-full wp-image-3175\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/09\/DL2208Mk06a.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/09\/DL2208Mk06a-300x241.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\/09\/DL2208Mk06b.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/09\/DL2208Mk06b.png\" alt=\"Wave\" width=\"720\" height=\"480\" class=\"alignnone size-full wp-image-3176\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/09\/DL2208Mk06b.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/09\/DL2208Mk06b-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\/09\/DL2208Mk06c.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/09\/DL2208Mk06c.png\" alt=\"Wave\" width=\"720\" height=\"480\" class=\"alignnone size-full wp-image-3177\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/09\/DL2208Mk06c.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/09\/DL2208Mk06c-300x200.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p>&#8212;&#8212;<\/p>\n<p><strong>Sine Wave and Cosine Wave<\/strong><\/p>\n<p>A sine wave is a mathematical curve defined in terms of the sine trigonometric function. It is a type of continuous wave and also a smooth periodic function. It occurs often in mathematics, as well as in physics, engineering, signal processing and many other fields.<\/p>\n<p>The term sinusoid describes any wave with characteristics of a sine wave. Thus, a cosine wave is also said to be sinusoidal, which is also a sine wave with a phase-shift. Because of this head start, it is often said that the cosine function leads the sine function or the sine lags the cosine. The term sinusoidal thereby collectively refers to both sine waves and cosine waves with any phase offset.<\/p>\n<p><strong>Sawtooth Wave<\/strong><\/p>\n<p>The sawtooth wave is a kind of non-sinusoidal waveform. It is so named based on its resemblance to the teeth of a plain toothed saw with a zero rake angle. A single sawtooth, or an intermittently triggered sawtooth, is called a ramp waveform.<\/p>\n<p><strong>Triangle Wave<\/strong><\/p>\n<p>A triangle wave is a non-sinusoidal waveform named for its triangular shape. It is a periodic, piecewise linear, continuous real function.<\/p>\n<p><strong>Square Wave<\/strong><\/p>\n<p>A square wave is a non-sinusoidal periodic waveform in which the amplitude alternates at a steady frequency between fixed minimum and maximum values, with the same duration at minimum and maximum. In an ideal square wave, the transitions between minimum and maximum are instantaneous.<\/p>\n<p><strong>DL2208Mk06<\/strong><\/p>\n<p>1 x SparkFun RedBoard<br \/>\n1 x 10k Ohm Rotary Potentiometer<br \/>\n1 x Potentiometer Knob &#8211; Blue<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 \/>\nPO5 &#8211; Analog A5<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>DL2208Mk06p.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 - Wave - Mk13\r\n22-13\r\nDL2208Mk06p.ino\r\n1 x SparkFun RedBoard\r\n1 x 10k Ohm Rotary Potentiometer\r\n1 x Potentiometer Knob - Blue\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\/\/ Cosine Wave Table For Oscillator\r\n#include &lt;tables\/cos2048_int8.h&gt;\r\n\/\/ Sawtooth Wave Table For Oscillator\r\n#include &lt;tables\/saw2048_int8.h&gt;\r\n\/\/ Triangle Wave Table For Oscillator\r\n#include &lt;tables\/triangle2048_int8.h&gt;\r\n\/\/ Square Wave Table For Oscillator\r\n#include &lt;tables\/square_no_alias_2048_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 2\r\nconst int potFreq = A2;\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 iPot4 = A4;\r\n\r\n\/\/Oscillator Functions declared for output envelope 1\r\n\/\/ Carrier\r\nOscil&lt;COS2048_NUM_CELLS, AUDIO_RATE&gt; aCarrier;\r\n\/\/ Set the input for the potentiometer for Oscillator to analog pin 4\r\nconst int potWave = A5;\r\n\/\/ Wave\r\nint iWave;\r\nint iWaveLevel;\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\/\/ Set the input for the potentiometer Attack Time to analog pin 3\r\nconst int potAttackTime = A3;\r\n\/\/ Attack Time\r\nint AttackTime_level = 0;\r\nint iAttackTime = 0;\r\n\r\n\/\/ Software Version Information\r\nString sver = &quot;22-13&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  \/\/ Oscillators\r\n  isOscil();\r\n  \/\/ Choose envelope levels\r\n  \/\/ attack_level\r\n  iAttack = mozziAnalogRead( potAttack );\r\n  attack_level = map( iAttack, 0, 1023, 100, 400);\r\n  \/\/ Attack Level\r\n  envelope1.setAttackLevel( attack_level );\r\n  \/\/ decay_level\r\n  iDecay = mozziAnalogRead( potDecay );\r\n  decay_level = map( iDecay, 0, 1023, 50, 255);\r\n  \/\/ Decay Level\r\n  envelope1.setDecayLevel( decay_level );\r\n  \/\/ AttackTime_level\r\n  iAttackTime = mozziAnalogRead( potAttackTime );\r\n  AttackTime_level = map( iAttackTime, 0, 1023, 0, 900);\r\n  \/\/ Attack Time Level\r\n  envelope1.setAttackTime( AttackTime_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    aCarrier.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    aCarrier.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    aCarrier.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    aCarrier.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    aCarrier.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    aCarrier.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    aCarrier.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    aCarrier.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    aCarrier.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    aCarrier.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    aCarrier.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    aCarrier.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() * aCarrier.next())&gt;&gt;8;\r\n\r\n}\r\n<\/pre>\n<p><strong>getOscillators.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ Oscillators\r\n\/\/ isOscil\r\nvoid isOscil(){\r\n  \r\n  \/\/ Oscillators\r\n  \/\/ Value is 0-1023\r\n  iWave = mozziAnalogRead(potWave);\r\n  iWaveLevel = map(iWave, 0, 1023, 1, 5);\r\n\r\n  switch (iWaveLevel) {\r\n    case 1:\r\n      \/\/ Sine Wave\r\n      aCarrier.setTable(SIN2048_DATA);\r\n      break;\r\n    case 2:\r\n      \/\/ Cosine Wave\r\n      aCarrier.setTable(COS2048_DATA);\r\n      break;\r\n    case 3:\r\n      \/\/ Sawtooth Wave\r\n      aCarrier.setTable(SAW2048_DATA);\r\n      break;\r\n    case 4:\r\n      \/\/ Triangle Wave\r\n      aCarrier.setTable(TRIANGLE2048_DATA);\r\n      break;\r\n    case 5:\r\n      \/\/ Square Wave\r\n      aCarrier.setTable(SQUARE_NO_ALIAS_2048_DATA);\r\n      break;\r\n    default: \/\/ Case 0\r\n      \/\/ Sine Wave\r\n      aCarrier.setTable(SIN2048_DATA);\r\n      break;\r\n  }\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, 2, 6);\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(200);\r\n  \/\/ Sustain Time setting for envelope1\r\n  envelope1.setSustainTime(52500);\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 #Oscillators #Arduino #SparkFunRedBoard #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant &#8212;&#8212; &#8212;&#8212; &#8212;&#8212; &#8212;&#8212; Sine Wave and Cosine Wave A sine wave is a mathematical curve defined in terms of the sine trigonometric function. It is a type of continuous wave and also a smooth periodic function. It occurs &#8230; <a title=\"Project #22: Synthesizer &#8211; Wave &#8211; Mk13\" class=\"read-more\" href=\"https:\/\/www.donluc.com\/?p=3173\" aria-label=\"Read more about Project #22: Synthesizer &#8211; Wave &#8211; Mk13\">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,38,59,5,7,58,10,43,51],"tags":[6,102,4,19,85,24,25,234,9,27,109,8,127,34,233],"class_list":["post-3173","post","type-post","status-publish","format-standard","hentry","category-synthesizer","category-arduino","category-digitalelectronics","category-fritzing","category-microcontrollers","category-musical-instruments","category-arduino-programming","category-projects","category-sparkfun","category-synth","tag-arduino","tag-components","tag-consultant","tag-electronics","tag-fritzing","tag-microcontroller","tag-musical-instruments-2","tag-oscillators","tag-programming","tag-projects-2","tag-sparkfun","tag-synth","tag-synthesizer","tag-video-blog","tag-wave"],"_links":{"self":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/3173","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=3173"}],"version-history":[{"count":1,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/3173\/revisions"}],"predecessor-version":[{"id":3178,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/3173\/revisions\/3178"}],"wp:attachment":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3173"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3173"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3173"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}