Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

There are 88 keys on a standard piano. Each key produces a music note that is at a different frequency (a different musical pitch). For

There are 88 keys on a standard piano. Each key produces a music note that is at a different frequency (a different musical pitch). For example the A4 note on a piano is key 49 and has a frequency of 440.0 Hz. You can convert any piano key into its corresponding frequency using the following formula: Where n is the piano note number (between 1 and 88) and f(n) gives the frequency in Hertz. Note that 2 is raised to the power of that fraction. You are given a Helper file for this assignment called StdAudio.java and a starter BlueJ project. You should add your solution to this existing BlueJ project. The helper file allows you to play a musical note (provided you supply a frequency (double), duration (in seconds) (double) ) and volume (as a percentage) (double). For example to play an A4 note for 0.7 seconds at half volume you do as follows: StdAudio.play(440.0, 0.7, 0.5); //or similarly: double a4 = 440.0; StdAudio.play(a4, 0.7, 0.5); For Problem 1 you will create a program that plays a musical note (a piano key between 1 and 88 of your predetermined choosing) and asks the user to guess what the note is. The user will be asked to input a number between 1 and 88 representing their guess as to which piano key matches the sound they heard. Your program will then play their note so they can hear what they have input. You should output the user guessed piano key number and the corresponding frequency and the actual piano key number and its corresponding frequency indicating by how many keys the user was incorrect - or a congratulatory message if they got it correct

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_2

Step: 3

blur-text-image_step3

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

MySQL/PHP Database Applications

Authors: Brad Bulger, Jay Greenspan, David Wall

2nd Edition

ISBN: 0764549634, 9780764549632

More Books

Students also viewed these Databases questions

Question

List the advantages and disadvantages of the pay programs. page 505

Answered: 1 week ago