Csound Csound-dev Csound-tekno Search About

[Csnd] $FILEDIR Proposal

Date2012-11-10 13:32
FromSteven Yi
Subject[Csnd] $FILEDIR Proposal

Hi all,

One thing I am wondering about with packages and Includes as a whole, is depending on other files. For example, I am thinking about if you distribute a UDO that depends on an impulse response. My thought is that Csound could have a built-in macro called FILEDIR that would be updated during parsing to hav the absolute path of the most file being read. The it could be used in ftgen statements or where ever.

This proposal seems a little clunky to me, so I'd love to hear thoughts from others.

Thanks!
Steven


Date2012-11-10 14:13
FromAdam Puckett
SubjectRe: [Csnd] $FILEDIR Proposal
But then wouldn't we have to have dynamic parsing? Sorry I don't know
all the details, but that's just a gut reaction. Maybe something like
in-memory parsing? Like parsing the orch, and then updating $FILEDIR
on every dynamic parse? Sorry again for the noise.

On 11/10/12, Steven Yi  wrote:
> Hi all,
>
> One thing I am wondering about with packages and Includes as a whole, is
> depending on other files. For example, I am thinking about if you
> distribute a UDO that depends on an impulse response. My thought is that
> Csound could have a built-in macro called FILEDIR that would be updated
> during parsing to hav the absolute path of the most file being read. The it
> could be used in ftgen statements or where ever.
>
> This proposal seems a little clunky to me, so I'd love to hear thoughts
> from others.
>
> Thanks!
> Steven
>
> Send bugs reports to the Sourceforge bug tracker
>             https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> csound"
>
>

Date2012-11-10 16:16
FromSteven Yi
SubjectRe: [Csnd] $FILEDIR Proposal
Hi Adam,

I don't think this would be dynamic parsing.  The idea is that as each file is loaded, the $FILEDIR macro would be updated to the dir of the file, then parsing continues.  The $FILEDIR macro would get expanded as any other macro would. 

I imagine most of the things that would be packaged in packages initially would be UDO's or helpful macros.  If we start coming up with a good scheme for packaging instruments, then this would become an issue more.  For example, imagine a pre-made drum machine instrument that uses samples.  The instrument might encapsulate all of its tables with it. Perhaps pseudo-code would be like:

instr MySampler
  itab ftgenonce 0,0, 0, 1, "mySample.wav"

  ... sample playing code...
endin

if the packaged instrument was in a folder like this:

packages
  +MySampler-1.0
      +MySampler.instr
      +mySample.wav

You'd want to use it like:

#include "MySampler-1.0/MySampler.instr"

but, then how does the instrument know where to load the sample from?

If we had:

  itab ftgenonce 0,0, 0, 1, "$FILEDIR/mySample.wav"

then no matter where the MySampler.instr file is, as long as the mySample.wav is in the same directory, it would load alright.

Hopefully that explains the issue a bit more!
steven


On Sat, Nov 10, 2012 at 2:13 PM, Adam Puckett <adotsdothmusic@gmail.com> wrote:
But then wouldn't we have to have dynamic parsing? Sorry I don't know
all the details, but that's just a gut reaction. Maybe something like
in-memory parsing? Like parsing the orch, and then updating $FILEDIR
on every dynamic parse? Sorry again for the noise.

On 11/10/12, Steven Yi <stevenyi@gmail.com> wrote:
> Hi all,
>
> One thing I am wondering about with packages and Includes as a whole, is
> depending on other files. For example, I am thinking about if you
> distribute a UDO that depends on an impulse response. My thought is that
> Csound could have a built-in macro called FILEDIR that would be updated
> during parsing to hav the absolute path of the most file being read. The it
> could be used in ftgen statements or where ever.
>
> This proposal seems a little clunky to me, so I'd love to hear thoughts
> from others.
>
> Thanks!
> Steven
>
> Send bugs reports to the Sourceforge bug tracker
>             https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> csound"
>
>


Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"