Giter Site home page Giter Site logo

markovian-media's Introduction

markovian-media

npm dependencies npm dev dependencies license npm bundle size (minified) npm bundle size (minified + gzip) node version compatibility npm current version

Quick start

As an isomorphic JavaScript package, there are multiple ways for clients, servers, and bundlers to start using this library. Several methods do not require installation.

RunKit

RunKit provides one of the least difficult ways to get started:

CodePen

Declare imports in the JS section to get started:

import { takeOnWreckingBall } from 'https://unpkg.com/markovian-media@latest?module';
const song = takeOnWreckingBall();
console.log(song);
// example output: 'i guess i never meant to be gone...'

Browsers

Insert the following element within the <head> tag of an HTML document:

<script src="https://unpkg.com/markovian-media@latest"></script>

After the script is loaded, the markovianMedia browser global is exposed:

const song = markovianMedia.takeOnWreckingBall();
console.log(song);
// example output: 'i guess i never meant to be gone...'

Node.js

With npm installed, run terminal command:

npm i markovian-media

Once installed, declare method imports at the top of each JavaScript file they will be used.

ES2015

Recommended

import { takeOnWreckingBall } from 'markovian-media';

CommonJS

const { takeOnWreckingBall } = require('markovian-media');

Usage

Generate a random song

takeOnWreckingBall();
// example output: 'i guess i never meant to be gone...'

Generate a specific song

Optionally providing seeds generates deterministic media.

const seeds = [
  74,
  40,
  83,
  115,
  110,
  108,
  158,
  204,
  245,
];

takeOnWreckingBall(seeds);
// output: 'i guess i never meant to be gone...'

Media catalogue

Providing methods with optional seeds generates deterministic media. This section lists a seed or seeds that generate titled works.

Essays

title method seed
In Those of the Understanding despondency 5003
Reading reading 1

Songs

title method seeds
"I Can't Live a Wrecking Ball" takeOnWreckingBall [74, 40, 83, 115, 110, 108, 158, 204, 245]
"I Want to Boogie Woogie" musicQueen [146, 114, 183, 189, 173, 98, 179, 163]

API

All essay methods accept seed, an optional Number.

All song methods accept seeds, an optional Array of Numbers.

All methods return a String.

Single-seed methods

  • despondency
  • reading

Omit seed to generate random media.

Multiple-seed methods

method number of optional seeds
musicQueen 8
takeOnWreckingBall 9

Omit all seeds to generate random media.

Omit some seeds to generate a random and deterministic media combination. Substitute any numbers with null to randomize those specific seeds (e.g.: seeds = [1, 2, null, 4] is 25% random, 75% deterministic).

Learn more

This package is powered by markovian-nlp, available on npm and GitHub.

markovian-media's People

Contributors

stassi avatar

Watchers

James Cloos avatar

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.