0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

楽譜を描画したい! part1 [パーカッション(打楽器)]

Posted at

打楽器の中には音程を持たない楽器があります。
皆さんは、楽譜の一番初めのところにある、
このような記号を見たことがあるのではないのでしょうか?
Music-GClef.svg.png
Music-Fclef.svg.png
(wikipediaより)

これはト音記号とヘ音記号です。それと同じく、パーカッション記号というものがあります!

image.pngというような記号です。

それを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分音符などの音符の再現をしようと思います!

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?