Compare commits

...

2 Commits

3 changed files with 27 additions and 2 deletions

View File

@ -69,8 +69,9 @@ namespace MusicBoxConverter
SvgWriter svg = new SvgWriter(
destinationFilename,
$"{size.X}mm", $"{size.Y}mm"
);
svg.UnitSuffix = "mm";
) {
UnitSuffix = "mm"
};
// Draw the note lines
for(float i = 0; i < area.Y; i += ScaleFactor.Y) {

View File

@ -1,5 +1,6 @@
using System;
using System.IO;
using System.Linq;
using System.Xml;
using SBRL.Utilities;
@ -17,6 +18,9 @@ namespace MusicBoxConverter
}
}
/// <summary>
/// TODO: Replace this with the (much) better version from the FloatingIslands
/// </summary>
public class SvgWriter
{
public XmlWriter xml;
@ -106,5 +110,18 @@ namespace MusicBoxConverter
xml.WriteAttributeString("fill", fillStyle);
xml.WriteEndElement();
}
/// <summary>
/// Adds a solid n-sided polygon to the image.
/// </summary>
/// <param name="fillStyle">The colour to fill the polygon with.</param>
/// <param name="points">The co-ordinates that make up the polygon.</param>
public void WritePolygon(string fillStyle, params Vector2[] points)
{
xml.WriteStartElement("polygon");
xml.WriteAttributeString("fill", fillStyle);
string pointsSpec = string.Join(" ", points.Select((Vector2 point) => $"{point.X},{point.Y}"));
xml.WriteAttributeString("points", pointsSpec);
xml.WriteEndElement();
}
}
}

View File

@ -27,6 +27,13 @@ convert score.png -rotate 90 score.pdf
pdfposter -s1 -m 20x28.7cm score.pdf print.pdf
```
....if that cuts things off at the edges, try doing it like this:
```bash
convert score.svg score.pdf
pdfposter -s1 score.pdf print.pdf
```
## Useful Links
- [ffmpeg - showspectrumpic manual](https://ffmpeg.org/ffmpeg-filters.html#showspectrumpic)
- [Frequency to Musical Note Converter](https://newt.phys.unsw.edu.au/music/note/)