Click here to Skip to main content
Click here to Skip to main content

PSAM Control Library

By , 24 Jun 2010
 

Introduction

PSAM Control Library is a WinForms library containing the IncipitViewer control for drawing musical notes which can be read from MusicXml file or added programmatically. The library was initially a component of larger software Polish System for Archivising Music (http://www.archiwistykamuzyczna.pl/?lang=en) but I thought it could be useful for other software developers, so I decided to distribute it under BSD licence. PSAM Control Library is written in C# under Microsoft Visual Studio Express.

The following screen illustrates the use of many IncipitViewer controls in a manuscript database application:

psam.jpg

PSAM Control Library official website is available at http://www.archiwistykamuzyczna.pl/index.php?article=download&lang=en#psamcontrollibrary.

Using the Code

IncipitViewer control requires a special font to draw notes and other musical symbols. You can create your own font or use the included font Polihymnia which is based on Ben Laenen's Euterpe font and distributed under Sil Open Font Licence. Of course you have to install the font in your fonts directory to display notes properly.

The simplest way to add IncipitViewer control to your project is to drag and drop the PSAMControlLibrary.dll file to your Toolbox and then drag and drop the IncipitViewer control to your form. You can also create an IncipitViewer control programmatically, for example:

IncipitViewer viewer = new IncipitViewer();
viewer.Dock = DockStyle.Fill;
Controls.Add(viewer);  

Remember to add using PSAMControlLibrary; directive to your code.

To read music from MusicXml file use LoadFromXmlFile(string fileName) method and as an argument, type the path of the XML file that you wish to open. Remember that only the first stave is supported - other staves will be skipped.

viewer.LoadFromXmlFile("example.xml"); 

The effect of the above code should look like that:

incipitviewerxml.png

To clear the staff, use the ClearMusicalIncipit() method:

viewer.ClearMusicalIncipit(); 

We can also add notes and musical symbols programmatically. First we will add the G clef on line 2:

Clef c = new Clef(ClefType.GClef, 2);
viewer.AddMusicalSymbol(c); 

Then we will add a new quarter note G:

  Note n = new Note("G", 0, 4, MusicalSymbolDuration.Quarter, 
	NoteStemDirection.Up, NoteTieType.None, 
	new List<NoteBeamType>() {NoteBeamType.Single});
  viewer.AddMusicalSymbol(n); 

The first argument of Note constructor is a string representing one of the following names of steps: A, B, C, D, E, F, G. The second argument is number of sharps (positive number) or flats (negative number) where 0 means no alteration. The third argument is the number of an octave. The next arguments are: duration of the note, stem direction and type of tie (NoteTieType.None if the note is not tied). The last argument is a list of beams. If the note doesn't have any beams, it must still have that list with just one element NoteBeamType.Single (even if duration of the note is greater than eighth). To make it clear how beamlists work, let's try to add a group of two beamed sixteenths and eighth:

Note s1 = new Note("A", 0, 4, MusicalSymbolDuration.Sixteenth, 
		NoteStemDirection.Down, NoteTieType.None,
                	new List<NoteBeamType>() { NoteBeamType.Start, NoteBeamType.Start});
Note s2 = new Note("C", 1, 5, MusicalSymbolDuration.Sixteenth, 
		NoteStemDirection.Down, NoteTieType.None,
                	new List<NoteBeamType>() { NoteBeamType.Continue, NoteBeamType.End });
Note e = new Note("D", 0, 5, MusicalSymbolDuration.Eighth, 
		NoteStemDirection.Down, NoteTieType.None,
                	new List<NoteBeamType>() { NoteBeamType.End });
viewer.AddMusicalSymbol(s1);
viewer.AddMusicalSymbol(s2);
viewer.AddMusicalSymbol(e); 

The results should look like this:

incipitviewerbeams.png

And this is how the above example looks when all beams are set to NoteBeamType.Single:

incipitviewerbeamssingle.png

You can draw colored notes and musical symbols simply by changing their MusicalCharacterColor property:

colourfulnotes.png

Although IncipitViewer does not support multiple staves, it supports chords because they are part of many monophonic instruments' idiom. If IsChordElement property of a note is set to true, a note is treated as a chord element of the preceding note:

Note n1 = new Note("C", 0, 4, MusicalSymbolDuration.Half, 
		NoteStemDirection.Up, NoteTieType.None,
                	new List<NoteBeamType>() { NoteBeamType.Single });
Note n2 = new Note("E", 0, 4, MusicalSymbolDuration.Half, 
		NoteStemDirection.Up, NoteTieType.None,
                	new List<NoteBeamType>() { NoteBeamType.Single });
Note n3 = new Note("G", 0, 4, MusicalSymbolDuration.Half, 
		NoteStemDirection.Up, NoteTieType.None,
                	new List<NoteBeamType>() { NoteBeamType.Single });
n2.IsChordElement = true;
n3.IsChordElement = true;

viewer.AddMusicalSymbol(n1);
viewer.AddMusicalSymbol(n2);
viewer.AddMusicalSymbol(n3); 

Result:

examplechords.png

The following example shows how to insert dots, rests and barlines:

 Note n4 = new Note("A", 0, 4, MusicalSymbolDuration.Half, 
	NoteStemDirection.Up, NoteTieType.None,
                new List<NoteBeamType>() { NoteBeamType.Single });
            n4.NumberOfDots = 1;
            
            Rest r = new Rest(MusicalSymbolDuration.Quarter);
            Barline b = new Barline();

            viewer.AddMusicalSymbol(n4);
            viewer.AddMusicalSymbol(r);
            viewer.AddMusicalSymbol(b); 

Result:

exampledotrestbarline.png

When the mouse is over the control, two buttons appear in the upper right corner: the first saves the MusicXml file associated with the control and the second invokes OnPlayExternalMidiPlayer event handler. You can subscribe PlayExternalMidiPlayer event:

viewer.PlayExternalMidiPlayer += 
	new IncipitViewer.PlayExternalMidiPlayerDelegate(viewer_PlayExternalMidiPlayer);

Create the following function for handling the event:

void viewer_PlayExternalMidiPlayer(IncipitViewer sender)
{
    //Place your code here
} 

In the above function, you can place a code to read notes from the control and use your own functions or another library to play them. To access the desired musical symbol from the control, use IncipitViewer.IncipitElement(int i) method where i is the index of the element. To convert a note to midi pitch, you can use a MusicalSymbol.ToMidiPitch (string step, int alter, int octave) method.

To print the content of IncipitViewer control, create a PrintDocument object and subscribe its PrintPage event:

private void printDocument1_PrintPage(object sender, 
	System.Drawing.Printing.PrintPageEventArgs e)
{
    Graphics g = e.Graphics;
    viewer.DrawViewer(g, true);
} 

Then print the document using the Print() method:

PrintDialog dlg = new PrintDialog();
dlg.Document = printDocument1;
if (dlg.ShowDialog() == DialogResult.OK)
{
     printDocument1.Print();
} 

Sample printout:

sample_print.png

Points of Interest

A curious thing connected with graphic layout of the score is the problem of determining the proper length of stems under beams. In 17th and 18th century printed music stems of equal length were very often in use which consequence was "breaking" of beams. Scores looked something like that:

gibbons.png

In contemporary music engraving however, beams must be straight. Unfortunately straight beams lead to variable length of stems and the proper length of stems must be determined programmatically. The following image demonstrates all values which we need to accomplish this:

stem_example.png

To determine the location of stem ending, we must find out the length of segment y1, which is a vertical distance between the stem ending of the last note in group and the stem ending of the note which interests us. Because:

 tg alpha = y<sub>1</sub>/x<sub>1</sub> 

then:

y<sub>1</sub> = x<sub>1</sub> * tg alpha  

Value of tg alpha is the ratio of the vertical distance between the stem endings of the first and last note in group and the horizontal distance between the stem endings of the first and last note in group (we assume that we know both values):

tg alpha = y / x

So:

y<sub>1</sub> = x<sub>1</sub> * (y / x) 

y1 is the vertical coordinate of the point of stem ending of the note that interests us.

History

In version 2.1.0.2, I added colored notes and made some changes in IncipitViewer class in order to allow porting this library to WPF. A WPF version of this library is available HERE.

License

This article, along with any associated source code and files, is licensed under The BSD License

About the Author

Ajcek84

Poland Poland
I graduated from Adam Mickiewicz University in Poznań where I completed a MA degree in computer science (MA thesis: Analysis of Sound of Viola da Gamba and Human Voice and an Attempt of Comparison of Their Timbres Using Various Techniques of Digital Signal Analysis) and a bachelor degree in musicology (BA thesis: Continuity and Transitions in European Music Theory Illustrated by the Example of 3rd part of Zarlino's Institutioni Harmoniche and Bernhard's Tractatus Compositionis Augmentatus). I also graduated from a solo singing class in Fryderyk Chopin Musical School in Poznań. I'm a self-taught composer and a member of informal international group Vox Saeculorum, gathering composers, which common goal is to revive the old (mainly baroque) styles and composing traditions in contemporary written music. I'm the annual participant of International Summer School of Early Music in Lidzbark Warmiński.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralMy vote of 5memberwmjordan21-Apr-13 15:07 
I don't use this control but I love music. It is great!
Questionwhat font must install ?memberenochenoch2k29-Nov-11 15:55 
i cannot display note ok. i do not konw ,what font must install.
 
who can tell me , thank you very much !
AnswerRe: what font must install ?memberAjcek8429-Nov-11 21:14 
"use the included font Polihymnia" :P
GeneralRe: what font must install ?memberenochenoch2k30-Nov-11 2:17 
that is ok! thank u very much! and another question:how delete a note from staff?
QuestionWonderful Project ! ! !memberadam71815-Jul-11 17:59 
Hi Ajcek84 !
 
I watched you project and used it once in my test project as you mentioned.
 
PSAM Library provided functions what I needed, like drawing musical notes in the way of musical notation and drawing notes from music font, etc.
 
Thank you very much for your effort and your project.
 
Now I have 2 problems and I really want you to help with my problem.
 
1. Controlling Font Size.
Controlling the size of music notes, staff, everything (it means zoom)
 
2. How to draw Multi-line music notes?
 
Thank you...
AnswerRe: Wonderful Project ! ! !memberAjcek8415-Jul-11 20:15 
Thanks.
 
1. You can't control font size. Try using WPF version of this library and put in into ViewPort.
 
2. IncipitViewer displays only one staff because only one staff is required in international standard of describing musical sources specified by RISM (http://www.rism.info/[^]).
Adding new staves is relatively simple: a staff is a List of MusicalSymbol objects. Currently there is only one list - you can add more lists or add a list of lists to support infinite number of staves. Then you have to modify some graphical operations in DrawViewer to draw barlines across all staves, etc. The problem might be with proper spacing of notes which should be the same in all staves but I think you'll be able to deal with it eventually.
GeneralRe: Wonderful Project ! ! !memberadam71816-Jul-11 21:53 
Thank you very much for quick answer!
 
But still I couldn't know how to control font size.
Would you explain more or with some example code?
 
*** I add the following code to see PSAMLibrary how it works
But I get the unexpected result(drawn result for set of staves).
Could you help me what the problem is.
 
code :
 
Note s1 = new Note("A", 0, 3, MusicalSymbolDuration.Sixteenth, NoteStemDirection.Down, NoteTieType.None, new List<NoteBeamType>() { NoteBeamType.Start, NoteBeamType.Start });
Note s2 = new Note("C", 1, 3, MusicalSymbolDuration.Sixteenth, NoteStemDirection.Down, NoteTieType.None, new List<NoteBeamType>() { NoteBeamType.Continue, NoteBeamType.End });
Note s3 = new Note("D", 0, 5, MusicalSymbolDuration.Eighth, NoteStemDirection.Down, NoteTieType.None, new List<NoteBeamType>() { NoteBeamType.End });
 
incipitViewer.AddMusicalSymbol(s1);
incipitViewer.AddMusicalSymbol(s2);
incipitViewer.AddMusicalSymbol(e);
 
Thank you.
GeneralRe: Wonderful Project ! ! !memberAjcek8424-Jul-11 2:53 
Hello
 
Currently there is no property to change font size, but you can change font sizes manually in FontStyles.cs.
 
What is the problem with code that you pasted?
GeneralRe: Wonderful Project ! ! !memberadam71825-Jul-11 4:24 
Hi!
 
I implemented to scale everything.
Thank you for your help.
And the code that i mentioned wrong resulted in unexpectedly and you could see if you try it.
Anyway I resolved it.
Thanks again for your work. Big Grin | :-D
GeneralRe: Wonderful Project ! ! !memberAjcek8425-Jul-11 4:35 
This code fragment was too small to determine your problem. Besides, it missed declarations of incipitViewer and e so it wouldn't compile.
GeneralExcellent control and some suggestionsmemberYuval Naveh2-Dec-10 18:29 
Hi,
First - you got my five. Great job. Thumbs Up | :thumbsup:
I wanted to ask you if you would mind opening a proper source control project for this control (e.g. under Google Code)?
If you don't want to do so, do you mind if I open such a project (of course with your license and credit)?
I'm thinking of using this control inside my open source project (Practice#) but I must make some changes to the control in order to make it fit my needs.
 
I already fixed and added some things on my local version, for example:
1. Loading of the special font without requiring installing it as a system font. The original code did not work out-of-the-box.
2. Smoothing (Anti aliasing) of the lines makes them look much better
 
Also there are still some stability issues that I would like to fix, for examples: one the code examples shown in the article crashes the controls.
Note s1 = new Note("A", 0, 4, MusicalSymbolDuration.Sixteenth, 
		NoteStemDirection.Down, NoteTieType.None,
                	new List<NoteBeamType>() { NoteBeamType.Start, NoteBeamType.Start});
Note s2 = new Note("C", 1, 5, MusicalSymbolDuration.Sixteenth, 
		NoteStemDirection.Down, NoteTieType.None,
                	new List<NoteBeamType>() { NoteBeamType.Continue, NoteBeamType.End });
Note e = new Note("D", 0, 5, MusicalSymbolDuration.Eighth, 
		NoteStemDirection.Down, NoteTieType.None,
                	new List<NoteBeamType>() { NoteBeamType.End });
viewer.AddMusicalSymbol(s1);
viewer.AddMusicalSymbol(s2);
viewer.AddMusicalSymbol(e);

 
"Object reference not set to an instance of an object.
at PSAMControlLibrary.IncipitViewer.DrawViewer(Graphics g, Boolean print) in C:\PSAMControlLibrary_src\PSAMControlLibrary\PSAMControlLibrary\IncipitViewer.cs:line 923"
 
When I change the s2 note (C) to NoteBeamType.End from NoteBeamType.Continue it works properly.
 
Thanks,
Yuval
"The true sign of intelligence is not knowledge but imagination." - Albert Einstein

GeneralRe: Excellent control and some suggestionsmemberAjcek842-Dec-10 21:22 
Thanks. Smile | :)
Ok, I'll open a project on Google Code this weekend.
I tested the code examples from this article and they work properly so you might have an error in different place. It doesn't make sense to change NoteBeamType.Continue to NoteBeamType.End because the same beam is ended twice. It might display properly but I think it would be better to throw an exception in this case.
 
Best regards
Jacek
GeneralRe: Excellent control and some suggestionsmemberYuval Naveh3-Dec-10 1:54 
Jacek,
 
GoogleCode site would be great for this library.
 
Regarding the exception, Please try out this code and see for your self.
My main point here was stability, the component shouldn't ever crash even with 'wrong' input.
Worst case it should not draw, or draw some error marker to notify of incorrect input.
        private void button1_Click(object sender, EventArgs e)
        {
            Clef c = new Clef(ClefType.GClef, 2);
            notesViewer.AddMusicalSymbol(c);
 
            Note s1 = new Note("A", 0, 4, MusicalSymbolDuration.Sixteenth, NoteStemDirection.Down, NoteTieType.None,
                    new List<NoteBeamType>() { NoteBeamType.Start, NoteBeamType.Start });
            Note s2 = new Note("C", 1, 5, MusicalSymbolDuration.Sixteenth, NoteStemDirection.Down, NoteTieType.None,
                                new List<NoteBeamType>() { NoteBeamType.Continue, NoteBeamType.End });
            Note e2 = new Note("D", 0, 5, MusicalSymbolDuration.Eighth, NoteStemDirection.Down, NoteTieType.None,
                                new List<NoteBeamType>() { NoteBeamType.End });
            notesViewer.AddMusicalSymbol(s1);
            notesViewer.AddMusicalSymbol(s2);
            notesViewer.AddMusicalSymbol(e2); 
        }
 
Regarding smoothing - I added one line in IncipitViewer and now the beam lines look much smoother:
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            Graphics g = e.Graphics;
 
          // Yuval
            g.SmoothingMode = SmoothingMode.HighQuality;

            DrawViewer(g, false);
 
        }
 

