Question: Start with the startA.cpp file for this part. LINK : http://www-users.cselabs.umn.edu/classes/Spring-2017/csci1113/assignments/startA.cpp You CANNOT change main() from how it is currently written. Instead, you need to

Start with the startA.cpp file for this part.

LINK : http://www-users.cselabs.umn.edu/classes/Spring-2017/csci1113/assignments/startA.cpp

You CANNOT change main() from how it is currently written. Instead, you need to add to the Beeper class to make main() work and play sound. You should first be able to enter the beats-per-minute of the song. Thus 60 bpm is 1 note a second and 120 bpm is 2 notes a second. Computers typically calculate time in milliseconds (1 / 1,000 of a second) so you will have to convert units. Next the user will input notes (in upper case), which you should play at the bpm entered (the playing should happen on the cin >> b; line of code).

To play notes, you will need to specify the pitch in Hertz (Hz) of the notes. You can reference this webpage:

http://www.phy.mtu.edu/~suits/NoteFreqCalcs.html

For those of you unfamiliar with music, there are seven notes: C D E F GAB

The link above says to start the A note at 440 Hz (please choose this definition). Then they give you a formula based on the number of half-steps. These are: A -> B = 2 half-steps A -> A = 0 half-steps

A -> G = -2 half-steps A -> F = -4 half-steps A -> E = -5 half-steps A -> D = -7 half-steps A -> C = -9 half-steps

(Hint: you should look around the SDLaudioPlayer.cpp example to figure out how to play sound.)

LINK: http://www-users.cselabs.umn.edu/classes/Spring-2017/csci1113/assignments/SDLaudioPlayer.cpp

In addition to reading notes, your program should also read periods (.) as rests (no sound). To do this, simply put a very low frequency Hz (outside of the hearing range).

Example 1 (user input underlined, desired sound posted on website):

Enter tempo (bpm)

60

Enter song

CEG.GEC

LINK FOR EXAMPLE ONE : http://www-users.cselabs.umn.edu/classes/Spring-2017/csci1113/assignments/CEG.GEC.mp3

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!