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

loop-grid

v6.1.0

Published

An observable collection of looped event sequences shaped to a grid.

Downloads

28

Readme

loop-grid

An observable collection of looped event sequences shaped to a grid.

Install via npm

$ npm install loop-grid

API

var LoopGrid = require('loop-grid')

var loopGrid = LoopGrid(options)

Returns an observable instance of LoopGrid.

options:

  • scheduler: (required) instance of Bopper
  • triggerEvent: (required) function(event) called for every event to be triggered
  • audio: (required) instance of AudioContext

loopGrid()

Return the current object descriptor (state).

loopGrid.set(descriptor)

Set the current object descriptor (state).

loopGrid.shape (Observ([rows, cols]))

Included in state.

loopGrid.loops (Observ([ { length: 8, events: [] }, ... ]))

Included in state.

loopGrid.targets (Observ([ids]))

Mapping of grid loops to ids.

Included in state.

loopGrid.loopLength (Observ(8))

Included in state.

var removeListener = loopGrid.onEvent(listener)

var event = {
  id: String,
  event: 'start' | 'stop',
  position: Number, // beat
  time: Number, // based on
  args: Array
}

var value = loopGrid.loopPosition()

var removeListener = loopGrid.loopPosition(listener)

var arrayGrid = loopGrid.grid()

Returns ArrayGrid based on loopGrid.targets and loopGrid.shape.

`var removeListener = loopGrid.grid(listener)

var grid = loopGrid.playing()

Returns ArrayGrid of true values where target is currently being triggered.

var removeListener = loopGrid.playing(listener)

var grid = loopGrid.active()

Returns ArrayGrid of true values where target has a current loop.

var removeListener = loopGrid.active(listener)

loopGrid.destroy()

Looper

var Looper = require('loop-grid/looper')

var looper = Looper(loopGrid)

var loops = looper()

var removeListener = looper(listener)

var currentlyRecording = looper.recording()

var removeListener = looper.recording(listener)

looper.store()

looper.flaten()

var releaseTransform = looper.transform(func(input, args..), args)

Pass in a function to add to transform stack. input is an instance of ArrayGrid and should return either the modified input or a new instance of ArrayGrid.

looper.undo()

looper.redo()

looper.isTransforming()

Computed Flags

var computeFlags = require('loop-grid/compute-flags')

Computed Targets

var computeTargets = require('loop-grid/compute-targets')

Selector

Range selector for loop-grid.

API

var Selector = require('loop-grid/selector')

var selection = Selector(shape)

Returns an extended instance of ObservGrid with shape specified.

selector.start(inputGrid, done)

Pass in an observable ArrayGrid. done will be called on stop or before subsequent start.

Any truthy values will trigger a selection. Simultaneous true values will trigger range selection. selection will have .set(selectedIndexes) called on every change.

selector.clear()

Sets selection to an empty array.

selector.stop()

Release watch of inputGrid and call done.

Transforms

Holder

Beat stutter/looper

var Holder = require('loop-grid/transforms/holder')

var holder = Holder(transform)

Pass loopGrid.transform to this constructor.

holder.setLength(length)

Choose the length (in beat decimal) of the stutter effect.

holder.start(position[, indexes, done])

Loop events in specified indexes (or all if not specified) from position to position + length. Ensure each event length is no longer than specified length (truncating if necessary).

Automatically calls holder.stop() first if there is a current hold in progress.

holder.stop()

Release transform and call done if specified.

Mover

Move selected ranges of loops to new origin.

var Mover = require('loop-grid/transforms/mover')

var mover = Mover(transform)

Pass loopGrid.transform to this constructor.

mover.start(inputGrid, selectedIndexes, done)

Finds the top-left most coordinates in selectedIndexes, and uses this as the start origin. Any true values in inputGrid will call transform with a function that moves the values from selectedIndexes to the new origin. Multiple true values will cause the selectedIndexes to be duplicated.

mover.stop()

Release any pending transform and stop watching inputGrid.

Repeater

var Repeater = require('loop-grid/transforms/repeater')

`var repeater = Repeater(transform)

Pass loopGrid.transform to this constructor.

repeater.start(inputGrid, length)

Held notes will call transform with a function that creates a repeating note with length length / 2 at the rate of specified length.

repeater.setLength(length)

repeater.stop()

Release the inputGrid.

Suppressor

Suppress selected loops

var Suppressor = require('loop-grid/transforms/suppressor')

var suppressor = Suppressor(transform, shape[, stride])

Pass loopGrid.transform to this constructor.

Returns an extended observ instance containing instances of array-grid with true values at coords where currently suppressed.

suppressor.start(indexes, done)

Calls transform with a function that suppresses all indexes specified.

suppressor.stop()

Release suppression transform.

License

AGPL-3.0