Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The Nashville Numbering System it a method of transcribing music by denoting the

ID: 3819332 • Letter: T

Question

The Nashville Numbering System it a method of transcribing music by denoting the scale degree on which a chord is built. This allows musicians to quickly change the key of a piece of music while still retaining the structure of the song. You art tatted with designing a program which will read in a string of song chords in the Key of C and then to transcribe the song into another Key of the users choosing. Marks: 20 marks go for file & function headers, indentation & neatness, appropriate naming of variables and appropriate commenting (IT Sligo Coding Standard) 20 marks go for correctly requesting & taking in a string of music (up to a maximum of 20 chords) and the desired Key from the user 30 marks go for correct transposition of the string of music based on the Key 20 Marks go for using a function to transpose the music 10 Marks go for correctly displaying the output in a neat and appropriate manner

Explanation / Answer

#include<stdio.h>
#include<string.h>

char musicKeys[7] = "CDEFGAB";
char * musicKeysTable[7][7];

musicKeysTable[0] = {"C", "D", "E", "F", "G", "A", "B"};
musicKeysTable[1] = {"D", "E", "F#", "G", "A", "B", "C#"};
musicKeysTable[2] = {"E", "F#", "G#", "A", "B", "C#", "D#"};
musicKeysTable[3] = {"F", "G", "A", "Bb", "C", "D", "E"};
musicKeysTable[4] = {"G", "A", "B", "C", "D", "E", "F#"};
musicKeysTable[5] = {"A", "B", "C#", "D", "E", "F#", "G#"};
musicKeysTable[6] = {"B", "C#", "D#", "E", "F#", "G#", "A#"};

int main(int argc, char const *argv[]) {
char * musicString, transposedMusic;
char desiredKey;

// Read the input music string
printf("Enter a string of music: ", );
scanf("%s ", musicString);
// Read the desired key
printf("Enter desired key: ", );
scanf("%c ", &desiredKey);

// Transpose the music as per the desired key
transposedMusic = transposeTheMusic(musicString, desiredKey);

// Print the transposed song.
printf("This Song in the Key of %c is %s ", desiredKey, transposedMusic);
return 0;
}

char[] transposeTheMusic(char[] musicString, char desiredKey) {
char * transposedMusic = "";
int len = strlen(musicString);
int i = 0, index;

for (i = 0; i < len; i++) {
index = strchr(musicString, musicString[i]) - musicString;
strcat(transposedMusic, musicKeysTable[index]);
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote