Csound Csound-dev Csound-tekno Search About

[Csnd] newbie again...

Date2013-08-19 02:33
Fromluis jure
Subject[Csnd] newbie again...
hello list,

i have been working very little with csound lately and i really feel i'm
way behind all its incredible new features. actually, i still have to
catch up with features that have been around for years now...

now i intend to do some csounding again, and i'd like to do things a little
different from the "old way" i learned so many years ago. but i have so
many questions, that i need the help of the list...

let's begin with a simplified example. suppose i have two tables defined
with ftgen, and their table numbers assigned to global variables gisine
and gicomp:

gisine	ftgen	0, 0, 65536, 10, 1
gicomp	ftgen	0, 0, 65536, 10, 1, 1, 1, 1, 1, 1, 1, 1

the tables are later used by an oscil.

the question is, how can i chose from the score which table i want to use
for each note? i know i could assign the tables to static numbers, but
that's what i don't want to do. i have lots of tables and i would like to
address them by name.

thank you in advance from an old newbie,


lj

Date2013-08-19 06:05
FromTarmo Johannes
SubjectRe: [Csnd] newbie again...

Hi,

 

ftgen:

 

gir ftgen ifn, itime, isize, igen, iarga [, iargb ] [...]

 

you can set the table nuber with the ifn parameter, you don't need to leave it 0 (or if you leave it 0, it means csound will put the number. Usually 101 for first table etc):

 

gisine ftgen 1, 0, 65536, 10, 1

gicomp ftgen 2, 0, 65536, 10, 1, 1, 1, 1, 1, 1, 1, 1

 

instr 1

itable = p4

asig poscil 0,1,220,p4

out asig

endin

 

;and later in the score

 

; p4 - table number

i 1 0 3 1

i 1 + 3 2

 

best!

tarmo

 

 

 

 

 

 

On Sunday 18 August 2013 22:33:43 luis jure wrote:

> hello list,

>

> i have been working very little with csound lately and i really feel i'm

> way behind all its incredible new features. actually, i still have to

> catch up with features that have been around for years now...

>

> now i intend to do some csounding again, and i'd like to do things a little

> different from the "old way" i learned so many years ago. but i have so

> many questions, that i need the help of the list...

>

> let's begin with a simplified example. suppose i have two tables defined

> with ftgen, and their table numbers assigned to global variables gisine

> and gicomp:

>

> gisine ftgen 0, 0, 65536, 10, 1

> gicomp ftgen 0, 0, 65536, 10, 1, 1, 1, 1, 1, 1, 1, 1

>

> the tables are later used by an oscil.

>

> the question is, how can i chose from the score which table i want to use

> for each note? i know i could assign the tables to static numbers, but

> that's what i don't want to do. i have lots of tables and i would like to

> address them by name.

>

> thank you in advance from an old newbie,

>

>

> lj

>

>

> Send bugs reports to the Sourceforge bug trackers

> csound6:

> https://sourceforge.net/p/csound/tickets/

> csound5:

> https://sourceforge.net/p/csound/bugs/

> Discussions of bugs and features can be posted here

> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe

> csound"


Date2013-08-19 08:45
Fromjoachim heintz
SubjectRe: [Csnd] newbie again...
hi luis -

i indeed think you cannot do this. the reason is that orc and sco are 
two completely different languages; so any gisine and gicomp which are 
returned by the ftgen statement are simply "not understood" by the 
score. (this is a bit similar to the discussion about the t-statement we 
had recently here on the list.)

i think there was also a discussion whether strings could be accepted by 
ftgen as names, like this:
giSine ftgen "sine", 0, 65536, 10, 1

if this were implemented, you could write in the score:
i 1 0 3 "sine"

and in the orchestra:
instr 1
S_table strget p4
aSine poscil .2, 400, S_table
etc...
endin

