Message Boards Message Boards

[WSRP24] Generating sheet music for a provided melody

Posted 4 months ago

A photo of a grand staff

POSTED BY: Benjamin Sandler
2 Replies
Posted 3 months ago

Thank you for sharing, Benjamin.

In version 14.1 I got some issues with the "staff" function:

staff[clef_]:=ImageCompose[Graphics[Text[Style[clef,20],{1.4,.5}],PlotRange->{{1,20},{-2,2}}],Graphics[Table[Line[{{1,i},{20,i}}],{i,0,1,0.25}],ImageSize->1000,PlotRange->{{1,20},{-2,2}}]]

If I use the treble clef with the staff function I get this: enter image description here

So I rewrote the function with Show instead of ImageCompose; this will create crisp graphics instead of a bitmap. Also I visually resized the size of the treble clef to ensure the curl goes through G4.

staff[clef_] := 
 Show[Graphics[Text[Style[clef, 65], {1.4, .5}], 
   PlotRange -> {{1, 20}, {-2, 2}}], 
  Graphics[Table[Line[{{1, i}, {20, i}}], {i, 0, 1, 0.25}], 
   PlotRange -> {{0, 20}, {-2, 2}}], ImageSize -> 800]

enter image description here

Hope this is helpful.

POSTED BY: Dave Middleton

enter image description here -- you have earned Featured Contributor Badge enter image description here Your exceptional post has been selected for our editorial column Staff Picks http://wolfr.am/StaffPicks and Your Profile is now distinguished by a Featured Contributor Badge and is displayed on the Featured Contributor Board. Thank you!

POSTED BY: EDITORIAL BOARD
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract