Giter VIP home page Giter VIP logo

ricardomatias / playa Goto Github PK

View Code? Open in Web Editor NEW
75.0 7.0 3.0 4.95 MB

A framework for musical composition. It allows creating custom music algorithms, musical phrases, percussion rhythms, harmonic sequences and more.

Home Page: https://ricardomatias.net/playa

License: Open Software License 3.0

JavaScript 3.74% TypeScript 96.22% Shell 0.04%
music javascript webaudio midi music-theory music-composition algorave playa

playa's Introduction

Playa

npm license build Coverage Status Bundlephobia min + gzip

PLAYA (pronounced ˈpleɪə) is a framework for musical composition. It allows creating custom music algorithms, musical phrases, percussion rhythms, harmonic sequences and more.

Install

npm install --save playa

Usage

ES6 Modules

import { Chord, Key, Rhythm } from 'playa';

// or everything
import * as Playa from 'playa';

Common JS (Node)

const { Chord, Key, Rhythm } = require('playa');

// or everything
const Playa = require('playa');

Example

import { Scale, createMotif } from 'playa';

const scale = new Scale('A', Scale.Major);

createMotif(scale.notes, ['4n', '2n', '8nt']);
/* =>
[
    { time: 0, dur: 480, next: 480, midi: 73, note: 'C#4', isRest: false },
    { time: 480, dur: 960, next: 1440, midi: 80, note: 'G#4', isRest: false },
    { time: 1440, dur: 160, next: 1600, midi: 74, note: 'D4', isRest: false }
]
*/

Guides

Interactive guide here which uses Tone.js for the sound.

An example of using PLAYA with P5 and Tone.js - PLAYA meets P5

Documentation

Can be found here.

Templates

License

Open Software License 3.0

playa's People

Contributors

dependabot[bot] avatar ricardomatias avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

playa's Issues

Cannot find module 'Function/Curry'

When I try to compile my project, I get the following error:

node_modules/playa/build/types/tools/event.d.ts:43:46 - error TS2307: Cannot find module 'Function/Curry' or its corresponding type declarations.

43 export declare const mapStartToEvent: import("Function/Curry").Curry<(startTime: TimeFormat, event: Event) => Event>;
                                                ~~~~~~~~~~~~~~~~

Found 1 error in node_modules/playa/build/types/tools/event.d.ts:43

I'm running Windows 10 btw

Documentation

Guides

  • How to use it with Tone.js

Todo

  • Add examples to all classes/methods
  • Fix Event linking
  • Fix Turn return type to TurnEvent

[Key] Modulation constraints

Add ways to constraint modulation in order to control the level of dissonance between modulations. A way could be defining which modes are available per modulation.

Convert melodies to ABC notation?

Hello there.
Do you think it'd be possible to add a function to convert whatever melodies come out to AbcNotation?
I'm a musician and I've found your library really cool, generating random melodies and progressions, and I just think it'd be even cooler if we could get an abcNotation to toss in a abc-> sheet generator and get cool sheets out of randomized progressions. Tonal has a way apparently, but I'm no programmer and I've found it really hard trying to understand how to work out the timings from the melody instance so that I can add them to the notes and then use Tonal's function to generate the abcNotation. If not the full thing, maybe we could get an additional key to the Melody instance, next to (time,dur,next,midi,note) maybe a classic timing like '4n' ?

Anyways enough rambling, sorry if this isn't the right place for this but I just had to reach somehow. Cool stuff and keep it up

Add Arpeggiator

const aMin = new Key('A', Key.MINOR);

new Arp(aMin, [ 1, 5, 7, 6 ], ['4n', '8n', '2n']);

Add Phrase (Piano Roll)

New entity: Phrase. Creates musical phrases through a generator-like usage.

Requirements

  • .next() to move the musical phrase onwards or else it plays the same
  • Has a key
  • Can play notes outside of a key (depending on circle of fifths)
  • Rests (doesn't always play)
  • Has styles f.ex: motif
  • Phrases can have multiple notes playing at the same time

Goals:

  • Base for the creation of instrument-like playing, such as a piano (left+right hand)
  • Allows creating descending/ascending patterns/arpeggios which span more than 1 octave

Rhythms should not be all 'legato'

At the moment, the duration property of the event decides when the next event will be played. It should not be the case.

Rhythm generating tools must make use of an internal property to allow staccato and other "rhythm" styles.

[Random] Add separate methods for noise values

At the moment every random value is from SimplexNoise. There should be methods to get non-noise random values.

Places to use non-noise values:

  • movement/helpers modulate (interval selection)

[Analysis] Dissonance

Given a list of notes, analyze the level of dissonance and return a factor between [0, 1]

Add piano roll pointers to core musical entities

Musical entities (Scale, Chord, Key) should not have a closed range of musical notes. They should start somewhere in the piano roll and then be able to move.

Having a Cmaj starting at C3 (C3, E3, G3)

  • Move N octaves Up/down
  • Spread along N octaves, f.ex: 2 octaves -> C3, E3, G4
  • Repeat at another octave

Find better name for Tools or add public Utilities

The Sequence class doesn't belong in tools.
choose is more of a utility than a tool.

Perhaps migrate the current Utils to sub-folders of the categories they belong to OR rename to Common. Either way they are considered private.

choose -> Utilities
current utils -> Common
Functional merges with Tools

  • Investigate other names for Tools

Add/Replace Grid rhythm with overlapping method

  • Create grids with different resolutions
  • Think of all the grids stacked vertically
  • An interval tree with overlapping events

Strategy

  • Roll the dice, HIT or REST
  • Roll the dice, which resolution
  • Check if the interval is empty
    • Empty -> add the event and move the cursor to the end of this event's interval
    • Filled -> Move the cursor to the next empty cell which is free and insert the event

Add live examples

Add examples using Tone JS where there's actual music and not abstractions.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.