Play the whole song in G major

Hi all :slight_smile:

is it possible to set the whole melody to a different key such as G Major? I think it’s called the key signature.

I was looking for something like use_key: G maj as in the sense of use_synth and use_bpm.

Isn’t this a pretty common use case? Maybe I am overlooking something and there is a different way to achieve that. :relieved:

Greetings,
Valerian

Hi there how about use_transpose.

Ah I see. I could write everything in C Major and transpose the whole song.

Sounds like a good option. :slight_smile:
The only annoying thing about this is, I’ll need to transpose my original notes to C Major, then.

But, thanks for your help, it should be relatively easy. :slight_smile:

hi @dnst

i don’t think use_transpose will be the solution

It’s more complicated.

a = (scale :c, :major)
a_duration = (ring 1)*8

define :foo do | n , d, trans |
  l= d.length
  l.times do
    tick
    use_transpose trans
    synth :piano, note: n.look, decay: 1
    sleep d.look
  end  
end

in_thread do
  foo a, a_duration, 0
end
in_thread do
  foo a, a_duration, 5
end
in_thread do
  foo a, a_duration, -12
end

Edit : this text below is absolutely wrong :slight_smile: - so yes use_transpose is the way.

you see or better you hear that your :c major scale has become an :d minor scale. And i guess you want a D major scale.
So you have to work with intervalls.
I remember some threads about that on this forum, so use the search (magnifying glass) button (“loupe” in french not loop :slight_smile: )
Cheers

Hi @nlb, I think you are mistaken. I tried running your code and it plays a :c major scale followed by a :d major scale. Transposing a major scale should always give you another major scale because you are not modifying the steps between the notes.

1 Like

oh yes indeed !
i heard a f not sharp but actually it’s a f sharp
Thank you for pointing out my mistake !

So it’s cool !

1 Like

You don’t have to. You can use your original key as an offset in relation to C, assuming this has a value of 0. Here’s an example.

sc = (ring :C4, :D4, :G4) # a phrase in C

play_pattern sc, 0.5 #play in C
use_transpose -2 #transpose down to Bb
play_pattern sc, 0.5
use_transpose 5  #transpose up to F
play_pattern sc, 0.5
use_transpose -4  #transpose down to Ab
play_pattern sc, 0.5

sc = (ring :F4, :G4, :C5) # same phrase but now in F

play_pattern sc, 0.5 #play in F
use_transpose -2 #transpose down to Eb
play_pattern sc, 0.5
use_transpose 5  #transpose up to Bb
play_pattern sc, 0.5
use_transpose -4  #transpose down to Db
play_pattern sc, 0.5

The first half of the code is in C and transposed around.
The next half the phrase is written in F but the same transpositions are used as for the previous example.

Hope that helps.