meanwhile, i think you could do what you want with the Stray UDOs i have 
written (https://github.com/joachimheintz/judo/tree/master/strays). but 
this implies including a lot of UDO code. if you are interested, though, 
i am happy to explain more in detail what i mean.

best -

	joachim



Am 19.08.2013 03:33, schrieb luis jure:
>
> hello list,
>
> i have been working very little with csound lately and i really feel i'm
> way behind all its incredible new features. actually, i still have to
> catch up with features that have been around for years now...
>
> now i intend to do some csounding again, and i'd like to do things a little
> different from the "old way" i learned so many years ago. but i have so
> many questions, that i need the help of the list...
>
> let's begin with a simplified example. suppose i have two tables defined
> with ftgen, and their table numbers assigned to global variables gisine
> and gicomp:
>
> gisine	ftgen	0, 0, 65536, 10, 1
> gicomp	ftgen	0, 0, 65536, 10, 1, 1, 1, 1, 1, 1, 1, 1
>
> the tables are later used by an oscil.
>
> the question is, how can i chose from the score which table i want to use
> for each note? i know i could assign the tables to static numbers, but
> that's what i don't want to do. i have lots of tables and i would like to
> address them by name.
>
> thank you in advance from an old newbie,
>
>
> lj
>
>
> Send bugs reports to the Sourceforge bug trackers
> csound6:
>              https://sourceforge.net/p/csound/tickets/
> csound5:
>              https://sourceforge.net/p/csound/bugs/
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>
>
>

Date2013-08-19 15:44
Fromluis jure
SubjectRe: [Csnd] newbie again...
on 2013-08-19 at 08:05 Tarmo Johannes wrote:

> you can set the table nuber with the ifn parameter, you don't need to 
> leave it 0

yes, i know, that would solve my "problem". but that's what i was trying to
avoid, i wanted to see if it was possible/easy to leave the table numbers
to be assigned dynamically by csound, and refer to them by names. it's not
only nicer on the score, i think it also makes the code more portable
and/or scalable. but apparently it's not so easy, so i'm ready to forget
it. or i might define macros with names assigned to numbers or something
like that.

best!


lj

Date2013-08-19 15:53
FromMichael Gogins
SubjectRe: [Csnd] newbie again...
You can do ftgenonce to define tables inside instruments. They don't need to be defined in the orc header or the score any more. This is what I do.

If you use ftgen in the score header you can assign the ftable number to a global variable and then refer to that in the instrument.

Hope this helps,
Mike


===========================
Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com


On Mon, Aug 19, 2013 at 10:44 AM, luis jure <ljc@internet.com.uy> wrote:

on 2013-08-19 at 08:05 Tarmo Johannes wrote:

> you can set the table nuber with the ifn parameter, you don't need to
> leave it 0

yes, i know, that would solve my "problem". but that's what i was trying to
avoid, i wanted to see if it was possible/easy to leave the table numbers
to be assigned dynamically by csound, and refer to them by names. it's not
only nicer on the score, i think it also makes the code more portable
and/or scalable. but apparently it's not so easy, so i'm ready to forget
it. or i might define macros with names assigned to numbers or something
like that.

best!


lj


Send bugs reports to the Sourceforge bug trackers
csound6:
            https://sourceforge.net/p/csound/tickets/
csound5:
            https://sourceforge.net/p/csound/bugs/
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"




Date2013-08-19 16:05
Fromluis jure
SubjectRe: [Csnd] newbie again...
on 2013-08-19 at 09:45 joachim heintz wrote:

> i indeed think you cannot do this.

hmmm, i was suspecting that much, really... i actually spent quite some
time fighting with this before writing to the list. 

i might be completely wrong here (i haven't used the string opcodes much),
but i think that what i need is an opcode that is the opposite of strset.
that is, something that assigns a number to a string:

	strseto	istring, iarg

i'd need of course the complementary strgeto, only that it wouldn't return
a string but a number.

then i could write (i imagine) something like this:


gisine	ftgen	0, 0, 65536, 10, 1

	strseto	"sine", gisine

itable	strgeto	p4	; in the score p4 is "sine"
asig	oscil	1, 440, itable

does that make sense?

best,


lj

Date2013-08-19 16:07
FromMichael Gogins
SubjectRe: [Csnd] newbie again...
That makes sense. Thinking...


===========================
Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com


On Mon, Aug 19, 2013 at 11:05 AM, luis jure <ljc@internet.com.uy> wrote:

on 2013-08-19 at 09:45 joachim heintz wrote:

> i indeed think you cannot do this.

hmmm, i was suspecting that much, really... i actually spent quite some
time fighting with this before writing to the list.

i might be completely wrong here (i haven't used the string opcodes much),
but i think that what i need is an opcode that is the opposite of strset.
that is, something that assigns a number to a string:

        strseto istring, iarg

i'd need of course the complementary strgeto, only that it wouldn't return
a string but a number.

then i could write (i imagine) something like this:


gisine  ftgen   0, 0, 65536, 10, 1

        strseto "sine", gisine

itable  strgeto p4      ; in the score p4 is "sine"
asig    oscil   1, 440, itable

does that make sense?

best,


lj


Send bugs reports to the Sourceforge bug trackers
csound6:
            https://sourceforge.net/p/csound/tickets/
csound5:
            https://sourceforge.net/p/csound/bugs/
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"




Date2013-08-19 16:13
FromAndres Cabrera
SubjectRe: [Csnd] newbie again...

Maybe this is a good use case to support dictionaries as a new built in type?

Cheers,
Andres

On Aug 19, 2013 8:08 AM, "Michael Gogins" <michael.gogins@gmail.com> wrote:
That makes sense. Thinking...


===========================
Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com


On Mon, Aug 19, 2013 at 11:05 AM, luis jure <ljc@internet.com.uy> wrote:

on 2013-08-19 at 09:45 joachim heintz wrote:

> i indeed think you cannot do this.

hmmm, i was suspecting that much, really... i actually spent quite some
time fighting with this before writing to the list.

i might be completely wrong here (i haven't used the string opcodes much),
but i think that what i need is an opcode that is the opposite of strset.
that is, something that assigns a number to a string:

        strseto istring, iarg

i'd need of course the complementary strgeto, only that it wouldn't return
a string but a number.

then i could write (i imagine) something like this:


gisine  ftgen   0, 0, 65536, 10, 1

        strseto "sine", gisine

itable  strgeto p4      ; in the score p4 is "sine"
asig    oscil   1, 440, itable

does that make sense?

best,


lj


Send bugs reports to the Sourceforge bug trackers
csound6:
            https://sourceforge.net/p/csound/tickets/
csound5:
            https://sourceforge.net/p/csound/bugs/
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"




Date2013-08-19 16:58
FromMichael Gogins
SubjectRe: [Csnd] newbie again...

Yes. Like python or lua.

On Aug 19, 2013 11:13 AM, "Andres Cabrera" <mantaraya36@gmail.com> wrote:

Maybe this is a good use case to support dictionaries as a new built in type?

Cheers,
Andres

On Aug 19, 2013 8:08 AM, "Michael Gogins" <michael.gogins@gmail.com> wrote:
That makes sense. Thinking...


===========================
Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com


On Mon, Aug 19, 2013 at 11:05 AM, luis jure <ljc@internet.com.uy> wrote:

on 2013-08-19 at 09:45 joachim heintz wrote:

> i indeed think you cannot do this.

hmmm, i was suspecting that much, really... i actually spent quite some
time fighting with this before writing to the list.

i might be completely wrong here (i haven't used the string opcodes much),
but i think that what i need is an opcode that is the opposite of strset.
that is, something that assigns a number to a string:

        strseto istring, iarg

i'd need of course the complementary strgeto, only that it wouldn't return
a string but a number.

then i could write (i imagine) something like this:


gisine  ftgen   0, 0, 65536, 10, 1

        strseto "sine", gisine

itable  strgeto p4      ; in the score p4 is "sine"
asig    oscil   1, 440, itable

does that make sense?

best,


lj


Send bugs reports to the Sourceforge bug trackers
csound6:
            https://sourceforge.net/p/csound/tickets/
csound5:
            https://sourceforge.net/p/csound/bugs/
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"




Date2013-08-20 00:17
Fromluis jure
SubjectRe: [Csnd] newbie again...
on 2013-08-19 at 11:58 Michael Gogins wrote:

> Yes. Like python or lua.

like wow, python-like dictionaries in csound would be an incredible
addition. 

i still think though that a pair of opcodes symmetric to strset and
strget would be handy on many situations.


best,


lj