jisaacstone / sfzlint Goto Github PK
View Code? Open in Web Editor NEWparser and linter for sfz files written in python using Lark
License: MIT License
parser and linter for sfz files written in python using Lark
License: MIT License
Hi,
thank you for your job and this useful tool. I would like to use it to list all the opcodes inside some SFZ files I have.
Everytime I try to use it from the command line like this:
sfzlist --path "/home/nicola/Musica/Samples/Sonatina Symphonic Orchestra/Brass - Bass Trombone Solo.sfz"
I get this error
Traceback (most recent call last):
File "/usr/local/bin/sfzlist", line 11, in <module>
load_entry_point('sfzlint==0.1.4', 'console_scripts', 'sfzlist')()
File "/usr/local/lib/python3.6/dist-packages/sfzlint-0.1.4-py3.6.egg/sfzlint/cli.py", line 90, in sfzlist
1/0
ZeroDivisionError: division by zero
So I've examined the sfzlint/cli.py
at line 90 and I found something strange which I commented out before installing the tool again with the command sudo python3 setup.py install
.
Now I don't see any error anymore but the command:
sfzlist --path "/home/nicola/Musica/Samples/Sonatina Symphonic Orchestra/Brass - Bass Trombone Solo.sfz"
returns nothing.
Why?
What Am I doing wrong?
Thank you so much for your support!
Thank-you for creating the linter. This could be really useful for my automated sfz GitHub workflows:
https://github.com/studiorack/salamander-grand-piano/blob/master/.github/workflows/release.yml
Installation
I needed to install yaml. Can you add this to the README documentation or the setup.py install_requires property?
pip install pyyaml
Usage
When running I get another error:
FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.9/site-packages/sfzlint/syntax.yml'
FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.9/site-packages/sfzlint/sfz.lark'
Opening the folder, the file does not exist:
Even thought the file is in the repo:
https://github.com/jisaacstone/sfzlint/blob/master/sfzlint/syntax.yml
Looks like this file needs to be included in the setup.py:
package_data={'sfzlint': ['*.ebnf','*.yml','*.lark']},
Copying the files manually fixed the issues.
Thanks for creating this great tool. I downloaded https://github.com/sfz/tests/ and was using it to test your tool:
git clone https://github.com/sfz/tests.git
cd ./tests
sfzlint "./sfz1 basic tests/01 - Amp LFO/01 - amp lfo freq.sfz" --spec-version=v1
sfz1 basic tests/01 - Amp LFO/01 - amp lfo freq.sfz:8:30:E opcode spec v2 is not one of {'v1'}
sfz1 basic tests/01 - Amp LFO/01 - amp lfo freq.sfz:8:46:E opcode spec v2 is not one of {'v1'}
sfz1 basic tests/01 - Amp LFO/01 - amp lfo freq.sfz:8:60:E opcode spec v2 is not one of {'v1'}
But when checking the opcodes on line 8 they are all valid v1 codes:
sample=..\..\samples\440.wav loopstart=12629 loopend=56728 loopmode=loop_continuous
Likewise if I check a v2 file:
sfzlint "./sfz2 basic tests/00 - syntax/00 - syntax introduction.sfz" --spec-version=v2
sfz2 basic tests/00 - syntax/00 - syntax introduction.sfz:27:2:W header spec v1 not in {'v2'} (region)
sfz2 basic tests/00 - syntax/00 - syntax introduction.sfz:27:10:E opcode spec v1 is not one of {'v2'}
line 27 has valid v2 codes:
<region> sample=..\..\samples\440.wav
Looks like a bug?
Current syntax.yml file was last updated Feb 22, 2020:
https://github.com/jisaacstone/sfzlint/blob/master/sfzlint/syntax.yml
Latest version available was last updated May 28 2021:
https://github.com/sfzformat/sfzformat.github.io/blob/source/_data/sfz/syntax.yml
If I update the syntax.yml file manually there are errors in Python:
File "/usr/local/lib/python3.9/site-packages/sfzlint-0.1.2-py3.9.egg/sfzlint/spec.py", line 143, in op_to_validator
ver=ver_mapping[op_data.get('version')],
KeyError: 'sfizz'
It seems that the new syntax.yml has breaking changes, which require Python code changes.
It would be nice if this project was also listed on PyPI.
python setup.py bdist_wheel sdist --format=gztar
twine upload --skip-existing dist/*
Also, if project releases were created on Github (not just tagged) it would be easier for interested parties, e.g. distribution package creators, to get notified of new releases (because there doesn't seem to be an option on Github to get notified only about new tags of a project).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.