Encoding variable-length quanties for MIDI
If an argument doesn't fit in the desired range an ArgumentOutOfRangeException should be thrown instead of an Exception.




    for (int i = 3; i &gt;= 0; i--)
    {
        result[i] = (byte)(n &amp; 0x7f);

        if(i &lt; 3)
            result[i] |= 0x80;

        n &gt;&gt;= 7;

        if (n &lt; 1)
            break;
    }  



This can be rewritten to remove the if(i &lt; 3) by starting the loop at 2. The check if (n &lt; 1) can be placed in the loop condition like  

result[3] = (byte)(n &amp; 0x7f);
n &gt;&gt;= 7;  

for (int i = 2; (i &gt;= 0) || (n &gt; 0); i--)
{
    result[i] = ((byte)(n &amp; 0x7f)) | 0x80;
    n &gt;&gt;= 7;
}  




You have some magic numbers in your code. The values 0x0fffffff, 128, 0x7f, 0x80 and 7 should be extracted to descriptive named constants.  



Also there isn't explicitly written anything in any guidelines about braces {} for single instruction if statements I would encourage you to always use them to make your code less error prone.  



You shouldn't shorten variables / parameter names. It is easier to read if the passed in parameter is named quantity instead of q.  



The fact that you are taking care about the Endianess of the system should be stated in a xml documentation.