Initial Commit
- initial default booting image
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
#! /usr/bin/env python3
|
||||
#
|
||||
# This script reads the output of the "aubionotes" command and
|
||||
# validates it contains three expected notes (A2, E3, A3) in the
|
||||
# correct order. Silences or other notes are allowed in between those
|
||||
# notes, to allow some flexibility.
|
||||
|
||||
import sys
|
||||
|
||||
found = 0
|
||||
notes = [57, 64, 69]
|
||||
|
||||
for line in sys.stdin:
|
||||
fields = line.split()
|
||||
if len(fields) >= 1:
|
||||
value = round(float(fields[0]))
|
||||
if value == notes[found]:
|
||||
found += 1
|
||||
if found == len(notes):
|
||||
print("Found all notes")
|
||||
sys.exit(0)
|
||||
|
||||
print("Error: all notes not found")
|
||||
sys.exit(1)
|
||||
@@ -0,0 +1,23 @@
|
||||
#! /usr/bin/env python3
|
||||
#
|
||||
# This script generates a MIDI file with only 3 notes: A2, E3, A3
|
||||
# usage: gen_midi_file.py [output-filename]
|
||||
|
||||
import sys
|
||||
|
||||
from midiutil import MIDIFile
|
||||
|
||||
output_filename = "output.mid"
|
||||
if len(sys.argv) >= 2:
|
||||
output_filename = sys.argv[1]
|
||||
|
||||
notes = [57, 64, 69] # A2, E3, A3
|
||||
|
||||
midi = MIDIFile()
|
||||
midi.addTempo(track=0, time=0, tempo=60)
|
||||
|
||||
for i, p in enumerate(notes):
|
||||
midi.addNote(track=0, channel=0, pitch=p, time=i, duration=1, volume=100)
|
||||
|
||||
with open(output_filename, "wb") as output_file:
|
||||
midi.writeFile(output_file)
|
||||
Reference in New Issue
Block a user