Find what time (in second) spend to play note in musicxml file -


i have note

<note default-x="106.96" default-y="-25.00">     <pitch>       <step>a</step>       <octave>3</octave>     </pitch>     <duration>2</duration>     <voice>1</voice>     <type>eighth</type>     <stem>up</stem>     <staff>1</staff>     <beam number="1">begin</beam> </note> 

how can find time spend play (in second) if tempo = 120bpm ?

create table this:

durationhashtable = { { "whole", 4.0 }, { "half", 2.0 }, { "quarter", 1.0 }, { "eighth", 0.5 }, { "16th", 0.25 } } 

then, formula is:

notedurationseconds = ( 60.0 / beatsperminute ) * durationhashtable["eighth"]; 

this special, simple case where

  • notes not dotted
  • the time signature has <beat-type>4</beat-type>
  • you not required support tuplets.

things can become more complex, recommend working special case first.


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -