A react component which will render a piano scale with variable parameters as input

Dynamic Scale

This is repository exports a react component which will render a piano scale with variable parameters as input. It is highly customisable. It is generated dynamically by passing as props the required parameters using html <svg> component.

The component is bundled into an NPM package using rollup

Example Screenshots

image

image

image

Scale functional Component

<Scale /> will be an independent standalone function that will genereate the required piano scale using all the input parameters

<Scale
    labels = true
    half = false
    start = 'C'
    pressed = [0,1,2,3,4,5,6,7,8]
    color_black = '#ff0055' 
    color_white = '#aa0044'
    width = '600px'
/>

All Props and Types:

Labels flagged with * Are mandatory
  • labels : Boolean
  • Displays key labels on the white keys if set true
  • Default : true

  • half : Boolean
  • Makes a scale of standard seven white keys if value is true. Otherwise the Scale will consist of 7 + 3 white keys.
  • Default : true

  • start : String -or- Char
  • Starts the scale with the character that is passed as the parameter to be the first key of the scale. Note that only the notations for white keys may be passed. As starting key should always be white. The preceeding or succeeding black key if present will be visible with half of it displayed.
  • Default : “C”
  • Accepted Values : [‘C’, ‘D’, ‘E’, ‘F’, ‘G’, ‘A’, ‘B’]

  • pressed : Array [12 | 17]
  • Higlights the keys which are to be shown as pressed, with the color passed to the color_white and the color_black parameters. The Array will contain position of the keys to be pressed starting from the white key which was set to the start parameter. 0 for the key which should not be pressed 1 for the key to be pressed and so on. The numbers are going to be the respective position of the said key from the start key. Whatsoever key position is present in the array, will be highlited in color.
Note that the size of the array should be 12 for a half scale with 7 white keys, and 17 for a full scale with 10 white keys
  • Default : [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

  • color_black : String
  • Will set the pressed black keys to be the color passed to this parameter.
  • Default : #FF0055

  • color_white : String
  • Will set the pressed white keys to be the color passed to this parameter.
  • Default : #AA0044

  • width * : String
  • Sets the width of the finally rendered component. This parameter corresponds to a in-line jsx width.

GitHub

View Github

Related Posts

Recent Posts

ഇടുക്കിയിലെ മലയോര മേഖലകളിൽ രാത്രിയാത്ര നിരോധിച്ചു. രാത്രി ഏഴു മുതൽ രാവിലെ ആറു വരെയാണ് നിരോധനം

ഏന്തയാർ ഈസ്റ്റിൽ പ്രളയത്തിൽ തകർന്ന പാലത്തിന് പകരം പുതിയ പാലം നിർമ്മിക്കുവാൻ താത്ക്കാലിക പാലം പൊളിച്ച് നീക്കി

Explore the Investment Opportunities: A Comprehensive Guide to Different Types of Mutual Funds

Title: Understanding Mutual Funds: A Beginner's Guide to Investing

തീവ്രമഴ മുന്നറിയിപ്പിന്റെ പശ്ചാതലത്തിൽ സംസ്ഥാനം ജാഗ്രതയിൽ

250,000 അപേക്ഷകൾ വർദ്ധിച്ചതിനാൽ ട്രാൻസ്‌പോർട്ട് കമ്മീഷണർ പരിശോധന പുനരാരംഭിക്കും

ഏലക്കയിൽ കീടനാശിനി സാന്നിധ്യം; ആറര ലക്ഷത്തിലധികം ടിൻ അരവണ നശിപ്പിക്കാൻ ടെൻഡർ ക്ഷണിച്ച് ദേവസ്വം ബോർഡ്‌

ഭീമൻ പാറക്കഷണങ്ങൾ അടർന്ന് ദേശീയ പാതയിലേക്ക് വീഴുന്നത് പതിവാകുന്നു. കുട്ടിക്കാനത്തിനും മുണ്ടക്കയത്തിനുമിടയിൽ നിലനിൽക്കുന്നത് വൻ അപകട ഭീഷണി

ചക്രവാതച്ചുഴി:അതിശക്തമായ മഴ വരുന്നു

പ്ലസ് വൺ പ്രവേശനം. അക്ഷയയിൽ തിക്കി തിരക്കേണ്ട, നെറ്റിവിറ്റി/ജാതി തെളിയിക്കാൻ പത്താംതരം സർട്ടിഫിക്കറ്റ് മതി