Regarding loading the custom font - this is how I changed the code in FontStyles.cs in order to load the font without installing it as a system font: (Using a "Private Font")
 
    
    public static class FontStyles
    {
        static PrivateFontCollection FontCollection;
 
        static FontStyles()
        {
            FontCollection = new PrivateFontCollection();
            FontCollection.AddFontFile("Polihymnia.ttf");
            MusicFont = new Font(FontCollection.Families[0], 20);
            GraceNoteFont = new Font(FontCollection.Families[0], 18);
            StaffFont = new Font(FontCollection.Families[0], 23);
        }
 
        public static Font MusicFont;
        public static Font GraceNoteFont;
        public static Font StaffFont;
        public static Font LyricFont = new Font("Times New Roman", 8);
        public static Font LyricFontBold = new Font("Times New Roman", 10, FontStyle.Bold);
        public static Font MiscArticulationFont = new Font("Microsoft Sans Serif", 8, FontStyle.Bold);
        public static Font DirectionFont = new Font("Microsoft Sans Serif", 9, FontStyle.Italic | FontStyle.Bold);
        public static Font TrillFont = new Font("Times New Roman", 9, FontStyle.Italic | FontStyle.Bold);
        public static Font TimeSignatureFont = new Font("Microsoft Sans Serif", 10, FontStyle.Bold);
    }
 
HTH,
Yuval
"The true sign of intelligence is not knowledge but imagination." - Albert Einstein

GeneralRe: Excellent control and some suggestionsmemberAjcek843-Dec-10 2:34 
Error marker appears if MusicXml input is incorrect because this functionality is intended to be used by the end user. Adding notes programmatically is not intended to be used by the end user so I think that the library should throw an exception instead of not drawing or displaying error marker. But you are right that exceptions shoud be more descriptive than "Object reference not set to an instance of object".
 
Regarding loading the custom font - you should provide full path (presumably by using Application.StartupPath) for the font file because now it will look for it in current working folder. If you create a shortcut for your executable and open a program through this shortcut it won't find the file.
GeneralRe: Excellent control and some suggestionsmemberYuval Naveh3-Dec-10 2:46 
You can surely improve my suggested code to include some path.
A better approach might be to include the font as a binary embedded resource.
 
I think the requirement to install a font as a system could be problematic - not all users are administrators, and the library is currently not displaying properly without that manual deployment step.
 
Thanks
Yuval
"The true sign of intelligence is not knowledge but imagination." - Albert Einstein

GeneralRe: Excellent control and some suggestionsmemberAjcek843-Dec-10 4:11 
You are right, I think that embedding this font as a resource would be the best solution.
Installing a system font was not a problem in my former project, Polish System for Archivising Music, because it was distributed as a setup file.
GeneralRe: Excellent control and some suggestionsmemberAjcek844-Dec-10 6:29 
I added the project to Google Code:
http://code.google.com/p/psamcontrollibrary/[^]
GeneralRe: Excellent control and some suggestionsmemberedgarmaass5-Jan-11 7:39 
Hello and thanks also for the good work?
did you put the (current) code to Google? I do not see it.
Another question - if I load the example xml file of the article, I cannot scroll the control to see all of music. What should I do to enable scrolling?
Thanks!
Edgar
GeneralRe: Excellent control and some suggestionsmemberAjcek845-Jan-11 21:59 
I put the code here: http://code.google.com/p/psamcontrollibrary/
I'm not sure if I configured it properly. Let me know if it doesn't work.
 
