Compare commits
2 Commits
222b197bc6
...
eeb11e1bf7
Author | SHA1 | Date |
---|---|---|
Starbeamrainbowlabs | eeb11e1bf7 | |
Starbeamrainbowlabs | 5c81eabebe |
|
@ -62,6 +62,57 @@ namespace MusicBoxConverter
|
||||||
//return string.Format("[MusicBox: Name={0}, ValidNotes={1}]", Name, ValidNotes);
|
//return string.Format("[MusicBox: Name={0}, ValidNotes={1}]", Name, ValidNotes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Real Life Music Box Printed
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Middle C4 G
|
||||||
|
* D4 A
|
||||||
|
* E4 B
|
||||||
|
* F4 C
|
||||||
|
* G4 D
|
||||||
|
* A5 E
|
||||||
|
*
|
||||||
|
* A#5 F
|
||||||
|
* B5 F#
|
||||||
|
* C G
|
||||||
|
* D A
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* F#3
|
||||||
|
* G3
|
||||||
|
* C4
|
||||||
|
* D4
|
||||||
|
* E4
|
||||||
|
* F4
|
||||||
|
* G4
|
||||||
|
* A5
|
||||||
|
* A#5
|
||||||
|
* B5
|
||||||
|
* C5
|
||||||
|
* C#5
|
||||||
|
* D5
|
||||||
|
* D#5
|
||||||
|
* E5
|
||||||
|
* F5
|
||||||
|
* F#5
|
||||||
|
* G5
|
||||||
|
* G#5
|
||||||
|
* A6
|
||||||
|
* A#6
|
||||||
|
* B6
|
||||||
|
* C6
|
||||||
|
* C#6
|
||||||
|
* D6
|
||||||
|
* D#6
|
||||||
|
* E6
|
||||||
|
* F6
|
||||||
|
* G6
|
||||||
|
* A7
|
||||||
|
*/
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A 30 note music box.
|
/// A 30 note music box.
|
||||||
/// @Starbeamrainbowlabs has one of these - it was the part of the
|
/// @Starbeamrainbowlabs has one of these - it was the part of the
|
||||||
|
|
|
@ -72,12 +72,13 @@ namespace MusicBoxConverter
|
||||||
);
|
);
|
||||||
svg.UnitSuffix = "mm";
|
svg.UnitSuffix = "mm";
|
||||||
|
|
||||||
for(float i = 0; i < area.Y; i += ScaleFactor.Y)
|
// Draw the note lines
|
||||||
{
|
for(float i = 0; i < area.Y; i += ScaleFactor.Y) {
|
||||||
Vector2 start = Offset.Add(new Vector2(0, i));
|
Vector2 start = Offset.Add(new Vector2(0, i));
|
||||||
svg.WriteLine(start, start.Add(new Vector2(area.X, 0)), "darkgreen", 0.75f);
|
svg.WriteLine(start, start.Add(new Vector2(area.X, 0)), "darkgreen", 0.75f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Draw a red box around everything
|
||||||
svg.WriteRectangle(Offset, area, "red", 0.75f);
|
svg.WriteRectangle(Offset, area, "red", 0.75f);
|
||||||
|
|
||||||
foreach(Note note in AllNotes())
|
foreach(Note note in AllNotes())
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
using Melanchall.DryWetMidi.Common;
|
using Melanchall.DryWetMidi.Common;
|
||||||
|
|
||||||
using SBRL.Utilities;
|
using SBRL.Utilities;
|
||||||
|
@ -13,6 +13,7 @@ namespace MusicBoxConverter
|
||||||
string inputFilename = "";
|
string inputFilename = "";
|
||||||
string outputFilename = "";
|
string outputFilename = "";
|
||||||
bool debug = false;
|
bool debug = false;
|
||||||
|
MusicBox targetMusicBox = MusicBox.Note30;
|
||||||
|
|
||||||
for(int i = 0; i < args.Length; i++)
|
for(int i = 0; i < args.Length; i++)
|
||||||
{
|
{
|
||||||
|
@ -39,6 +40,15 @@ namespace MusicBoxConverter
|
||||||
debug = true;
|
debug = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "--box":
|
||||||
|
targetMusicBox = (MusicBox)typeof(MusicBox).GetField(
|
||||||
|
args[++i],
|
||||||
|
BindingFlags.GetField |
|
||||||
|
BindingFlags.Static |
|
||||||
|
BindingFlags.Public
|
||||||
|
).GetValue(null);
|
||||||
|
break;
|
||||||
|
|
||||||
case "-h":
|
case "-h":
|
||||||
case "--help":
|
case "--help":
|
||||||
Console.Error.WriteLine(EmbeddedFiles.ReadAllText("MusicBoxConverter.Help.txt"));
|
Console.Error.WriteLine(EmbeddedFiles.ReadAllText("MusicBoxConverter.Help.txt"));
|
||||||
|
@ -62,8 +72,9 @@ namespace MusicBoxConverter
|
||||||
MusicBoxScoreGenerator converter = new MusicBoxScoreGenerator(
|
MusicBoxScoreGenerator converter = new MusicBoxScoreGenerator(
|
||||||
inputFilename,
|
inputFilename,
|
||||||
MusicBox.Note30
|
MusicBox.Note30
|
||||||
);
|
) {
|
||||||
converter.Debug = debug;
|
Debug = debug
|
||||||
|
};
|
||||||
converter.Output(outputFilename);
|
converter.Output(outputFilename);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
15
README.md
15
README.md
|
@ -12,6 +12,21 @@
|
||||||
|
|
||||||
This somewhat convoluted process prevents anyone from automatically rescaling it along the way.
|
This somewhat convoluted process prevents anyone from automatically rescaling it along the way.
|
||||||
|
|
||||||
|
If the above doesn't work, it's probably LibreOffice Draw scaling it even though you've told it not to. In that case, try this:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Convert MIDI -> SVG
|
||||||
|
./MusicBoxConverter.exe --input song.midi --output score.svg
|
||||||
|
# Convert it to png
|
||||||
|
inkscape -e score.png score.svg
|
||||||
|
# Convert the PNG to PDF, rotating by 90 degrees
|
||||||
|
convert score.png -rotate 90 score.pdf
|
||||||
|
# Split the PDF up into multiple pages for the printer
|
||||||
|
# -s1 Don't scale the output
|
||||||
|
# -m Sets the output paper size. Defaults to A4 (21x29.7cm) if unspecified, but may need to reduce by a cm or 2 on each side (as below) if things get cut off.
|
||||||
|
pdfposter -s1 -m 20x28.7cm score.pdf print.pdf
|
||||||
|
```
|
||||||
|
|
||||||
## Useful Links
|
## Useful Links
|
||||||
- [ffmpeg - showspectrumpic manual](https://ffmpeg.org/ffmpeg-filters.html#showspectrumpic)
|
- [ffmpeg - showspectrumpic manual](https://ffmpeg.org/ffmpeg-filters.html#showspectrumpic)
|
||||||
- [Frequency to Musical Note Converter](https://newt.phys.unsw.edu.au/music/note/)
|
- [Frequency to Musical Note Converter](https://newt.phys.unsw.edu.au/music/note/)
|
||||||
|
|
Loading…
Reference in New Issue