Felix Roos b04a262433 Publish
- @strudel/codemirror@0.11.0
 - @strudel/core@0.11.0
 - @strudel/csound@0.11.0
 - @strudel/embed@0.11.0
 - @strudel/hydra@0.11.0
 - @strudel/midi@0.11.0
 - @strudel/mini@0.11.0
 - @strudel/osc@0.11.0
 - @strudel/repl@0.11.0
 - @strudel/serial@0.11.0
 - @strudel/soundfonts@0.11.0
 - @strudel/tonal@0.11.0
 - @strudel/transpiler@0.11.0
 - @strudel/web@0.11.0
 - @strudel/webaudio@0.11.0
 - @strudel/xen@0.11.0
2024-01-18 09:59:57 +01:00
..
2023-11-16 07:25:20 +01:00
2024-01-18 09:59:57 +01:00
2023-12-30 23:21:34 +01:00

@strudel/transpiler

This package contains a JS code transpiler with the following features:

  • add locations of mini notation strings (double quoted or backticked) for highlighting
  • converts pseudo note variables to note strings
  • adds return statement to the last expression

Install

npm i @strudel/transpiler

Use

import { transpiler } from '@strudel/core';
import { evaluate } from '@strudel/core';

transpiler('note("c3 [e3,g3]")', { wrapAsync: false, addReturn: false, simpleLocs: true });
/* mini('c3 [e3,g3]').withMiniLocation(7,17) */

evaluate(note('c3 [e3,g3]'), transpiler); // returns pattern of above code