Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ PROGRAM The site http://buttonbass.com/editor.html (requires Flash) features an online player piano. If you click on the Notes button just above the piano keyboard, and

C++ PROGRAM

The site http://buttonbass.com/editor.html (requires Flash) features an online player piano. If you click on the Notes button just above the piano keyboard, and then Computer Keyboard, you will see that each key is labelled with a character. The text box just above it contains a sequence of these characters, indicating a song to be played on the piano. If you click Play, the sequence of notes will be played. If you clear the text box and type in or copy and paste a different sequence of characters, then the song that it represents will be played. The Interval control lets you specify the tempo, the number of milliseconds between the starts of each beat of the song.

The ButtonBass software expects the song to be represented as a sequence of instructions, where each instruction is either:

one of the characters on the piano keyboard display: ZXCVBNM,./ASDFGHJKLQWERTYUIOP1234567890!@#$%^&*()zxcvbnmasdfghjklqwertyuiop Lower case letters represent the same piano key as their upper case equivalent.

a space character, representing a rest that lasts one beat.

an open square bracket [, followed by a sequence of characters on the piano keyboard display, followed by a close square bracket ]. This represents a chord where all the indicated piano keys are played simultaneously for one beat.

(The ButtonBass software actually accepts a few more possibilities, but they are not relevant to this project.)

Now for the bad news: The people who want to produce songs want to use a notation that they find more natural, knowing the conventional way to name the piano keys( http://www.piano-keyboard-guide.com/piano-keyboard-diagram.html ). [Here's a video explanation( https://www.youtube.com/watch?feature=fvwp&NR=1&v=vfD-00I6Tv4 ) of the conventional naming.] For them, a song is expressed as a string likeA3C#E//E//F#3A3D4/A3C#E/, where a slash terminates every beat. This means "For the first beat, play a chord consisting of A in the third octave, and C# and E in the (default) fourth octave. For the second beat, play nothing. For the third beat, play E in the (default) fourth octave. Play nothing for the fourth beat. For the fifth beat, play a chord consisting of F# and A in the third octave, and D in the fourth octave. For the sixth beat, play a chord consisting of A in the third octave and C# and E in the (default) fourth octave."

Note: The Acoustical Society of America denotes the octave that ranges from middle C to the B above middle C as the fourth octave. The B just below middle C is the end of the third octave; the C one octave above middle C begins the fifth octave. The ButtonBass piano keyboard ranges from C2 (the C that starts the second octave) to C6 (the C that starts the sixth octave).

Your assignment is essentially to encode a song from the more natural representation to the sequence of characters the ButtonBass software wants. For example, the song A3C#E//E//F#3A3D4/A3C#E/ should be encoded as the string [D!J] J [8DH][D!J]

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Time Series Databases New Ways To Store And Access Data

Authors: Ted Dunning, Ellen Friedman

1st Edition

1491914726, 978-1491914724

More Books

Students also viewed these Databases questions

Question

State Probability Stock Return 1 0.20 10% 2 0.60 15% 3 0.20 20%

Answered: 1 week ago

Question

Question What is an educational benefit trust and how is it used?

Answered: 1 week ago

Question

Question How are VEBA assets allocated when a plan terminates?

Answered: 1 week ago

Question

Question May a taxpayer roll over money from an IRA to an HSA?

Answered: 1 week ago