Skip to main content

parser and linter for sfz files written in python

Project description

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 pyyaml
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'}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sfzlint-0.1.4.tar.gz (30.9 kB view details)

Uploaded Source

Built Distribution

sfzlint-0.1.4-py3-none-any.whl (32.2 kB view details)

Uploaded Python 3

File details

Details for the file sfzlint-0.1.4.tar.gz.

File metadata

  • Download URL: sfzlint-0.1.4.tar.gz
  • Upload date:
  • Size: 30.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.10

File hashes

Hashes for sfzlint-0.1.4.tar.gz
Algorithm Hash digest
SHA256 d9fdf7549288868d6b9a51489b163c06d733dceca904a3a1059abb455cd8e60f
MD5 1b0d86ff574c8d4d49cf870b74ebdc36
BLAKE2b-256 38406e8794f3e79ab85dda6b1b2ab3376fdf8f1f9737eb53430f3c238e3b0e51

See more details on using hashes here.

File details

Details for the file sfzlint-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: sfzlint-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 32.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.10

File hashes

Hashes for sfzlint-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 079f0cab084869e746d65c244b730921f3993fd827116d0aeedfda8ecc8d0b81
MD5 5ee8b60112eca3a1e3d3187c2f920786
BLAKE2b-256 a92a1af32468aa0adc931cc7d48d07287a893ee49596ad597eda2a56b1f6948f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page