Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Ionian Scales

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Tue Jun 30, 2009 11:58 pm    Post subject: Ionian Scales Reply with quote

I was bored and haven't coded in like 3 months so i decided to wake up and code a small app. It calculates the frequencies of a major scale based on the formula
Code:
CalcFreq(hs, key) pow(1.059460646483, hs)*key

Where hs is the halfsteps from A and key is the current scale (12 notes in the musical alphabet).

I might make a program that does all the modes (7 of them) and all the notes (12) just for kicks.

If you're into music theory like i am then you may find it interesting.

Well wtf i can't attach rars anymore. Fuck you cheat engine forums.



Code:
#include <windows.h>
#include <cmath>
#include <stdio.h>
#define CalcFreq(hs, key) pow(1.059460646483, hs)*key
int main()
{
   int major[8] = {0,2,4,5,7,9,10,12};
   double key[12] = {110, 116.54, 123.47, 130.81, 138.59, 146.83, 155.56, 164.81, 174.61, 185, 196, 207.65};
   printf("Starting Ionian (major) scales\n");
   for(int k = 0; k<=11; k++)
   {
      printf("key[%i]\n", k+1);
      for(int i = 0; i <=7; i++)
      {
         printf("Freq: %lf\n", CalcFreq(major[i], key[k]));
         Beep(CalcFreq(major[i],key[k]),500);
      }
      for(int i = 7; i>=0; i--)
      {
         printf("Freq: %lf\n", CalcFreq(major[i], key[k]));
         Beep(CalcFreq(major[i],key[k]),500);
      }
      for(int i = 0; i<=7; i+=2)
      {
         printf("Freq: %lf\n", CalcFreq(major[i], key[k]));
         Beep(CalcFreq(major[i],key[k]),500);
      }
      printf("Freq: %lf\n", CalcFreq(major[7], key[k]));
      Beep(CalcFreq(major[7],key[k]),500);
      for(int i = 6; i>=0; i-=2)
      {
         printf("Freq: %lf\n", CalcFreq(major[i], key[k]));
         Beep(CalcFreq(major[i],key[k]),500);
      }
      Sleep(500);
   }
   Sleep(10000);
   return 0;
}

It will run up the scale and play the tonic twice, then will play the chord with the tonic.

Compile that in VS and run. Should work in any compiler.

_________________
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites