title: Programming in C midi
body: <p>My code is as follows:</p>
  
  <pre><code>    #include &lt;conio.h&gt;
      #include &lt;stdio.h&gt;
      #include &lt;stdlib.h&gt;
  
      int natural_minor_scale [8] = {0, 2, 3, 5, 7, 8, 10, 12};  /* The Natural Minor scale we will be using in the code*/
      int harmonic_minor_scale [8] = {0, 2, 3, 5, 7, 8, 11, 12}; /* The Harmonic Minor scale we will be using in the code*/
      int major_scale [8] = {0, 2, 4, 5, 7, 9, 11, 12};          /* The Major scale we will be using in the code*/
      int scale(void);
      int key(void);
      void welcome_screen(void);
  
      struct musical_choice                                      /* Building of a structure taken from lecture notes 6.Structures */
  {                                                          /* from http://www.elec.york.ac.uk/internal_web//meng/yr1/modules/Maths_and_Programming/CProgramming/c-lecture6.pdf */
      int decision;
      int scale;
      int key;
  
      };
      struct musical_choice choice;            /*We will use a structure to get information easier here */
  
      int main(void)
      {
      welcome_screen(); /* Open the Console and display the first message, so as to introduce the program to the user and to wish the user a nice day*/
      scanf("%i", &amp;choice.decision);
       while(choice.decision!=1 &amp;&amp; choice.decision!=2){ /* To choose between just 1 and 2 */
  
           printf("\nPlease, select one of the options offered above.\n");
           scanf("%i", &amp;choice.decision);
      }
      if (choice.decision==1){
      scale();
      key();
      printf("I will now play what you wish");
      playing(choice.scale, choice.key);
      }
      else if (choice.decision==2){
      choice.scale=random_number(1, 3);
      choice.key=random_number(1, 3);
      }
      return 0;
      }
  
  
      void (welcome_screen())  /* This is the function for the welcoming screen */
        {
        printf("Welcome to this new piece of software. \nIt will help you decide what you want me, your Software Guitarist, to play. \nHave a nice day!\nFor me to play based on your desires, press 1.\nIf you would like me to prove my talent and improvise, press 2\n");
        }
  
  
  
      int scale(void)          /* Receive input for which scale you want to have played */
      {
      printf("\nPress a number to choose whether you want me to play in:\nThe Major Scale, which requires you to press 1;\nThe Natural Minor scale, which requires you to press 2;\nThe Harmonic Minor scale, which requires you to press 3;\n");
      scanf("%i", &amp;choice.scale);
      while(choice.scale != 1 &amp;&amp; choice.scale != 2 &amp;&amp; choice.scale != 3){          /* This command makes it so that you can't choose a letter or a number higher than 3 or lower than 1 */
          printf("\nPlease, pick a number between 1 and 3.\n");
          scanf("%i", &amp;choice.scale);
  
          }
           return choice.scale;
      }
      int key(void)          /* Receive input for which key you want to have played */
      {
          printf("\nNow choose between the music being played in\nThe key of A for which you press 1 \nThe key of C for which you press 2 \nThe key of E for which you press 3.\n");
      scanf("%i", &amp;choice.key);
      while(choice.key != 1 &amp;&amp; choice.key !=2 &amp;&amp; choice.key !=3){
          printf("\nPlease, pick a number between 1 and 3.\n");
          scanf("%i", &amp;choice.key);
  
          }
          return choice.key;
  }
  
      int playing (scale, key){
      int key_note;
      int scale_chosen;
  
      int velocity = random_number (60-110);
      if (choice.scale=1){
      scale_chosen=major_scale;}
      else if (choice.scale=2){
      scale_chosen=natural_minor_scale;}
      else if (choice.scale=3){
      scale_chosen=harmonic_minor_scale;}
      if (choice.key=1){
      key_note=57;}
      else if (choice.key=2){
      key_note=60;}
      else if (choice.key=3){
      key_note=64;}
  
      do{
      midi_note(key_note+scale_chosen, 26, velocity); }
  
      while (kbhit()==0);
      return 0;
  }
  </code></pre>
  
  <p>Everything seems to be working regarding the choice of options I have set up, however no midi notes are playing.</p>
  
  <p>Where may I be making a mistake? I sincerely apologize if it's something really silly, as I haven't still slept and this is really tiring for me now.</p>
  
  <p>Thank you all for your time!</p>