npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

sacred-music

v1.2.1

Published

A package for musical note conversion, e.g. C D E F -> SA RE GA ma

Downloads

14

Readme

SaCReD Music

A package to convert eastern to western musical notation, for example, SA RE GA ma to C D E F.

Installation

npm install --save sacred-music

Description

This node package provides a functionality which takes eastern notations either in Bangla (Bengali) or English alphabet, and converts into western notations in English alphabet.

Melodies of Bangla songs are commonly confined within three octaves:

  • Lower octave ( Mondro Shoptok or মন্দ্রসপ্তক ),
  • Middle octave ( Moddho Shoptok or মধ্যসপ্তক ),
  • Upper octave ( Tara Shoptok or তারাসপ্তক ).

Middle Octave

In this package, we have denoted the 12 notes of the Middle Octave as:

SA re RE ga GA ma MA PA da DHA ni NI

or

সা ঋ রে জ্ঞা গা মা হ্মা পা দা ধা ণি নি

Lower Octave

The 12 notes of the Lower Octave is denoted by putting an Underscore ( _ ) as suffix to the any note of the middle octave. Hence the notes are:

SA_ re_ RE_ ga_ GA_ ma_ MA_ PA_ da_ DHA_ ni_ NI_

or

সা_ ঋ_ রে_ জ্ঞা_ গা_ মা_ হ্মা_ পা_ দা_ ধা_ ণি_ নি_

Upper Octave

The Upper Octave 12-notes are denoted by suffixing a middle octave note by an Asterisk ( * ). Hence:

SA* re* RE* ga* GA* ma* MA* PA* da* DHA* ni* NI*

or

সা* ঋ* রে* জ্ঞা* গা* মা* হ্মা* পা* দা* ধা* ণি* নি*

The Tonic

The tonic string should be specified by the user. Below, we present the writing convention of chromatic scale for C5 :

| Note (5th octave) | String | | ----- | ------ | | C | 'C5' | | C♯/ D♭ | 'Cs5' | | D | 'D5' | | D♯/ E♭ | 'Ds5' | | E | 'E5' | | F | 'F5' | | F♯/G♭ | 'Fs5' | | G | 'G5' | | G♯/A♭ | 'Gs5' | | A | 'A5' | | A♯/B♭ | 'Bf5' | | B | 'B5' |

For different octaves, just change the octave-number, e.g. 'C1', 'C2', etc.

API

  • function relativeToAbsolute( inputNoteString, tonic )

    Input inputNoteString : String - any string containing eastern notes, tonic : String - a tonic string (see the table above).

    Returns Western notes in an Array corresponding to inputNoteString.

    Example

    var sacredMusic = require('sacred-music');
    var notes = 'SA RE GA ma পা ধা নি সা*';
    var tonic = 'C4';
    var output = sacredMusic.relativeToAbsolute(notes, tonic);
            
    console.log(output);
    // Expected console-output:
    //  [ 'C4', 'D4', 'E4', 'F4', 'G4', 'A4', 'B4', 'C5' ]
  • function getSongDetails( inputNoteString )

    Input inputNoteString : String - any string containing eastern notes.

    Returns an object, say, songDetail which contains:

    • noteList: Array - The list of all notes from user input (sequentially),
    • noteSet: Array - The Set of unique notes, i.e. no notes occuring twice in this array,
    • bars : Array of arrays - Each element is an array and represents a Bar. Bars (also called measures in literature) are seperated by a slash ( / ).
    • noOfBars: Integer - Number of bars in the song.
    • barsWithNoteCount: Array of arrays - Each element is a subarray. An elements of a subarray represents the number of notes located in that specific position.

    Example

    var sacredMusic = require('sacred-music');
    var notes = 'sa+re ga sa+re ga / re+ga+sa ga re sa / ga re sa re';
    var songDetail = sacredMusic.getSongDetails(notes);
    console.log(songDetail);
    
    // expected output:
    { 
      noteList: [ 'sa','re','ga','sa','re','ga','re','ga','sa','ga','re','sa','ga','re','sa','re' ],
      noteSet: [ 'sa', 're', 'ga' ],
      bars: [ 'sa+re ga sa+re ga', 're+ga+sa ga re sa', 'ga re sa re' ],
      noOfBars: 3,
      barsWithNoteCount: [ [ 2, 1, 2, 1 ], [ 3, 1, 1, 1 ], [ 1, 1, 1, 1 ] ] 
    }

    Notice, for example, (songDetail.barsWithNoteCount[1])[0] = 3 corresponds to re+ga+sa in the input string.

Invalid input

If the you input an arbitrary string which does not contain any of the easter notes, dont worry. It will report the invalidity of the note with an error message.

FAQ

  • Why on earth it is named sacred music? Does it have anything to do with religion or so?

    Nope. In fact if you take C as tonic, then SA converts to C and Re converts to D. Now guess, why it's sacred! And music is because somebody already published a node package with the name sacred. Alas! Feel free to stick to the faith that it is something sacred if you haven't still crunched the riddle. ;-)