7 kyu

Transposing a song

701 of 1,278hwtdstrngls

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 and 12.

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#']
Fundamentals
Algorithms
Strings
Lists

Similar Kata:

More By Author:

Check out these other kata created by hwtdstrngls

Stats:

CreatedJul 27, 2015
PublishedJul 28, 2015
Warriors Trained3332
Total Skips102
Total Code Submissions5573
Total Times Completed1278
Python Completions701
JavaScript Completions561
Ruby Completions49
Total Stars69
% of votes with a positive feedback rating86% of 196
Total "Very Satisfied" Votes152
Total "Somewhat Satisfied" Votes34
Total "Not Satisfied" Votes10
Ad
Contributors
  • hwtdstrngls Avatar
  • jhoffner Avatar
  • ZozoFouchtra Avatar
  • GiacomoSorbi Avatar
  • smile67 Avatar
  • rowcased Avatar
  • hobovsky Avatar
  • Haksell Avatar
  • mauro-1 Avatar
  • dfhwze Avatar
  • Just4FunCoder Avatar
Ad