You should write a program that when a button is pressed, it outputs a different sound for each key.
The keys that you will use are:
The notes begin at
C and each key above adds one semitone.
Lets make it slightly easier for you though. You can choose between 2 similar tasks,
1) Output a different note when a key is pressed that continues until another key is pressed. This program runs indefinitely
2) Take a string as input that only contains the characters above that will output each note for exactly 1 second (0.05 second variation allowed)
- A key being pressed
- A single string containing only the symbols above
- A single musical note that sounds until another key is pressed
- A series of notes, each one 1 second long
Letter | Note -------+------- 1 | C ! | C# 2 | D " | D# 3 | E 4 | F $ | F# 5 | G % | G# 6 | A ^ | A# 7 | B 8 | C * | C# 9 | D ( | D# 0 | E q | F Q | F# w | G W | G# e | A E | A# r | B t | C <-- middle C T | C# y | D Y | D# u | E i | F I | F# o | G O | G# p | A P | A# a | B s | C S | C# d | D D | D# f | E g | F G | F# h | G H | G# j | A J | A# k | B l | C L | C# z | D Z | D# x | E c | F C | F# v | G V | G# b | A B | A# n | B m | C
- You may choose between the tasks but please say which one in your answer
- You are given a ±0.05 second variation in task 2
- Each symbol along increments the tone by 1 semitone.
- The individual notes are shown above
- This is a code-golf so shortest code wins