Csound Csound-dev Csound-tekno Search About

[Csnd] Loading files 'dynamically'

Date2014-09-09 13:34
Fromsjakops
Subject[Csnd] Loading files 'dynamically'
Dear all,
I can't figure out how to load all sample (.wav) files of a given directory
(filenames not given) into f-tables. Perhaps someone can help me?
Best regards,
Søren



--
View this message in context: http://csound.1045644.n5.nabble.com/Loading-files-dynamically-tp5737384.html
Sent from the Csound - General mailing list archive at Nabble.com.


Date2014-09-09 14:23
FromRory Walsh
SubjectRe: [Csnd] Loading files 'dynamically'
You can't do this natively. I wrote an opcode to do this a while back.
What platform are you on?

On 9 September 2014 14:34, sjakops  wrote:
> Dear all,
> I can't figure out how to load all sample (.wav) files of a given directory
> (filenames not given) into f-tables. Perhaps someone can help me?
> Best regards,
> Søren
>
>
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/Loading-files-dynamically-tp5737384.html
> Sent from the Csound - General mailing list archive at Nabble.com.
>
>
> Send bugs reports to
>         https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>
>
>


Date2014-09-09 14:23
FromOeyvind Brandtsegg
SubjectRe: [Csnd] Loading files 'dynamically'
I think there are methods for doing this in Cabbage, filling a menu
with the names as you go.

Otherwise, you could use Python to get the file list, and then send
instr events from Python to Csound, where you have an instrument that
loads a named file.
You could run Python as the main application, loading Csound via csnd6,
or you can run Csound as the main app and access Python via the py opcodes.
In the latter case, use csInstance = csnd6.csoundGetInstance(_CSOUND_)
to get a pointer to the current running instance of Csound in Python.
(I know this was a very terse explanation, please do not hesitate to
ask more if you want to go this route)

If your needs is only to load all files in a dir, perhaps the Cabbage
route is the easiest and best.

Oeyvind

2014-09-09 14:34 GMT+02:00 sjakops :
> Dear all,
> I can't figure out how to load all sample (.wav) files of a given directory
> (filenames not given) into f-tables. Perhaps someone can help me?
> Best regards,
> Søren
>
>
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/Loading-files-dynamically-tp5737384.html
> Sent from the Csound - General mailing list archive at Nabble.com.
>
>
> Send bugs reports to
>         https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>
>
>



-- 

Oeyvind Brandtsegg
Professor of Music Technology
NTNU
7491 Trondheim
Norway
Cell: +47 92 203 205

http://flyndresang.no/
http://www.partikkelaudio.com/
http://soundcloud.com/brandtsegg
http://soundcloud.com/t-emp


Date2014-09-09 14:43
FromSteven Yi
SubjectRe: [Csnd] Loading files 'dynamically'
As a separate note, as we move forward, we should probably start
looking to implement functions in Csound that do what we would
normally expect out of any scripting language.  I think once the
parser changes are done, adding a new File type should be possible,
such that we could have:

f:File = open("some/dir")
if (isDirectory(f) && exists(f)) then
  files:File[] = list_files(f)
  for_each (temp:File in files) do
    print file_name(temp)
  end
end



On Tue, Sep 9, 2014 at 2:23 PM, Oeyvind Brandtsegg
 wrote:
