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 provides one of the least difficult ways to get started:
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...'
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...'
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.
Recommended
import { takeOnWreckingBall } from 'markovian-media';
const { takeOnWreckingBall } = require('markovian-media');
takeOnWreckingBall();
// example output: 'i guess i never meant to be gone...'
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...'
Providing methods with optional seeds generates deterministic media. This section lists a seed
or seeds
that generate titled works.
title | method | seed |
---|---|---|
In Those of the Understanding | despondency |
5003 |
Reading | reading |
1 |
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] |
All essay methods accept seed
, an optional Number.
All song methods accept seeds
, an optional Array of Numbers.
All methods return a String.
despondency
reading
Omit seed
to generate random media.
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).
This package is powered by markovian-nlp, available on npm and GitHub.