Csound Csound-dev Csound-tekno Search About

How to load audio files to ftables in real time

Date2016-01-31 13:49
FromAnton Kholomiov
SubjectHow to load audio files to ftables in real time
What is a proper way to dynamically load wav-files to ftables?
My first attempt is to use ftgen:

~~~
; global table for files
giTab  ftgen ...


instr LoadFile
  iTab = p4
  SFile = p5
  iDummy ftgen iTab, 0, 0, 1, SFile, 0, 0, 1 
  turnoff
endin
~~~

Is it a right way to load files? Am I going to have a space leak
with redefining table with `ftgen`? Is it better to pre-allocate a table
and copy to with `tabcopy`?

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

Date2016-01-31 13:59
FromRory Walsh
SubjectRe: How to load audio files to ftables in real time
I use a similar method to do this in some instruments where the file name is not known at init-time. You just have to be careful that you are not accessing a table when you re-ftgen it. 

On 31 January 2016 at 13:49, Anton Kholomiov <anton.kholomiov@gmail.com> wrote:
What is a proper way to dynamically load wav-files to ftables?
My first attempt is to use ftgen:

~~~
; global table for files
giTab  ftgen ...


instr LoadFile
  iTab = p4
  SFile = p5
  iDummy ftgen iTab, 0, 0, 1, SFile, 0, 0, 1 
  turnoff
endin
~~~

Is it a right way to load files? Am I going to have a space leak
with redefining table with `ftgen`? Is it better to pre-allocate a table
and copy to with `tabcopy`?

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

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

Date2016-01-31 19:54
Fromjoachim heintz
SubjectRe: How to load audio files to ftables in real time
just to note, you could also use an f-event:
event (or event_i) "f", ... (all you need as if it is a score line)

this does not affect what you mentioned about pre-allocating etc.

cheers -
	joachim


On 31/01/16 14:49, Anton Kholomiov wrote:
> What is a proper way to dynamically load wav-files to ftables?
> My first attempt is to use ftgen:
>
> ~~~
> ; global table for files
> giTab  ftgen ...
>
>
> instr LoadFile
>    iTab = p4
>    SFile = p5
>    iDummy ftgen iTab, 0, 0, 1, SFile, 0, 0, 1
>    turnoff
> endin
> ~~~
>
> Is it a right way to load files? Am I going to have a space leak
> with redefining table with `ftgen`? Is it better to pre-allocate a table
> and copy to with `tabcopy`?
>
> Anton
> Csound mailing list Csound@listserv.heanet.ie
> 
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to
> https://github.com/csound/csound/issues Discussions of bugs and features
> can be posted here

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

Date2016-02-01 09:05
FromAnton Kholomiov
SubjectRe: How to load audio files to ftables in real time
Thanks Rory and Joachim. 

@Joachim But is it possible to pass strings to `event` ?
If I want to use GEN01 I need to pass a file name as a string
but` event` seems to accept only floats.

2016-01-31 22:54 GMT+03:00 joachim heintz <jh@joachimheintz.de>:
just to note, you could also use an f-event:
event (or event_i) "f", ... (all you need as if it is a score line)

this does not affect what you mentioned about pre-allocating etc.

cheers -
        joachim



On 31/01/16 14:49, Anton Kholomiov wrote:
What is a proper way to dynamically load wav-files to ftables?
My first attempt is to use ftgen:

~~~
; global table for files
giTab  ftgen ...


instr LoadFile
   iTab = p4
   SFile = p5
   iDummy ftgen iTab, 0, 0, 1, SFile, 0, 0, 1
   turnoff
endin
~~~

Is it a right way to load files? Am I going to have a space leak
with redefining table with `ftgen`? Is it better to pre-allocate a table
and copy to with `tabcopy`?

Anton
Csound mailing list Csound@listserv.heanet.ie
<mailto:Csound@listserv.heanet.ie>
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to
https://github.com/csound/csound/issues Discussions of bugs and features
can be posted here

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

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