> I think there are methods for doing this in Cabbage, filling a menu
> with the names as you go.
>
> Otherwise, you could use Python to get the file list, and then send
> instr events from Python to Csound, where you have an instrument that
> loads a named file.
> You could run Python as the main application, loading Csound via csnd6,
> or you can run Csound as the main app and access Python via the py opcodes.
> In the latter case, use csInstance = csnd6.csoundGetInstance(_CSOUND_)
> to get a pointer to the current running instance of Csound in Python.
> (I know this was a very terse explanation, please do not hesitate to
> ask more if you want to go this route)
>
> If your needs is only to load all files in a dir, perhaps the Cabbage
> route is the easiest and best.
>
> Oeyvind
>
> 2014-09-09 14:34 GMT+02:00 sjakops :
>> Dear all,
>> I can't figure out how to load all sample (.wav) files of a given directory
>> (filenames not given) into f-tables. Perhaps someone can help me?
>> Best regards,
>> Søren
>>
>>
>>
>> --
>> View this message in context: http://csound.1045644.n5.nabble.com/Loading-files-dynamically-tp5737384.html
>> Sent from the Csound - General mailing list archive at Nabble.com.
>>
>>
>> Send bugs reports to
>>         https://github.com/csound/csound/issues
>> Discussions of bugs and features can be posted here
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>>
>>
>>
>
>
>
> --
>
> Oeyvind Brandtsegg
> Professor of Music Technology
> NTNU
> 7491 Trondheim
> Norway
> Cell: +47 92 203 205
>
> http://flyndresang.no/
> http://www.partikkelaudio.com/
> http://soundcloud.com/brandtsegg
> http://soundcloud.com/t-emp
>
>
> Send bugs reports to
>         https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>
>
>


Date2014-09-10 10:47
Fromsjakops
Subject[Csnd] Re: Loading files 'dynamically'
Thank you all for the answers! It would be great if it was possible to do
this natively, but I guess I will look into the API then - when I have
studied it more closely I will probably have some questions for you Oevind:)
BTW I'm using Windows - I don't suppose what Rory wrote could work easily
here?



--
View this message in context: http://csound.1045644.n5.nabble.com/Loading-files-dynamically-tp5737384p5737413.html
Sent from the Csound - General mailing list archive at Nabble.com.

Date2014-09-10 10:57
FromRory Walsh
SubjectRe: [Csnd] Re: Loading files 'dynamically'
Attachmentsftsamplebank.cpp  ftsamplebank.csd  
I haven't tested it on windows, but I've attached the source to this
mail if you want to have a go at building it yourself. Otherwise I can
run off a version when I next boot into Windows.

On 10 September 2014 11:47, sjakops  wrote:
> Thank you all for the answers! It would be great if it was possible to do
> this natively, but I guess I will look into the API then - when I have
> studied it more closely I will probably have some questions for you Oevind:)
> BTW I'm using Windows - I don't suppose what Rory wrote could work easily
> here?
>
>
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/Loading-files-dynamically-tp5737384p5737413.html
> Sent from the Csound - General mailing list archive at Nabble.com.
>
>
> Send bugs reports to
>         https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>
>
>

Date2014-09-11 13:04
Fromsjakops
Subject[Csnd] Re: Loading files 'dynamically'
Thank you Rory, I will see if I can get that to work.



--
View this message in context: http://csound.1045644.n5.nabble.com/Loading-files-dynamically-tp5737384p5737448.html
Sent from the Csound - General mailing list archive at Nabble.com.

Date2014-09-11 14:45
FromRory Walsh
SubjectRe: [Csnd] Re: Loading files 'dynamically'
Here you go. Just dump the linked dll into your plugin directory. I've
also attached a sample .csd file. Let me know how it goes. I've not
quite had a chance to test it properly.

https://www.dropbox.com/s/t5e7zpw71lsregb/ftsamplebank%2C.zip?dl=0

Rory.


On 11 September 2014 13:04, sjakops  wrote:
> Thank you Rory, I will see if I can get that to work.
>
>
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/Loading-files-dynamically-tp5737384p5737448.html
> Sent from the Csound - General mailing list archive at Nabble.com.
>
>
> Send bugs reports to
>         https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>
>
>

Date2014-09-11 17:00
Fromsjakops
Subject[Csnd] Re: Loading files 'dynamically'
Works perfectly! Thank you very much for the help.



--
View this message in context: http://csound.1045644.n5.nabble.com/Loading-files-dynamically-tp5737384p5737454.html
Sent from the Csound - General mailing list archive at Nabble.com.

