markovian-media v1.2.3
markovian-media
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.