JSPM

musical-note-frequency

1.0.3
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 8
    • Score
      100M100P100Q32207F
    • License MIT

    A package to calculate musical note frequencies

    Package Exports

    • musical-note-frequency
    • musical-note-frequency/dist/app.js

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (musical-note-frequency) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    Musical Note Frequency Calculator

    A simple package to calculate the frequency of musical notes based on their name and octave.

    Installation

    Install the package via npm:

    npm install musical-note-frequency

    Usage

    Here's how to use the package to calculate the frequency of notes:

    import { getNoteFrequency } from 'musical-note-frequency';
    import { calculateNoteFrequency } from 'musical-note-frequency/dist/music-theory';
    
    // Get formatted frequency string
    console.log(getNoteFrequency('A', 4)); // Outputs: "The frequency of A4 is 440.00 Hz"
    
    // Get the exact frequency as a number
    console.log(calculateNoteFrequency('C', 4)); // Outputs: 261.6255653005986
    

    API

    calculateNoteFrequency(note: NoteName, octave: Octave): number

    Calculates the frequency of a given note and octave.

    • note: The note name (e.g., 'C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B', 'Cb', etc.)
    • octave: The octave number (0 to 8)

    getNoteFrequency(note: NoteName, octave: Octave): string

    Returns a formatted string with the note and its frequency.

    • note: The note name (e.g., 'C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B', 'Cb', etc.)
    • octave: The octave number (0 to 8)

    Example Output

    • The frequency of A4 is 440.00 Hz
    • The frequency of C4 is 261.63 Hz

    EASY

    NOW GO, MAKE A GREAT MUSIC APP