Coder Social home page Coder Social logo

tidal.pegjs's People

Contributors

charlieroberts avatar mariana0pachon 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

Watchers

 avatar  avatar  avatar  avatar

tidal.pegjs's Issues

query with non zero start is wrong

Hello, first of all, thanks for this fantastic port of tidal syntax to JS!
I am currently implementing a little live coding playground with it, and realized that when I create a pattern and start querying from a non zero start, the result has the wrong phase.

This works:

const values = (e) => e.value;
const pattern = Pattern('[A <B C>]')
expect(pattern.query(0, 1).map(values)).toEqual(['A', 'B']);
expect(pattern.query(1, 1).map(values)).toEqual(['A', 'C']);

This does not work

const values = (e) => e.value;
const pattern = Pattern('[A <B C>]')
// expect(pattern.query(0, 1).map(values)).toEqual(['A', 'B']);
expect(pattern.query(1, 1).map(values)).toEqual(['A', 'C']); // yields ['A', 'B']

I think I can work around the problem, but it would be much easier if query had no side effects.
FYI I also wrote a little post about this lib.

Commas arent recognized

console.log(parser.parse('[bd,hh]'))

outputs

{ '0': { '0': { type: 'string', value: 'bd' }, type: 'group' },
  '1/2': { '0': { type: 'string', value: 'hh' }, type: 'group' },
  type: 'layer' }

instead of

{ '0': { '0': { type: 'string', value: 'bd' }, type: 'group' },
  '0': { '0': { type: 'string', value: 'hh' }, type: 'group' },
  type: 'layer' }

Pattern problem ?

Is this expected that this sequence works fine
'<0.5 .5/*2>'
but this one doesn't
'<.5/*2>'

( at least in gibber v2 ) ?

Note that I put a forward slash before the '*' so that it is displayed correctly in GitHub but it shouldn't be there in reality.

It looks like the parser doesn't expect the first atom to have a multiplier ?

Getting `npm install tidal.pegjs` to work

Current issues seem to be:

  1. When you npm install tidal.pegjs, there is no ./dist/tidal.js because pegjs tidal.pegjs has not been run.
  2. If you manually ensure tidal.js exists and do import {Pattern} from 'tidal.pegjs' you get 'Pattern' is not exported by node_modules/tidal.pegjs/src/pattern.js.
  3. If you do import * as Tidal from "tidal.pegjs" you get Uncaught ReferenceError: util is not defined.

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.