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

maestro-wizard

v1.9.3

Published

MaestroWizardJS is a versatile JavaScript library for web-based music applications, enabling you to effortlessly play notes, chords, and melodies directly in the browser. It leverages the Web Audio API to generate sound, providing a simple yet powerful in

Downloads

23

Readme

MaestroWizardJS

MaestroWizardJS is a versatile JavaScript library for web-based music applications, enabling you to effortlessly play notes, chords, and melodies directly in the browser. It leverages the Web Audio API to generate sound, providing a simple yet powerful interface for music programming.

Features

  • Play Individual Notes: Easily play single musical notes.
  • Chord Support: Combine multiple notes to play chords.
  • Melody Playback: Sequence notes to create and play melodies.
  • Frequency Conversion: Convert musical notes to their corresponding frequencies.
  • Customizable Oscillator: Choose from various waveforms for sound synthesis.

Installation

npm install maestro-wizard

Usage of MaestroWizard - play simple notes and melodies

First, import MaestroWizard into your project:

import MaestroWizard from 'maestro-wizard';

Then, create a new instance of MaestroWizard:

const maestro = new MaestroWizard();

Playing a note

maestro.play('C4', 0, 0.5);

Play a melody

Use a dash (-) to indicate holding the previous note for an additional beat. Use a period (.) to represent a rest, where no note is played.

maestro.playMelody(['C4', 'D4', 'E4', 'F4', 'G4', 'A4', 'B4', 'C5'], 120);

API

play(note, startTime, duration)

Plays a single note.

  • note: The note to play. Can be a string or a number.
  • startTime: The time, in seconds, at which to play the note.
  • duration: The duration, in seconds, of the note.

playChord(notes, duration)

Plays a chord.

  • notes: An array of notes to play. Can be an array of strings or numbers.
  • duration: The duration, in seconds, of the chord.

playMelody(notes, tempo)

Plays a melody.

  • notes: An array of notes to play, or a string of space-separated notes.
  • tempo: The tempo, in beats per minute, of the melody.

setOscillatorType(type)

Sets the oscillator type.

  • type: The oscillator type. Can be one of the following: 'sine', 'square', 'sawtooth', 'triangle', 'custom'.

SongCreator - create tracks by overlaping melodies and tracks

First, import SongCreator into your project:

import SongCreator from 'songCreator';

Then, create a new instance of SongCreator:

const maestro = new SongCreator();

Methods

addSequence

  • addSequence(noteObjects, options): Adds a new sequence to the song.
    • noteObjects (Array): An array of note objects to be played in the sequence.
    • options (Object): Optional settings for the sequence including loop and distortion.

playSequence

  • playSequence(sequence, audioContext): Plays a specific sequence.
    • sequence (Object): The sequence to play.
    • audioContext (AudioContext): The audio context to use for playing the sequence.

noteToFrequency

  • noteToFrequency(note): Converts a musical note to its corresponding frequency.
    • note (string): The musical note to convert.

createDistortion

  • createDistortion(audioContext): Creates a distortion effect.
    • audioContext (AudioContext): The audio context for the distortion.

play

  • play(): Plays all sequences in the song.

addTimedTrack

  • addTimedTrack(startTime, endTime): Adds a track with specified start and end times.
    • startTime (number): The start time of the track in seconds.
    • endTime (number): The end time of the track in seconds.

playSong

  • playSong(): Schedules and plays the entire song with all tracks and their sequences.

stopTrack

  • stopTrack(track): Stops all sequences in a track.
    • track (Object): The track to stop.

playTrack

  • playTrack(track): Plays a single track.
    • track (Object): The track to play.

addSequenceToTrack

  • addSequenceToTrack(trackIndex, noteObjects, options): Adds a sequence with specific configurations to a track.
    • trackIndex (number): The index of the track.
    • noteObjects (Array): An array of note objects to be played.
    • options (Object): The options for the sequence (start time, end time, loop, distortion).

License

MaestroWizardJS is open-source and available under the MIT License.