Date2014-09-11 17:04
FromRory Walsh
SubjectRe: [Csnd] Re: Loading files 'dynamically'
Have you tried loading dynamically during a performance and if so are
you getting any drop-outs or clicks? If not I will submit it for
inclusion in the next release.

On 11 September 2014 17:00, sjakops  wrote:
> Works perfectly! Thank you very much for the help.
>
>
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/Loading-files-dynamically-tp5737384p5737454.html
> Sent from the Csound - General mailing list archive at Nabble.com.
>
>
> Send bugs reports to
>         https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>
>
>

Date2014-09-11 18:45
Fromsjakops
Subject[Csnd] Re: Loading files 'dynamically'
Actually I am just starting out with Csound so this is not an expert
evaluation - I did hear some clicks at the end of the files but that seemed
to because I was using stereo samples with a mono loscil3 - with the stereo
version the sound is fine. Also I was not able to use the k-version, but had
to use the i-version instead - maybe I just haven't fully understood some
Csound concepts.. I will let you know if I experience any other problems.



--
View this message in context: http://csound.1045644.n5.nabble.com/Loading-files-dynamically-tp5737384p5737459.html
Sent from the Csound - General mailing list archive at Nabble.com.

Date2014-09-11 18:48
FromRory Walsh
SubjectRe: [Csnd] Re: Loading files 'dynamically'
Thanks, the clicks at the end must be caused by something. If clicks
were going to happen it would be at the start.

On 11 September 2014 18:45, sjakops  wrote:
> Actually I am just starting out with Csound so this is not an expert
> evaluation - I did hear some clicks at the end of the files but that seemed
> to because I was using stereo samples with a mono loscil3 - with the stereo
> version the sound is fine. Also I was not able to use the k-version, but had
> to use the i-version instead - maybe I just haven't fully understood some
> Csound concepts.. I will let you know if I experience any other problems.
>
>
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/Loading-files-dynamically-tp5737384p5737459.html
> Sent from the Csound - General mailing list archive at Nabble.com.
>
>
> Send bugs reports to
>         https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>
>
>

Date2014-09-13 16:25
FromDavid Mooney
SubjectRe: [Csnd] Re: Loading files 'dynamically'
Nice! A lower budget way to do this, though it requires a lot of work up front, is to use GEN 1/loscil to retrieve the files. Put the the GEN 1 tables into an #INCLUDE file then randomly (or however) select from them. I've done this successfully with fairly large numbers of very short sounds.

David Mooney

On Thu, Sep 11, 2014 at 1:48 PM, Rory Walsh <rorywalsh@ear.ie> wrote:
Thanks, the clicks at the end must be caused by something. If clicks
were going to happen it would be at the start.

On 11 September 2014 18:45, sjakops <sorenkj@gmail.com> wrote:
> Actually I am just starting out with Csound so this is not an expert
> evaluation - I did hear some clicks at the end of the files but that seemed
> to because I was using stereo samples with a mono loscil3 - with the stereo
> version the sound is fine. Also I was not able to use the k-version, but had
> to use the i-version instead - maybe I just haven't fully understood some
> Csound concepts.. I will let you know if I experience any other problems.
>
>
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/Loading-files-dynamically-tp5737384p5737459.html
> Sent from the Csound - General mailing list archive at Nabble.com.
>
>
> Send bugs reports to
>         https://github.com/csound/csound/issues
> 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
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"






--
Opaque Melodies
http://opaquemelodies.com

Date2014-09-13 17:00
FromRory Walsh
SubjectRe: [Csnd] Re: Loading files 'dynamically'
I used to rename all my files as numbers, then use sprinfk to generate
the file names on startup, and then load the files using gen1. Pita.
And hand coding the names of samples into a .csd file is also a pita,
especially when you just want to try out a bunch of samples from a
library or something.