There is no scroll capability because I didn't need such. I suppose you have to change the initial value of variable currentXPosition in DrawViewer function while scrolling.
GeneralMy vote of 5memberherman60227-Sep-10 4:17 
GOOD!!!!!!!
GeneralMy vote of 5memberAbhinav S9-Jul-10 7:48 
Very cool.
GeneralAwesomememberSike Mullivan23-Jun-10 3:35 
Being a musician myself... I'm sure I'll put this to some use in the future! Thanks
GeneralWOW! and double WOW!!memberKenJohnson17-Jun-10 9:33 
I am impressed and I do not say that lightly. My only request is that you please, please port this over to WPF. I might even be willing to venture a little assistance.
 
Thanks Again,
You deserve a 6+
GeneralRe: WOW! and double WOW!!memberAjcek8417-Jun-10 22:49 
Thanks.I suppose that hosting a WinForm control on WPF control doesn't come into play? Smile | :)
GeneralRe: WOW! and double WOW!!member2WinMaster22-Jun-10 21:30 
I add myself asking to a version for wpf / silverlight. That might explose the diffusion of your work.
Thanks for sharing.
Marcos Tabaj
2Win Systems

GeneralRe: WOW! and double WOW!!memberAjcek8423-Jun-10 3:42 
Ok, I'll go into it in free time. Are you working on some WPF/Silverlight project that requires displaying notes?
GeneralRe: WOW! and double WOW!!memberAjcek8423-Jun-10 10:10 
OK, I'm working on it. Wink | ;-)
Soon I will publish a new version of PSAM Control Library too (I had to make some changes to make porting to WPF possible).
GeneralRe: WOW! and double WOW!!memberAjcek8424-Jun-10 7:45 
PSAM WPF Control Library[^] Wink | ;)
GeneralMy vote of 5+ for a great workmemberHinojosa Chapel16-Jun-10 2:34 
Almost twenty years ago I worked on a musical software for MS-DOS that needed a score module. While I worked on the musical logic, another person developed that module. I remember how difficult was to achieve our goals. Here you have a screenshot: http://www.hinojosachapel.com/musical-fractals Thanks for your contribution!
GeneralExcellent!memberTheCardinal15-Jun-10 23:51 
thanks for sharing Big Grin | :-D Thumbs Up | :thumbsup:
Life - Dreams = Job
 
