Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 22nd, 2024, 12:54 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Musical tool - variable question
PostPosted: November 23rd, 2018, 5:01 pm 
Offline

Joined: November 23rd, 2018, 10:52 am
Posts: 7
Hi everyone,

I want to create a little key-finder tool that shows possible key scales when single notes are chosen.


E.g.:
- user chooses notes "c, a, h and e"
- opus pro highlights all possible key scales containing all of these notes


I thought of defining 12 variables (one for each minor key scale) containing the correspondending notes.

Then I thought of some kind of "pool" where all the user choosen notes are placed in.

Thirdly I need to tell opus pro to compare the pool with each variable and highlight all the variables containing all of the choosen notes.

Maybe that would work but I don't have the slightest idea how to set this up :(

Would be great if anyone of you could help me with the programming/variable part :-/


Best, Johannes


For this message joe84 has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: Musical tool - variable question
PostPosted: November 23rd, 2018, 6:01 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Opus Pro Executable or Opus Pro HTML5?

</mack>

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject: Re: Musical tool - variable question
PostPosted: November 23rd, 2018, 6:33 pm 
Offline

Joined: November 23rd, 2018, 10:52 am
Posts: 7
Opus Pro Executable


For this message joe84 has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: Musical tool - variable question
PostPosted: November 25th, 2018, 9:38 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
The following should be a start:

Code:
myNotes = "A,C,F#";
myScale = "E,F#,G,A,B,C,D,E";

myScaleFound = searchScale(myNotes,myScale); //Returns True if found and False if not.

function searchScale(notes,scale){

var matches = 0;
var notesArray = notes.split(",");
var scalesArray = scale.split(",");

for (var n = 0; n < notesArray.length; n++){
    for (var s = 0; s < scale.length; s++){
        if(notesArray[n] == scalesArray[s]) {
            matches++;
            break;
        }
    }
}

if (matches == notesArray.length) {
    return true;
} else {
    return false;
}


}


</mack>

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject: Re: Musical tool - variable question
PostPosted: November 27th, 2018, 1:58 pm 
Offline

Joined: November 23rd, 2018, 10:52 am
Posts: 7
Hi Mack,

thank you very much for your answer, I do not know how and where to add the code :-(

Here's the project as it is at the moment:
https://drive.google.com/open?id=1Sr7p5 ... aus3bNxQNQ

Would "myNotes" be the pool where all highlighted choosen notes are placed in? How do I program that?

And then I would need (for 12 different scales) 12 "myScale1",... ?
And all of them would be compared to "myNotes" and highlighted if "myNotes" are in the scales?


Thank you for your help and sorry for so many questions :-/


Best, Johannes


For this message joe84 has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: Musical tool - variable question
PostPosted: November 28th, 2018, 11:31 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Here's a working example:

link: https://www.interaktiv.co.uk/?section=files
code: piano-scales@digitalgrapevine.info

</mack>

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject: Re: Musical tool - variable question
PostPosted: November 28th, 2018, 12:49 pm 
Offline

Joined: November 23rd, 2018, 10:52 am
Posts: 7
Hi Mack,

thank you for the example file. That helps a lot! :-D


For this message joe84 has been thanked by : mackavi


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 29 guests


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 post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group