On 13 September 2014 17:25, David Mooney  wrote:
> Nice! A lower budget way to do this, though it requires a lot of work up
> front, is to use GEN 1/loscil to retrieve the files. Put the the GEN 1
> tables into an #INCLUDE file then randomly (or however) select from them.
> I've done this successfully with fairly large numbers of very short sounds.
>
> David Mooney
>
> On Thu, Sep 11, 2014 at 1:48 PM, Rory Walsh  wrote:
>>
>> Thanks, the clicks at the end must be caused by something. If clicks
>> were going to happen it would be at the start.
>>
>> On 11 September 2014 18:45, sjakops  wrote:
>> > Actually I am just starting out with Csound so this is not an expert
>> > evaluation - I did hear some clicks at the end of the files but that
>> > seemed
>> > to because I was using stereo samples with a mono loscil3 - with the
>> > stereo
>> > version the sound is fine. Also I was not able to use the k-version, but
>> > had
>> > to use the i-version instead - maybe I just haven't fully understood
>> > some
>> > Csound concepts.. I will let you know if I experience any other
>> > problems.
>> >
>> >
>> >
>> > --
>> > View this message in context:
>> > http://csound.1045644.n5.nabble.com/Loading-files-dynamically-tp5737384p5737459.html
>> > Sent from the Csound - General mailing list archive at Nabble.com.
>> >
>> >
>> > Send bugs reports to
>> >         https://github.com/csound/csound/issues
>> > 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
>>         https://github.com/csound/csound/issues
>> Discussions of bugs and features can be posted here
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>> csound"
>>
>>
>>
>
>
>
> --
> Opaque Melodies
> http://opaquemelodies.com

Date2014-09-22 16:19
Fromjoachim heintz
SubjectRe: [Csnd] Loading files 'dynamically'
hi sören -

if you are using csoundqt-py, have a look at Scripts > Editor > 
strset_list.py. this converts all files in a directory to a strset-list. 
could be easily adapted for f-tables (maybe i have it already -- if it 
is useful for you i can look for it).

best -
	joachim


Am 09.09.2014 um 14:34 schrieb sjakops:
> Dear all,
> I can't figure out how to load all sample (.wav) files of a given directory
> (filenames not given) into f-tables. Perhaps someone can help me?
> Best regards,
> Søren
>
>
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/Loading-files-dynamically-tp5737384.html
> Sent from the Csound - General mailing list archive at Nabble.com.
>
>
> Send bugs reports to
>          https://github.com/csound/csound/issues
> 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
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"



Date2014-09-23 00:36
FromDaisy Audio
SubjectRe: [Csnd] Loading files 'dynamically'
Hi Joachim, 

If you have got a .py file that works with f-tables I'd love to see it. Don't worry if not as I'm sure I can adapt the file you mentioned soon as I have the time. 

Thanks

Dominic 

On Monday, September 22, 2014, joachim heintz <jh@joachimheintz.de> wrote:
hi sören -

if you are using csoundqt-py, have a look at Scripts > Editor > strset_list.py. this converts all files in a directory to a strset-list. could be easily adapted for f-tables (maybe i have it already -- if it is useful for you i can look for it).

best -
        joachim


Am 09.09.2014 um 14:34 schrieb sjakops:
Dear all,
I can't figure out how to load all sample (.wav) files of a given directory
(filenames not given) into f-tables. Perhaps someone can help me?
Best regards,
Søren



--
View this message in context: http://csound.1045644.n5.nabble.com/Loading-files-dynamically-tp5737384.html
Sent from the Csound - General mailing list archive at Nabble.com.


Send bugs reports to
         https://github.com/csound/csound/issues
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
       https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"




Date2014-09-23 21:40
Fromjoachim heintz
SubjectRe: [Csnd] Loading files 'dynamically'
hi dominic -

i found this. have a look if it makes sense. ciao -
	joachim

from os import listdir

dir = '/home/jh/Joachim/Stuecke/30Carin/samples'
relDir = '../samples' #relative path for csound
samples = sorted(listdir(dir), key=str.lower)

