GithubHelp home page GithubHelp logo

Comments (3)

martijnversluis avatar martijnversluis commented on July 29, 2024

Hi @ashish-ch-98. Thanks for your question. I'm not sure what you mean though:

  • are you using ChordFiddle and do you want to reset the chord sheet to the initial key? That is not a feature at the moment.
  • are you using a combination of ChordSheetJS and ChordJS and do you want to reset the chord sheet to the initial key? I could think of two solutions:
    • store multiple versions of the chord sheet in memory, at least the first one
    • keep track of how many steps the chord sheet has been transposed. For example, if the current chord sheet is netto transposed +4, you can reset the chords with chord.transpose(-4)

Please let me know if this answers your question.

from chordsheetjs.

ashish-ch-98 avatar ashish-ch-98 commented on July 29, 2024

Thank you for your help.

I am using a combination of ChordSheetJS and ChordJS. I put a reset button which should be transposing the chord sheet to the initial key. I executed it using react hooks. For some transpose operations using up and down buttons, the reset function worked fine but after a while, it starts transposing to a key near to the new transposed key.

Here is my code for reset function:

const [count, setCount] = useState(0)

function reset(){
   setKey(key.transpose(-count))
    song.lines.forEach(line => {
      line.items.forEach(item => {
        let chord = Chord.parse(item.chords)
        if(chord){
          chord = chord.transpose(count)
          item.chords = chord
        }
      })
    })
  }

from chordsheetjs.

martijnversluis avatar martijnversluis commented on July 29, 2024

Nice @ashish-ch-98 !

from chordsheetjs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.