sfz / sfz.github.io

SFZ Format documentation website
https://sfzformat.com
Creative Commons Zero v1.0 Universal
30 stars 33 forks source link

What is the actual spec on comments? Not what it says... #60

Open squinkylabs opened 3 years ago

squinkylabs commented 3 years ago

the spec says when you hit / a comment begins, and lasts until the end of the line.

So what does sample=foo/bar.wav mean? clearly / does not always start a comment.

Now look at this!

/*
// **********************************************************************
// Converted with SF22SFZ Converter v1.929
// Copyright Jun 17 2019 , Plogue Art et Technologie, Inc
// **********************************************************************
// Conversion Date: Mon Jun 15 22:56:07 2020
// **********************************************************************
// Parent file    : F:/Recording/Petit Italien sf2/Petit Italien.sf2
// Soundfont      : 2.1
// Internal Name  : User Bank
// Optimised for  : SF SW Engine
// Intendend for  : SBAWE32
// Editor Used    : SFEDT v1.36:
// Sound Engineer : Vienna Master
// Comments       : Comments Not Present
// Creation Date  : Nov 13, 2005
// Copyright      : Copyright Information Not Present
*/

Apparently Sforzando thinks multi line comments like C++ are a thing. Do Either multi-line comments are a thing, or else */ on a line by itself means "ignore:.

jpcima commented 3 years ago

So what does sample=foo/bar.wav mean? clearly / does not always start a comment.

Under some older software, it would indeed signify a comment. If aiming to maximize the compatibility of the SFZ instrument, one would instead use a \ separator. Although this Cakewalk software is dated and it's possibly not worth supporting by the modern standards. Sforzando and sfizz have // and /* styles only, not /.

squinkylabs commented 3 years ago

And what does /* mean? It isn't mentioned in the the spec. Is it a multi line comments that only ends when */ is found? If so, how is the the content process after the comment end? for example:


/* multi line comment
  second line */ <region>    // should that region heading get processed or ignored?
squinkylabs commented 3 years ago

so, again, the multi-line comment (shown above) would not be a comment, according to the published spec, here. Yet I suspect that since sforzando actually will output this that the spec is incorrect? Not trying to be difficult here - just trying to make a player that will work right. But, lacking an answer I've implemented multi line comments according to the c++ spec.

jjceresa commented 2 years ago

the spec says when you hit / a comment begins, and lasts until the end of the line. So what does sample=foo/bar.wav mean? clearly / does not always start a comment.

In the player I am making, I prefer respect the spec for backward compatibility. So when a / character is part of an opcode value this character is considered part of the file name not as the start of a comment.

Sforzando and sfizz have // and /* styles only, not /.

This is strange. I don't understand why those player doesn't not respect '/' style comment ?

jjceresa commented 2 years ago

If aiming to maximize the compatibility of the SFZ instrument, one would instead use a \ separator.

/' or` separator works for players running on Windows. Not sure that \ in file path will work on linux. In this case a sfz file edited on Windows will not be accepted on a sfz player running on linux.

jjceresa commented 2 years ago

Sorry for the bad formatting

If aiming to maximize the compatibility of the SFZ instrument, one would instead use a \ separator.

/ or \ separator works for players running on Windows. Not sure that \ in file path will work on linux. In this case a sfz file edited on Windows will not be accepted on a sfz player running on linux.

redtide commented 1 year ago

About line comments, looking in the test suite and in the original documentation, despite the statement, 2 forward slashes was used. Thinking also about #include and #define opcodes it's clear where they comes from, so it looks strange to me what was the choice for the original syntax.

Apparently Sforzando thinks multi line comments like C++ are a thing

Also sfz 2 (Cakewalk Synthesizers 2nd edition, p334), including the 2 forward slashes for single lines.