1#! /usr/bin/env python3
2#
3# This script reads the output of the "aubionotes" command and
4# validates it contains three expected notes (A2, E3, A3) in the
5# correct order. Silences or other notes are allowed in between those
6# notes, to allow some flexibility.
7
8import sys
9
10found = 0
11notes = [57, 64, 69]
12
13for line in sys.stdin:
14    fields = line.split()
15    if len(fields) >= 1:
16        value = round(float(fields[0]))
17        if value == notes[found]:
18            found += 1
19        if found == len(notes):
20            print("Found all notes")
21            sys.exit(0)
22
23print("Error: all notes not found")
24sys.exit(1)
25