Advertisement
Guest User

scale generator

a guest
Feb 21st, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. function skala
  2.  
  3. A={'Ionisk','Dorisk','Frygisk','Lydisk','Mixolydisk','Aeolisk','Lokrisk'}; %%Vector with every mode
  4. B={'W-W-H-W-W-W-H','W-H-W-W-W-H-W','H-W-W-W-H-W-W','W-W-W-H-W-W-H','W-W-H-W-W-H-W'...
  5. ,'W-H-W-W-H-W-W','H-W-W-H-W-W-W'}; %%Steps in scale, W - whole steps, H - half steps
  6. C={'PI','PM','PA','IM','IA','MA','PIM','IMA','AMIM'}; %%Fingering
  7. D={'C ' 'C♯' 'D ' 'D♯' 'E ' 'F ' 'F♯' 'G ' 'G♯' 'A ' 'A♯' 'H ' ... %%Two chromatic octaves, used to
  8. 'C ' 'C♯' 'D ' 'D♯' 'E ' 'F ' 'F♯' 'G ' 'G♯' 'A ' 'A♯' 'H '}; %%supply keynotes
  9.  
  10. a=length(A);
  11. b=length(B);
  12. c=length(C);
  13. d=12; %%Problem 1
  14. x=randi([1,a]); %%Gives random keynote, fingering, and scale with exact
  15. y=randi([1,b]); %%notes
  16. z=randi([1,d]);
  17.  
  18.  
  19. n=z;
  20. %%algorithm(?) for modes
  21. S1 = D([n n+2 n+4 n+5 n+7 n+9 n+11]); %%Ionisk
  22. S2 = D([n n+2 n+3 n+5 n+7 n+9 n+10]); %%Dorisk
  23. S3 = D([n n+1 n+3 n+5 n+7 n+8 n+10]); %%Frygisk
  24. S4 = D([n n+2 n+4 n+6 n+7 n+9 n+11]); %%Lydisk
  25. S5 = D([n n+2 n+4 n+5 n+7 n+9 n+10]); %%Mixolydisk
  26. S6 = D([n n+2 n+3 n+5 n+7 n+8 n+10]); %%Aeolisk
  27. S7 = D([n n+1 n+3 n+5 n+6 n+8 n+10]); %%Lokrisk
  28.  
  29. S={S1,S2,S3,S4,S5,S6,S7}; %%cell array of every mode
  30. str = [S{x}];
  31. X = [D(z) C(y) A(x) B(x)];
  32. H=string(str);
  33. G=string(X);
  34. fprintf('%s \n', G{:});
  35. fprintf('%s ', H);
  36. fprintf('\n');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement