0

I'm trying to build a website that is essentially a database of alternate tunings for the 6 string guitar. The first thing I really wanted to do was get a list of tunings put together.

My constants:

1.) six strings

2.) lowest note possible is a perfect 4th down from standard tuning (low e becomes a b, a string becomes an e, d string becomes a g, etc).

3.) the upper note (for now) is a major third above standard tuning (low e become a g#, a string becomes c#, d string becomes f#, etc).

4.) that means each string has a range of 10 possible notes, some of which will over lap (ex, between the low e and a string: e, f, f#, g, g#)

so given that information, I am trying to construct a list of ALL possible permutations.

I've tried using python's itertools, but my laptop is not handling the computation very well. So I thought maybe java would have some built-ins that would be more useful.

Can anyone help me? I am a pretty amateur coder, so any help would be great.

Thanks

edit: here is my code so far:

import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;
import java.util.Iterator;

public class TuningList{
   public static void main(String[] args){

   List<String> string6 = Arrays.asList("B1", "C2", "C#2/Db2", "D2", "D#2/Eb2", "E2", "F2", "F#2/Gb2", "G2", "G#2/Ab2");
  List<String> string5 = Arrays.asList("E2", "F2", "F#2/Gb2", "G2", "G#2/Ab2", "A2", "A#2/Bb2", "B2", "C3", "C#3/Db3");
  List<String> string4 = Arrays.asList("A2", "A#2/Bb2", "B2", "C3", "C#3/Db3", "D3", "D#3/Eb3", "E3", "F3", "F#3/Gb3");
  List<String> string3 = Arrays.asList("D3", "D#3/Eb3", "E3", "F3", "F#3/Gb3", "G3", "G#3/Ab3", "A3", "A#3/Bb3", "B3");
  List<String> string2 = Arrays.asList("F#3/Gb3", "G3", "G#3/Ab3", "A3", "A#3/Bb3", "B3", "C4", "C#4/Db4", "D4", "D#4/Eb4");
  List<String> string1 = Arrays.asList("B3", "C4", "C#4/Db4", "D4", "D#4/Eb4", "E4", "F4", "F#4/Gb4", "G4", "G#4/Ab4");
}
Joshua Lee
  • 31
  • 3
  • 2
    All possible permutations? That's asking for a lot of dissonance. – Hovercraft Full Of Eels May 30 '17 at 02:54
  • 1
    "construct a list of ALL possible permutations" is a common newbie trap. It's rarely a good idea to go through all possible permutations of anything, and in the cases where you'd actually want to do that, it's almost always better to generate the permutations on demand than to construct the whole list up front. – user2357112 May 30 '17 at 03:03
  • "All possible permutations? That's asking for a lot of dissonance" yes i know! thats kind of the point haha! "a common newbie trap" i dont doubt it. but is it possible? – Joshua Lee May 30 '17 at 03:28
  • there are questions similar you can read about [here](https://stackoverflow.com/questions/2710713/algorithm-to-generate-all-possible-permutations-of-a-list) and [here](https://stackoverflow.com/questions/1506078/fast-permutation-number-permutation-mapping-algorithms/1506337#1506337). They should give you an understanding to start. – Bill F May 30 '17 at 03:35

1 Answers1

0

If I correctly understand you want to shift standard tuning from -4 tones to +3 tones.

Here is a Javascript example.

$ cat /tmp/strings.js

var notes = [ 'a', 'a#', 'b', 'c', 'c#', 'd', 'd#', 'e', 'f', 'f#', 'g', 'g#' ];
var standardTuning = [ 'e', 'b', 'g', 'd', 'a', 'e' ];

for ( var i = -7; i < 5; i++ )  {
  var shiftedTuning = [];

  standardTuning.forEach( function (e) {
    var idx = notes.indexOf( e );
    idx = (notes.length +  idx + i ) % notes.length;
    shiftedTuning.push( notes [idx ]);
  })
  console.log(shiftedTuning);
}

$ node /tmp/strings.js

[ 'a', 'e', 'c', 'g', 'd', 'a' ]
[ 'a#', 'f', 'c#', 'g#', 'd#', 'a#' ]
[ 'b', 'f#', 'd', 'a', 'e', 'b' ]
[ 'c', 'g', 'd#', 'a#', 'f', 'c' ]
[ 'c#', 'g#', 'e', 'b', 'f#', 'c#' ]
[ 'd', 'a', 'f', 'c', 'g', 'd' ]
[ 'd#', 'a#', 'f#', 'c#', 'g#', 'd#' ]
[ 'e', 'b', 'g', 'd', 'a', 'e' ]
[ 'f', 'c', 'g#', 'd#', 'a#', 'f' ]
[ 'f#', 'c#', 'a', 'e', 'b', 'f#' ]
[ 'g', 'd', 'a#', 'f', 'c', 'g' ]
[ 'g#', 'd#', 'b', 'f#', 'c#', 'g#' ]