TheCardinal
BenPOS Systems

GeneralIncrediblememberossoh2o15-Jun-10 20:23 
Thank you Ajcek84 this is awesome!
I can't wait to dig the code to see how music turn to bit!
GeneralExcellent article ! ... and one questionmemberBillWoodruff15-Jun-10 18:15 
Hi,
 
It is wonderful to see "coding" in the service of culture !
 
One question: I am assuming that there is a "shorthand" notation for describing notes and their duration ? And that shorthand notation is then translated into the elaborate descriptions required in C# ?
 
As a guitar player (weird pseudo-classical, flamenco-like) who likes to experiment with different altered tunings, I often describe the tuning by a set of set of five half-step intervals, like :
 
5 5 11 1 4
 
Which, if the lowest bass string is tuned to D is equivalent to : D G C a# g# d# (yes, that's a tuning I actually play in : warning stretching your "g" string up that high may not be healthy for the string or your guitar).
 
And if I stumble on a "unique" chord progression, where I don't want to take my left hand off the fretboard, I often just notate it with the other hand in a kind of "horizontal tab" form like:
 
0 10 11 10 11 0 // in the tuning 5 5 11 1 4
~ 9 11 9 11 0
 
Each line representing a chord or fingering: where "~" indicates the string is open but not played, and reading left to right are, of course, the fretted positions from low string to high string.
 