Date2016-02-01 09:08
FromRory Walsh
SubjectRe: How to load audio files to ftables in real time
You're right, event can't take strings :( so in this case you will need to use the scoreline opcodes instead. 

On 1 February 2016 at 09:05, Anton Kholomiov <anton.kholomiov@gmail.com> wrote:
Thanks Rory and Joachim. 

@Joachim But is it possible to pass strings to `event` ?
If I want to use GEN01 I need to pass a file name as a string
but` event` seems to accept only floats.

2016-01-31 22:54 GMT+03:00 joachim heintz <jh@joachimheintz.de>:
just to note, you could also use an f-event:
event (or event_i) "f", ... (all you need as if it is a score line)

this does not affect what you mentioned about pre-allocating etc.

cheers -
        joachim



On 31/01/16 14:49, Anton Kholomiov wrote:
What is a proper way to dynamically load wav-files to ftables?
My first attempt is to use ftgen:

~~~
; global table for files
giTab  ftgen ...


instr LoadFile
   iTab = p4
   SFile = p5
   iDummy ftgen iTab, 0, 0, 1, SFile, 0, 0, 1
   turnoff
endin
~~~

Is it a right way to load files? Am I going to have a space leak
with redefining table with `ftgen`? Is it better to pre-allocate a table
and copy to with `tabcopy`?

Anton
Csound mailing list Csound@listserv.heanet.ie
<mailto:Csound@listserv.heanet.ie>
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to
https://github.com/csound/csound/issues Discussions of bugs and features
can be posted here

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

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

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

Date2016-02-01 09:11
FromAnton Kholomiov
SubjectRe: How to load audio files to ftables in real time
I looked at the docs for scoreline. It seems to accept only constants.
Can I pass a value of a variable to it? Is it have to be done with sprintf?

2016-02-01 12:08 GMT+03:00 Rory Walsh <rorywalsh@ear.ie>:
You're right, event can't take strings :( so in this case you will need to use the scoreline opcodes instead. 

On 1 February 2016 at 09:05, Anton Kholomiov <anton.kholomiov@gmail.com> wrote:
Thanks Rory and Joachim. 

@Joachim But is it possible to pass strings to `event` ?
If I want to use GEN01 I need to pass a file name as a string
but` event` seems to accept only floats.

2016-01-31 22:54 GMT+03:00 joachim heintz <jh@joachimheintz.de>:
just to note, you could also use an f-event:
event (or event_i) "f", ... (all you need as if it is a score line)

this does not affect what you mentioned about pre-allocating etc.

cheers -
        joachim



On 31/01/16 14:49, Anton Kholomiov wrote:
What is a proper way to dynamically load wav-files to ftables?
My first attempt is to use ftgen:

~~~
; global table for files
giTab  ftgen ...


instr LoadFile
   iTab = p4
   SFile = p5
   iDummy ftgen iTab, 0, 0, 1, SFile, 0, 0, 1
   turnoff
endin
~~~

Is it a right way to load files? Am I going to have a space leak
with redefining table with `ftgen`? Is it better to pre-allocate a table
and copy to with `tabcopy`?

Anton
Csound mailing list Csound@listserv.heanet.ie
<mailto:Csound@listserv.heanet.ie>
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to
https://github.com/csound/csound/issues Discussions of bugs and features
can be posted here

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

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

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

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

Date2016-02-01 09:17
FromRory Walsh
SubjectRe: How to load audio files to ftables in real time
That's correct. There is an example at the bottom of the manual page showing how it's done. 

On 1 February 2016 at 09:11, Anton Kholomiov <anton.kholomiov@gmail.com> wrote:
I looked at the docs for scoreline. It seems to accept only constants.
Can I pass a value of a variable to it? Is it have to be done with sprintf?

2016-02-01 12:08 GMT+03:00 Rory Walsh <rorywalsh@ear.ie>:
You're right, event can't take strings :( so in this case you will need to use the scoreline opcodes instead. 

On 1 February 2016 at 09:05, Anton Kholomiov <anton.kholomiov@gmail.com> wrote:
Thanks Rory and Joachim. 

@Joachim But is it possible to pass strings to `event` ?
If I want to use GEN01 I need to pass a file name as a string
but` event` seems to accept only floats.

2016-01-31 22:54 GMT+03:00 joachim heintz <jh@joachimheintz.de>:
just to note, you could also use an f-event:
event (or event_i) "f", ... (all you need as if it is a score line)

this does not affect what you mentioned about pre-allocating etc.

cheers -
        joachim



On 31/01/16 14:49, Anton Kholomiov wrote:
What is a proper way to dynamically load wav-files to ftables?
My first attempt is to use ftgen:

~~~
; global table for files
giTab  ftgen ...


instr LoadFile
   iTab = p4
   SFile = p5
   iDummy ftgen iTab, 0, 0, 1, SFile, 0, 0, 1
   turnoff
endin
~~~

Is it a right way to load files? Am I going to have a space leak
with redefining table with `ftgen`? Is it better to pre-allocate a table
and copy to with `tabcopy`?

Anton
Csound mailing list Csound@listserv.heanet.ie
<mailto:Csound@listserv.heanet.ie>
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to
https://github.com/csound/csound/issues Discussions of bugs and features
can be posted here

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

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

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

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

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

Date2016-02-01 09:33
FromVictor Lazzarini
SubjectRe: How to load audio files to ftables in real time
Use sprintf.
========================
Dr Victor Lazzarini
Dean of Arts, Celtic Studies and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952 

> On 1 Feb 2016, at 09:11, Anton Kholomiov  wrote:
> 
> I looked at the docs for scoreline. It seems to accept only constants.
> Can I pass a value of a variable to it? Is it have to be done with sprintf?
> 
> 2016-02-01 12:08 GMT+03:00 Rory Walsh :
> You're right, event can't take strings :( so in this case you will need to use the scoreline opcodes instead. 
> 
> On 1 February 2016 at 09:05, Anton Kholomiov  wrote:
> Thanks Rory and Joachim. 
> 
> @Joachim But is it possible to pass strings to `event` ?
> If I want to use GEN01 I need to pass a file name as a string
> but` event` seems to accept only floats.
> 
> 2016-01-31 22:54 GMT+03:00 joachim heintz :
> just to note, you could also use an f-event:
> event (or event_i) "f", ... (all you need as if it is a score line)
> 
> this does not affect what you mentioned about pre-allocating etc.
> 
> cheers -
>         joachim
> 
> 
> 
> On 31/01/16 14:49, Anton Kholomiov wrote:
> What is a proper way to dynamically load wav-files to ftables?
> My first attempt is to use ftgen:
> 
> ~~~
> ; global table for files
> giTab  ftgen ...
> 
> 
> instr LoadFile
>    iTab = p4
>    SFile = p5
>    iDummy ftgen iTab, 0, 0, 1, SFile, 0, 0, 1
>    turnoff
> endin
> ~~~
> 
> Is it a right way to load files? Am I going to have a space leak
> with redefining table with `ftgen`? Is it better to pre-allocate a table
> and copy to with `tabcopy`?
> 
> Anton
> Csound mailing list Csound@listserv.heanet.ie
> 
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to
> https://github.com/csound/csound/issues Discussions of bugs and features
> can be posted here
> 
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
> 
> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
> 
> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
> 
> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

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

Date2016-02-01 09:44
FromAnton Kholomiov
SubjectRe: How to load audio files to ftables in real time
Good! It can simplify routing of vars for me.

2016-02-01 12:33 GMT+03:00 Victor Lazzarini <Victor.Lazzarini@nuim.ie>:
Use sprintf.
========================
Dr Victor Lazzarini
Dean of Arts, Celtic Studies and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952

> On 1 Feb 2016, at 09:11, Anton Kholomiov <anton.kholomiov@gmail.com> wrote:
>
> I looked at the docs for scoreline. It seems to accept only constants.
> Can I pass a value of a variable to it? Is it have to be done with sprintf?
>
> 2016-02-01 12:08 GMT+03:00 Rory Walsh <rorywalsh@ear.ie>:
> You're right, event can't take strings :( so in this case you will need to use the scoreline opcodes instead.
>
> On 1 February 2016 at 09:05, Anton Kholomiov <anton.kholomiov@gmail.com> wrote:
> Thanks Rory and Joachim.
>
> @Joachim But is it possible to pass strings to `event` ?
> If I want to use GEN01 I need to pass a file name as a string
> but` event` seems to accept only floats.
>
> 2016-01-31 22:54 GMT+03:00 joachim heintz <jh@joachimheintz.de>:
> just to note, you could also use an f-event:
> event (or event_i) "f", ... (all you need as if it is a score line)
>
> this does not affect what you mentioned about pre-allocating etc.
>
> cheers -
>         joachim
>
>
>
> On 31/01/16 14:49, Anton Kholomiov wrote:
> What is a proper way to dynamically load wav-files to ftables?
> My first attempt is to use ftgen:
>
> ~~~
> ; global table for files
> giTab  ftgen ...
>
>
> instr LoadFile
>    iTab = p4
>    SFile = p5
>    iDummy ftgen iTab, 0, 0, 1, SFile, 0, 0, 1
>    turnoff
> endin
> ~~~
>
> Is it a right way to load files? Am I going to have a space leak
> with redefining table with `ftgen`? Is it better to pre-allocate a table
> and copy to with `tabcopy`?
>
> Anton
> Csound mailing list Csound@listserv.heanet.ie
> <mailto:Csound@listserv.heanet.ie>
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to
> https://github.com/csound/csound/issues Discussions of bugs and features
> can be posted here
>
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
>
> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
>
> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
>
> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

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

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