Arduino - Negaraku 1-bit Rendition

Based on Project 7 of Arduino Starter Kit, I was able to create a Negaraku melody using predefined set of note pitches.

Source code

// Negaraku Melody

int melody[] = {  
  NOTE_D7, NOTE_D7, NOTE_F6, NOTE_A6, 0,
  NOTE_A6, NOTE_A6, NOTE_C6, NOTE_E6, NOTE_F6, NOTE_AS6, NOTE_A6, NOTE_G6, 0,
  NOTE_C7, NOTE_AS6, NOTE_GS6, NOTE_FS6, 0,
  NOTE_E6, NOTE_DS6, NOTE_B5, NOTE_C6, NOTE_D6, NOTE_DS6, 0,
  NOTE_B6, NOTE_A6, NOTE_G6, NOTE_F6, 0,
  NOTE_A6, NOTE_G6, NOTE_A6, NOTE_G6, NOTE_F6, NOTE_E6, 0,
  NOTE_D7, NOTE_B6, NOTE_G6, NOTE_A6, 0,
  NOTE_C7, NOTE_A6, NOTE_AS6, NOTE_B6, NOTE_D7, NOTE_E7 
};

int beats[]  = {  
  64, 64, 64, 128, 16,
  64, 64, 64, 64, 64, 108, 32, 128, 16,
  64, 64, 64, 128, 16,
  64, 64, 64, 108, 32, 138, 16,
  64, 64, 64, 128, 16,
  64, 108, 32, 64, 64, 128, 16,
  64, 64, 64, 128, 16,
  64, 64, 64, 108, 32, 148

};

char* lyrics[] = {  
  "ne", "ga", "ra", "ku", "\n",
  "ta", "nah ", "tum", "pah", "nya ", "da", "rah", "ku", "\n",
  "rak", "yat ", "hi", "dup", "\n",
  "ber", "sa", "tu ", "dan ", "ma", "ju ", "\n",
  "rah", "mat ", "bah", "gia", "\n",
  "tu", "han ", "kur", "ni", "a", "kan", "\n",
  "ra", "ja ", "ki", "ta", "\n",
  "se", "la", "mat ", "ber", "takh", "ta"
};

Demo video

Aiman Baharum

More about this blog https://github.com/aimanbaharum/random-wiki/wiki

Kuala Lumpur, Malaysia http://www.aimanbaharum.com

Subscribe to Knowledge Log

Get the latest posts delivered right to your inbox.

or subscribe via RSS with Feedly!