Of course I am not advocating this personal short-hand for any other use than my own, but just using it as an example of a "shorthand" which could, theoretically, be mapped into the verbose C# instructions your system uses.
 
I look forward to hearing more about your career which I believe is going to be brilliant !
 
best, Bill
"Many : not conversant with mathematical studies, imagine that because it [the Analytical Engine] is to give results in numerical notation, its processes must consequently be arithmetical, numerical, rather than algebraical and analytical. This is an error. The engine can arrange and combine numerical quantities as if they were letters or any other general symbols; and it fact it might bring out its results in algebraical notation, were provisions made accordingly." Ada, Countess Lovelace, 1844

GeneralRe: Excellent article ! ... and one questionmemberAjcek8416-Jun-10 0:48 
Thanks Wink | ;)
 
Notes can be read from MusicXml or added programmatically. IncipitViewer can't read notes from any shorthand notation but it can export notes to some sort of shorthand notation used in Polish System for Archivising Music.
GeneralWOW!memberR2B214-Jun-10 4:15 
Wow! This is incredible. Thank you for contributing this to the community. This is what makes Code Project work!
GeneralRe: WOW!memberAjcek8414-Jun-10 11:17 
Thanks. Wink | ;)
 
Take a look also on my compositions:
http://icking-music-archive.org/ByComposer/Salamon.php
GeneralExcellentmvpPete O'Hanlon14-Jun-10 2:12 
As a musician, I appreciate this more than I can say. 5+ from me.

