Piano: Difference between revisions

From wikiluntti
No edit summary
Line 1: Line 1:
== Piano ==
== The Piano ==


Sonic Pi plays all piano keys. The command <code>play 70</code> means the 70th key, <code>play 71</code> plays the next to the right. Sonic Pi plays also decimal notes, try <code>play 71.67</code>. Also, you can play multiple notes at the time:
Sonic Pi plays all piano keys. The command <code>play 70</code> means the 70th key, <code>play 71</code> plays the next to the right. Sonic Pi plays also decimal notes, try <code>play 71.67</code>. Also, you can play multiple notes at the time:
Line 27: Line 27:
The notes <code>C, D, E, F, G, A, B</code> are available. Also, the black keys are there; use <code>s</code> as ''sharp'' or <code>b</code> as ''flat''.  
The notes <code>C, D, E, F, G, A, B</code> are available. Also, the black keys are there; use <code>s</code> as ''sharp'' or <code>b</code> as ''flat''.  


<syntaxhighlight >
play :C
sleep 0.5
play :D
sleep 0.5
play :E
</syntaxhighlight >
The different octaves are available as numbers, try <code>play :C3</code> or <code>play :Fs3</code>.
[[File:Klaviatur-3-en.svg|thumb|https://upload.wikimedia.org/wikipedia/commons/c/c0/Klaviatur-3-en.svg]]
== Chords ==


Chords are usually written on top of the charts.


The different octaves are available as
[[File:Soinnut.svg|thumb]]


[[File:Klaviatur-3-en.svg|thumb|https://upload.wikimedia.org/wikipedia/commons/c/c0/Klaviatur-3-en.svg]]
<syntaxhighlight >
play chord(:D, :minor7)
sleep 1
play chord(:D, :major7)
sleep 1
play chord(:D, "7")
sleep 1
play chord(:Db, "7")
sleep 1
play chord(:Db, :major7)
sleep 1
 
play chord(:E3, :minor)
sleep 1
play chord(:E3, :major)
sleep 1
play chord(:E, "7")
sleep 1
play chord(:G, :minor7)
sleep 1
play chord(:A, :major)
sleep 1
play chord(:G, "m7-5")
</syntaxhighlight >
 
Also, you can type the chord in once: <code>play_chord [:c4, :e4, :g4]</code>.

Revision as of 16:56, 12 October 2020

The Piano

Sonic Pi plays all piano keys. The command play 70 means the 70th key, play 71 plays the next to the right. Sonic Pi plays also decimal notes, try play 71.67. Also, you can play multiple notes at the time:

play 72
play 75
play 79


Melody

Use sleep command in between.

s  = 0.5
play 72
sleep s
play 75
sleep s
play 79


Notes

The notes C, D, E, F, G, A, B are available. Also, the black keys are there; use s as sharp or b as flat.

play :C
sleep 0.5
play :D
sleep 0.5
play :E

The different octaves are available as numbers, try play :C3 or play :Fs3.

https://upload.wikimedia.org/wikipedia/commons/c/c0/Klaviatur-3-en.svg


Chords

Chords are usually written on top of the charts.

play chord(:D, :minor7)
sleep 1
play chord(:D, :major7)
sleep 1
play chord(:D, "7")
sleep 1
play chord(:Db, "7")
sleep 1
play chord(:Db, :major7)
sleep 1

play chord(:E3, :minor)
sleep 1
play chord(:E3, :major)
sleep 1
play chord(:E, "7")
sleep 1
play chord(:G, :minor7)
sleep 1
play chord(:A, :major)
sleep 1
play chord(:G, "m7-5")

Also, you can type the chord in once: play_chord [:c4, :e4, :g4].