martijnversluis/ChordSheetJS

song.transpose not allowing to transpose to different keys with same distance

Closed this issue · 4 comments

For example if I have a song I want to transpose to Bb from E, it would transpose it to A#.

I have managed to alleviate this problem by double checking the resulting song object key and running the transpose like this:

  let transposedSong = song.transpose(transposeDistance, {
  normalizeChordSuffix: true,
  });
  if (transposedSong.key != key) {
    transposedSong = transposedSong.transposeUp().transposeDown();
  }
  if (transposedSong.key != key) {
    transposedSong = transposedSong.transposeDown().transposeUp();
  }

Would it instead be possible to transpose to key?
That is essentially what I am achieving with that code.

Het @rabadashTheFool. Thanks for reporting this. This looks like an issue with the same cause as #1050. However, I'm putting this on the board to be investigated.

@rabadashTheFool I just released 8.5.1 containing a fix for #1050. Could you try and see if that also solves this issue?

Hi! This was separate to the setCapo issue at #1050 .
This is more in line of a new feature request. This would enable transposing to a key, rather than distance, since some keys have the same distance (e.g. Db and C#)

Hey @rabadashTheFool. I just published 10.3.0, which includes a fix for this bug. Please let me know if it helps you!