Coder Social home page Coder Social logo

sfzlint's Introduction

Linter and parser for .sfz files

CLI programs are mostly done.

Includes the sfzlint and sfzlist command line utilities sfzlint will parse and validate sfzfiles. If a directory is passed it will be recursivly searched for sfz files.

$ sfzlint path/to/file.sfz
path/to/file.sfz:60:11:W continuous not one of ['no_loop', 'one_shot', 'loop_continuous', 'loop_sustain'] (loop_mode)
path/to/file.sfz:98:18:W 8400 not in range -1 to 1 (fileg_depthccN)
path/to/file.sfz:107:12:E expected integer got 0.1 (lfoN_freq)
path/to/file.sfz:240:1:W unknown opcode (ampeg_sustain_curveccN)

sfzlist will print a list of known opcodes and metadata to stdout. Callig with --path will cause it to print opcodes found in that path

$ sfzlist --path /sfz/instra/Scarypiano/
amplitude_onccN aria Range(0,100) modulates=amplitude
lokey v1 Range(0,127)
ampeg_release_onccN v2 Alias(ampeg_releaseccN)
label_ccN aria Any()
bend_up v1 Range(-9600,9600)

Opcode data is from sfzformat.com. If you see a bug in syntax.yml consider putting you PR against the source

Features

  • syntax validation
  • checks opcodes against known opcodes on sfzformat.com
  • validates opcode values when min or max or type are defined in the spec
  • validates *_curvecc values above 7 have a corresponding <curve> header
  • checks that sample files exists, also checks that case matches for portability with case-sensitive filesystems
  • pulls in #includes and replaces vars from #defines
  • validation based on aria .xml files

HowTo

If you have a project that is seperated into several .sfz files using #include macros Example:

instra.sfz
samples/
   a#1.wav
   b1.wav
   ...
includes/
   piano.sfz
   forte.sfz
   ...

To validate the whole project you can use sfzlint --check-includes instra.sfz. Running sfzlint against a program .xml file will check includes by default. If you run sfzlint includes/piano.sfz and piano.sfz has some sample opcodes you may get file not found errors. To fix this run with --rel-path

sfzlint includes/piano.sfz --rel-path .

Installing

I've not put this on pypi yet. You can install with pip

pip install git+git://github.com/jisaacstone/sfzlint.git

Or clone the repo and use python setup.py install

Both methods require python version >= 3.6

To use with vim/neomake:

(This is what I built this thing for)

put the following in your .vimrc:

au BufNewFile,BufRead *.sfz set filetype=sfz
let g:neomake_sfz_enabled_makers=['sfzlint']
let g:neomake_sfzlint_maker = {'exe': 'sfzlint', 'errorformat': '%f:%l:%c:%t %m'}

sfzlint's People

Contributors

jisaacstone avatar

Watchers

James Cloos avatar  avatar

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.