Transposing a song
Description:
You are a composer who just wrote an awesome piece of music. Now it's time to present it to a band that will perform your piece, but there's a problem! The singers vocal range doesn't stretch as your piece requires, and you have to transpose the whole piece.
Your task
Given a list of notes (represented as strings) and an interval, output a list of transposed notes in sharp notation.
Input notes may be represented both in flat and sharp notations (more on that below).
For this kata, assume that input is always valid and the song is at least
1 note
long.Assume that interval is an integer between
-12
and12
.
Short intro to musical notation
Transposing a single note means shifting its value by a certain interval.
The notes are as following:
A, A#, B, C, C#, D, D#, E, F, F#, G, G#.
This is using sharp notation, where '#' after a note means that it is one step higher than the note. So A# is one step higher than A.
An alternative to sharp notation is the flat notation:
A, Bb, B, C, Db, D, Eb, E, F, Gb, G, Ab.
The 'b' after a note means that it is one step lower than the note.
Examples
['G'] -> 5 steps -> ['C']
['Db'] -> -4 steps -> ['A']
['E', 'F'] -> 1 step -> ['F', 'F#']
Similar Kata:
Stats:
Created | Jul 27, 2015 |
Published | Jul 28, 2015 |
Warriors Trained | 3332 |
Total Skips | 102 |
Total Code Submissions | 5573 |
Total Times Completed | 1278 |
Python Completions | 701 |
JavaScript Completions | 561 |
Ruby Completions | 49 |
Total Stars | 69 |
% of votes with a positive feedback rating | 86% of 196 |
Total "Very Satisfied" Votes | 152 |
Total "Somewhat Satisfied" Votes | 34 |
Total "Not Satisfied" Votes | 10 |