diff --git a/freude.py b/freude.py index c1e8a8f..4e918ff 100644 --- a/freude.py +++ b/freude.py @@ -16,10 +16,10 @@ with open("FREUDE.gcode", "w") as f: f.write("G4 S2\n") position = 0 with open("freude.txt", "r") as notes: - for note, duration in csv.reader(notes): + for note, duration, pause in csv.reader(notes): feedrate = int(frequencies[int(note) + 12] * 60 / steps_per_mm) length = int(duration) * base_duration / 60 * feedrate position += -length if position > 100 else length - f.write(f"G0 X{position:.6f} Y{position:.6f} F{feedrate} \n") - f.write("G4\n") + f.write(f"G0 X{position:.6f} Y{position:.6f} F{feedrate}\n") + f.write(f"G4 P{int(int(pause) * base_duration)}\n") f.write("G4 S2\n") diff --git a/freude.txt b/freude.txt index a678d5d..58145f1 100644 --- a/freude.txt +++ b/freude.txt @@ -1,62 +1,62 @@ -4,2 -4,2 -5,2 -7,2 -7,2 -5,2 -4,2 -2,2 -0,2 -0,2 -2,2 -4,2 -4,3 -2,1 -2,4 -4,2 -4,2 -5,2 -7,2 -7,2 -5,2 -4,2 -2,2 -0,2 -0,2 -2,2 -4,2 -2,3 -0,1 -0,4 -2,2 -2,2 -4,2 -0,2 -2,2 -4,1 -5,1 -4,2 -0,2 -2,2 -4,1 -5,1 -4,2 -2,2 -0,2 -2,2 --5,4 -4,2 -4,2 -5,2 -7,2 -7,2 -5,2 -4,2 -2,2 -0,2 -0,2 -2,2 -4,2 -2,3 -0,1 -0,4 +4,2,0 +4,2,0 +5,2,0 +7,2,0 +7,2,0 +5,2,0 +4,2,0 +2,2,0 +0,2,0 +0,2,0 +2,2,0 +4,2,0 +4,3,0 +2,1,0 +2,4,0 +4,2,0 +4,2,0 +5,2,0 +7,2,0 +7,2,0 +5,2,0 +4,2,0 +2,2,0 +0,2,0 +0,2,0 +2,2,0 +4,2,0 +2,3,0 +0,1,0 +0,4,0 +2,2,0 +2,2,0 +4,2,0 +0,2,0 +2,2,0 +4,1,0 +5,1,0 +4,2,0 +0,2,0 +2,2,0 +4,1,0 +5,1,0 +4,2,0 +2,2,0 +0,2,0 +2,2,0 +-5,4,0 +4,2,0 +4,2,0 +5,2,0 +7,2,0 +7,2,0 +5,2,0 +4,2,0 +2,2,0 +0,2,0 +0,2,0 +2,2,0 +4,2,0 +2,3,0 +0,1,0 +0,4,0