"WPF has many lovers. It's a veritable porn star!" - Josh Smith

As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

My blog | My articles | MoXAML PowerToys | Onyx



GeneralRe: ExcellentmemberAjcek8414-Jun-10 11:17 
Thank you Wink | ;-)
GeneralAwesome, and questionmembercanozurdo12-Jun-10 4:58 
Wow man, this library is very good, and I have been looking for something like this, a long ago. However, I have a question:
 
Is it possible to change the color of a Note? say you want to put acute notes in green, and other notes in red?
No one can stop you, if you have passion for that.

GeneralRe: Awesome, and questionmemberAjcek8412-Jun-10 8:53 
Thanks! Wink | ;-)
 
The library does not offer the possibility of changing the color of a note but it's very easy to add such function: just add the Color property to Note or MusicalSymbol class and change the following code in IncipitViewer.cs:
 
//Draw a note / Rysuj nutę:
     if (!note.IsGraceNote)
          g.DrawString(symbol.MusicalCharacter, FontStyles.MusicFont, textBrush, currentXPosition, notePositionY);
     else
          g.DrawString(symbol.MusicalCharacter, FontStyles.GraceNoteFont, textBrush, currentXPosition + 1,
          notePositionY + 2);
 
Instead of textBrush place your custom brush, i.e. new SolidBrush(((Note)symbol).Color);
GeneralRe: Awesome, and questionmemberAjcek8424-Jun-10 23:48 
I added colored notes in 2.1.0.2.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web04 | 2.6.130617.1 | Last Updated 24 Jun 2010
Article Copyright 2010 by Ajcek84
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid