[Csnd] Error with directory opcode

Hey hey,
I think I have just found an error with the directory opcode. With directories up to two letters the files list contains the filenames as they are inside the directory. When a directory has three or more letters, the directory name is included in the filenames.
i.e.
Sfiles[] directory "x/", ".wav"
Sfiles[0]: a.wav
Sfiles2[] directory "xyz/", ".wav"
Sfiles2[0] = xyz/a.wav

I accidentally discovered that by using my m_samplebank opcodes with a proper realworld directory name.
http://juliencoder.de/sound/m_samplebank-1.0.zip

I am running the arch package of Csound version 6.15 (September 7 2020)

Can someone verify that behaviour? Is it to a degree intentional?

Best wishes,

Jeanette

Definitely not intentional! I will sort it out when I get a chance.

Mar 19 2021, Rory Walsh has written:

Definitely not intentional! I will sort it out when I get a chance.

Many thanks! No hurry on my account. I've worked around it for now. :slight_smile:

Best wishes,

Jeanette

you may have thought: if there are less than two beers, it is not worth mentioning?

That’s a fair point. It does make a lot of sense!

Hi,
I was going to report that I can verify this, but Isee there have been
several replies in the meantime! (:-)) It took me a while, because I was
mightily confused by the fact that, e.g. "Sfiles[] directory p4" doesn't work!
OTOH, this does:

   Sdir = p4
   Sfiles[] directory Sdir

In fact, "prints p4" doesn't work if p4 is a string. I see in the manual
"String Variables" section that "The string p-field can be used by many
orchestra opcodes directly," Is there any logic as to which ones?

Also I'm not clear on the difference (if any) between "Sname = p4"and
"Sname strget p4". They seem to behave the same here.

Getting back to the directory opcode, I'm not sure whether by default
it's better to include the directory name in the output or not. I'd actually
think not, because it should be trivial to prepend if you want.

  -- Pete --

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        Issues · csound/csound · GitHub
Discussions of bugs and features can be posted here

I just pushed a possible fix. Sorry, I didn’t have time to test. Can you pull and build again, and let me know if things have improved?

Mar 19 2021, Pete Goodeve has written:
...

Also I'm not clear on the difference (if any) between "Sname = p4"and
"Sname strget p4". They seem to behave the same here.

...
Not sure if there is a difference between them now. the manual DID say
at some point that you can only directly assign a string from p4, for
further p-fields you should use strget. Though a lot has happened to
strings.

Best wishes,

Jeanette

I meant to add that maybe this could be done with an extra opcode parameter,
but on looking again that might interfere with the optional 'extention' (which
should probably be "extension" (:-)). I dunno.

  -- Pete --

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        Issues · csound/csound · GitHub
Discussions of bugs and features can be posted here

i think this should work:
  Sfiles[] directory strget(p4)

as i understand it, we have to tell csound that p4 is a string, and that's what strget does. so it is probably most safe and clear.

  j

Makes sense (and does work!) Thanks!

  -- Pete --

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        Issues · csound/csound · GitHub
Discussions of bugs and features can be posted here