sfz.github.io icon indicating copy to clipboard operation
sfz.github.io copied to clipboard

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

Open squinkylabs opened this issue 4 years ago • 7 comments

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:.

squinkylabs avatar Jun 28 '21 01:06 squinkylabs

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 /.

jpcima avatar Jun 28 '21 02:06 jpcima

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 avatar Jun 28 '21 04:06 squinkylabs

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.

squinkylabs avatar Jul 02 '21 04:07 squinkylabs

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 avatar Jan 20 '22 21:01 jjceresa

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 avatar Jan 20 '22 22:01 jjceresa

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.

jjceresa avatar Jan 20 '22 22:01 jjceresa

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.

redtide avatar Feb 11 '23 08:02 redtide