Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

use C 1. Read the code and comments as well as take at the two URLs in the code comments 2. Work out on paper

use C image text in transcribed
image text in transcribed
image text in transcribed
1. Read the code and comments as well as take at the two URLs in the code comments 2. Work out on paper (by hand) the process of converting from Note to Row Number and then to frequency. 3. Complete main.c to output the frequency of a given musical note. Start with the noteToNumber function, test it. Then proceed to toRowNumber function, then test it. Then the function to calculate the frequency from the row number. You must complete the functions as given in the code to solve the problem. Carefully read the comments of main.c for help. #include // You have to choose a note to base your calculations on. // Co will work for now. // You may wish to change it by the end of the lab. // These constants are taken from the table at the URL below. #define REFNOTEFREQ 16.35 #define REFNOTEHALFSTEPS // based on https://pages.mtu.edu/~suitsotefreqs.html // and https://pages.mtu.edu/~suits/NoteFreqCalcs.html // the table shows notes as F#3 or G 5 and their relevant frequency. // each row of the table is separated by a "half-step" and there are // 12 half steps in an octave. //# means to increase by 1 half step, b means to reduce by 1 half step. // given a letter note (A-G), it should output an integer between 0 and 11 // e.g. C > 0, D ->2, E-> 4, F->5, .... // see the table at the website for more info int noteToNumber(char note) { if (c = 0) // returns the row number in the table. // musicians would call each row a 'halfstep' // so C# is at row 1 and CO is at row o // should accept upper or lowercase notes int to RowNumber(char note, char sharpFlat, int octave) { // returns the frequency of the given note in Hertz // should accept upper/Lowercase note // See the Equations used for this table link // at the bottom of the web page // Sharp is '#', 'b' for flat, for neither double toFrequency(char note, char sharpFlat, int octave) { // See the Equations used for this table link // at the bottom of the web page // Sharp is '#', 'b' for flat, '' for neither double toFrequency (char note, char sharpFlat, int octave) { } int main() { char note, sharpFlat; int octave; double freq; printf("Enter a Note: (Example: F#3 or A1 or Bb2 )"); // do your input // use toFreqency to calculate the frequency and store it in freq //output printf("%c%c%d has a frequency of %lf Hz ", note, sharpFlat, octave, freq); return 0; 1. Read the code and comments as well as take at the two URLs in the code comments 2. Work out on paper (by hand) the process of converting from Note to Row Number and then to frequency. 3. Complete main.c to output the frequency of a given musical note. Start with the noteToNumber function, test it. Then proceed to toRowNumber function, then test it. Then the function to calculate the frequency from the row number. You must complete the functions as given in the code to solve the problem. Carefully read the comments of main.c for help. #include // You have to choose a note to base your calculations on. // Co will work for now. // You may wish to change it by the end of the lab. // These constants are taken from the table at the URL below. #define REFNOTEFREQ 16.35 #define REFNOTEHALFSTEPS // based on https://pages.mtu.edu/~suitsotefreqs.html // and https://pages.mtu.edu/~suits/NoteFreqCalcs.html // the table shows notes as F#3 or G 5 and their relevant frequency. // each row of the table is separated by a "half-step" and there are // 12 half steps in an octave. //# means to increase by 1 half step, b means to reduce by 1 half step. // given a letter note (A-G), it should output an integer between 0 and 11 // e.g. C > 0, D ->2, E-> 4, F->5, .... // see the table at the website for more info int noteToNumber(char note) { if (c = 0) // returns the row number in the table. // musicians would call each row a 'halfstep' // so C# is at row 1 and CO is at row o // should accept upper or lowercase notes int to RowNumber(char note, char sharpFlat, int octave) { // returns the frequency of the given note in Hertz // should accept upper/Lowercase note // See the Equations used for this table link // at the bottom of the web page // Sharp is '#', 'b' for flat, for neither double toFrequency(char note, char sharpFlat, int octave) { // See the Equations used for this table link // at the bottom of the web page // Sharp is '#', 'b' for flat, '' for neither double toFrequency (char note, char sharpFlat, int octave) { } int main() { char note, sharpFlat; int octave; double freq; printf("Enter a Note: (Example: F#3 or A1 or Bb2 )"); // do your input // use toFreqency to calculate the frequency and store it in freq //output printf("%c%c%d has a frequency of %lf Hz ", note, sharpFlat, octave, freq); return 0

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_2

Step: 3

blur-text-image_3

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

Database Processing Fundamentals Design

Authors: Marion Donnie Dutton Don F. Seaman

14th Edition Globel Edition

1292107634, 978-1292107639

More Books

Students also viewed these Databases questions