for sample in samples:
     scoline = 'gi_%s ftgen 0, 0, 0, -1, "%s/%s", 0, 0, 1\n' % 
(sample[:-4], relDir, sample)
     q.insertText(scoline)




Am 23.09.2014 um 01:36 schrieb Daisy Audio:
> Hi Joachim,
>
> If you have got a .py file that works with f-tables I'd love to see it.
> Don't worry if not as I'm sure I can adapt the file you mentioned soon
> as I have the time.
>
> Thanks
>
> Dominic
>
> On Monday, September 22, 2014, joachim heintz  > wrote:
>
>     hi sören -
>
>     if you are using csoundqt-py, have a look at Scripts > Editor >
>     strset_list.py. this converts all files in a directory to a
>     strset-list. could be easily adapted for f-tables (maybe i have it
>     already -- if it is useful for you i can look for it).
>
>     best -
>              joachim
>
>
>     Am 09.09.2014 um 14:34 schrieb sjakops:
>
>         Dear all,
>         I can't figure out how to load all sample (.wav) files of a
>         given directory
>         (filenames not given) into f-tables. Perhaps someone can help me?
>         Best regards,
>         Søren
>
>
>
>         --
>         View this message in context:
>         http://csound.1045644.n5.__nabble.com/Loading-files-__dynamically-tp5737384.html
>         
>         Sent from the Csound - General mailing list archive at Nabble.com.
>
>
>         Send bugs reports to
>         https://github.com/csound/__csound/issues
>         
>         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
>     https://github.com/csound/__csound/issues
>     
>     Discussions of bugs and features can be posted here
>     To unsubscribe, send email sympa@lists.bath.ac.uk with body
>     "unsubscribe csound"
>
>
>

Date2014-09-24 01:07
FromDaisy Audio
SubjectRe: [Csnd] Loading files 'dynamically'
Thanks for that Joachim. I'll have a play with it and see how I get on. Thanks for taking the time to dig it out. 

Dominic 

On Tuesday, September 23, 2014, joachim heintz <jh@joachimheintz.de> wrote:
hi dominic -

i found this. have a look if it makes sense. ciao -
        joachim

from os import listdir

dir = '/home/jh/Joachim/Stuecke/30Carin/samples'
relDir = '../samples' #relative path for csound
samples = sorted(listdir(dir), key=str.lower)

for sample in samples:
    scoline = 'gi_%s ftgen 0, 0, 0, -1, "%s/%s", 0, 0, 1\n' % (sample[:-4], relDir, sample)
    q.insertText(scoline)




Am 23.09.2014 um 01:36 schrieb Daisy Audio:
Hi Joachim,

If you have got a .py file that works with f-tables I'd love to see it.
Don't worry if not as I'm sure I can adapt the file you mentioned soon
as I have the time.

Thanks

Dominic

On Monday, September 22, 2014, joachim heintz <jh@joachimheintz.de
<mailto:jh@joachimheintz.de>> wrote:

    hi sören -

    if you are using csoundqt-py, have a look at Scripts > Editor >
    strset_list.py. this converts all files in a directory to a
    strset-list. could be easily adapted for f-tables (maybe i have it
    already -- if it is useful for you i can look for it).

    best -
             joachim


    Am 09.09.2014 um 14:34 schrieb sjakops:

        Dear all,
        I can't figure out how to load all sample (.wav) files of a
        given directory
        (filenames not given) into f-tables. Perhaps someone can help me?
        Best regards,
        Søren



        --
        View this message in context:
        http://csound.1045644.n5.__nabble.com/Loading-files-__dynamically-tp5737384.html
        <http://csound.1045644.n5.nabble.com/Loading-files-dynamically-tp5737384.html>
        Sent from the Csound - General mailing list archive at Nabble.com.


        Send bugs reports to
        https://github.com/csound/__csound/issues
        <https://github.com/csound/csound/issues>
        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
    https://github.com/csound/__csound/issues
    <https://github.com/csound/csound/issues>
    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
       https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"