from random import choice
from time import sleep
import pathlib
import os

# Path to the Chords folder that is right next to the script
chords_path = str(pathlib.Path(__file__).parent) + '\\Chords\\'

# A list of chords that are in the folder
list_of_chords = os.listdir(chords_path)

# Seconds to wait after playing a chord
to_sleep = float(input('How many seconds do you want to wait?\n'))

# Loop an eternity
while True:
    # Choose a chord randomly
    chosen = choice(list_of_chords)
    # Play the chord
    os.system('start ' + chords_path + chosen)
    # Wait for some time
    sleep(to_sleep)
    # Print the correct chord
    print(chosen[:-4])
