打楽器の中には音程を持たない楽器があります。
皆さんは、楽譜の一番初めのところにある、
このような記号を見たことがあるのではないのでしょうか?
(wikipediaより)
これはト音記号とヘ音記号です。それと同じく、パーカッション記号というものがあります!
それをp5.jsで再現してみました!
function setup() {
createCanvas(400, 400);
}
function draw() {
background(255);
drawscore();
}
function drawscore(){
score_one_line(10,50,380);
}
function score_one_line(sx,sy,n){
strokeWeight(2);
for(let j = 0; j < 3; j++){
per_sym(sx,sy + j * 130,n);
strokeWeight(2);
stroke(0,0,0,50)
line(sx,sy + 30 + j * 130,sx + n,sy + 30 + j * 130);
}
}
function per_sym(sx,sy){
stroke(0,0,0,255)
strokeWeight(2)
line(sx+20,sy+17,sx+20,sy + 43);
line(sx+30,sy+17,sx+30,sy + 43);
}
drawscore 楽譜を描く
score_one_line 楽譜の線を日宇
per_sym パーカッション記号を描く
次は4分音符などの音符の再現をしようと思います!