Csound Csound-dev Csound-tekno Search About

[Csnd] midi split pointsplitpoint

Date2009-04-16 20:18
FromStefan Thomas
Subject[Csnd] midi split pointsplitpoint
Dear community,
I've created a score that uses 2 different instruments, created with
additive synthesis.
I would like to use the first instrument for the lower, and the second
for the higher register.
I would like to know, if and how this could be done.
Thanks for Your patience
Stefan

Date2009-04-16 22:30
FromIain McCurdy
Subject[Csnd] RE: midi split pointsplitpoint
Hi Stefan,

You could put your two instruments within one instrument block and select the appropriate one according to note played using 'if' statements as below:

----------------------------------------------------------------------

gisound1 ftgen 0,0,4096,10,1
gisound2 ftgen 0,0,4096,10,1,0,.5,0,.2,0,.05,0,.01

0dbfs =    1    ;MAXIMUM AMPLITUDE IS SET AT A VALUE OF 1

instr 1

;READ IN MIDI NOTE NUMBERS
inum notnum
;READ IN MIDI NOTE NUMBERS AS CYCLES PER SECOND
icps cpsmidi
;SET SPLIT POINT
isplitpoint init 60

;INTERROGATE NOTE NUMBER
if (inum<isplitpoint) then
  ;SOUND 1 FOR NOTES BELOW SPLIT POINT
  asig oscili .5,icps,gisound1

else
  ;SOUND 2 FOR NOTES ABOVE SPLIT POINT
  asig oscili .5,icps,gisound2
endif

out asig

endin

----------------------------------------------------------------------


bye, Iain

> Date: Thu, 16 Apr 2009 21:18:47 +0200
> From: kontrapunktstefan@googlemail.com
> To: csound@lists.bath.ac.uk
> Subject: [Csnd] midi split pointsplitpoint
>
> Dear community,
> I've created a score that uses 2 different instruments, created with
> additive synthesis.
> I would like to use the first instrument for the lower, and the second
> for the higher register.
> I would like to know, if and how this could be done.
> Thanks for Your patience
> Stefan
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"


Rediscover Hotmail®: Now available on your iPhone or BlackBerry Check it out.

Date2009-04-19 08:57
FromStefan Thomas
Subject[Csnd] Re: RE: midi split pointsplitpoint
Dear Ian,
thanks for Your help.
But I used two instruments with additive synthesis and I don't know
how to use the gen-tables under these circumstances.

2009/4/16 Iain McCurdy :
> Hi Stefan,
>
> You could put your two instruments within one instrument block and select
> the appropriate one according to note played using 'if' statements as below:
>
> ----------------------------------------------------------------------
>
> gisound1 ftgen 0,0,4096,10,1
> gisound2 ftgen 0,0,4096,10,1,0,.5,0,.2,0,.05,0,.01
>
> 0dbfs =    1    ;MAXIMUM AMPLITUDE IS SET AT A VALUE OF 1
>
> instr 1
>
> ;READ IN MIDI NOTE NUMBERS
> inum notnum
> ;READ IN MIDI NOTE NUMBERS AS CYCLES PER SECOND
> icps cpsmidi
> ;SET SPLIT POINT
> isplitpoint init 60
>
> ;INTERROGATE NOTE NUMBER
> if (inum   ;SOUND 1 FOR NOTES BELOW SPLIT POINT
>   asig oscili .5,icps,gisound1
>
> else
>   ;SOUND 2 FOR NOTES ABOVE SPLIT POINT
>   asig oscili .5,icps,gisound2
> endif
>
> out asig
>
> endin
>
> ----------------------------------------------------------------------
>
>
> bye, Iain
>
>> Date: Thu, 16 Apr 2009 21:18:47 +0200
>> From: kontrapunktstefan@googlemail.com
>> To: csound@lists.bath.ac.uk
>> Subject: [Csnd] midi split pointsplitpoint
>>
>> Dear community,
>> I've created a score that uses 2 different instruments, created with
>> additive synthesis.
>> I would like to use the first instrument for the lower, and the second
>> for the higher register.
>> I would like to know, if and how this could be done.
>> Thanks for Your patience
>> Stefan
>>
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>> csound"
>
> ________________________________
> Rediscover Hotmail®: Now available on your iPhone or BlackBerry Check it
> out.


Date2009-04-19 12:21
FromIain McCurdy
Subject[Csnd] RE: midi split pointsplitpoint
Hi Stefan,

There should be no reason why your two instruments can't be combined in a single instrument block to implement the keyboard split that you want. This example I gave with the two gen tables was just to provide a simple illustration. You would place your instrument 1 code in the block for SOUND 1 after the 'if' statement and the code for instrument 2 in the block for SOUND 2 after the 'else' statement.
If you would like further help perhaps you could post the code for your two instruments.

Hope this helps,
Iain

> Date: Sun, 19 Apr 2009 09:57:00 +0200
> From: kontrapunktstefan@googlemail.com
> To: csound@lists.bath.ac.uk
> Subject: [Csnd] Re: RE: midi split pointsplitpoint
>
> Dear Ian,
> thanks for Your help.
> But I used two instruments with additive synthesis and I don't know
> how to use the gen-tables under these circumstances.
>
> 2009/4/16 Iain McCurdy <i_mccurdy@hotmail.com>:
> > Hi Stefan,
> >
> > You could put your two instruments within one instrument block and select
> > the appropriate one according to note played using 'if' statements as below:
> >
> > ----------------------------------------------------------------------
> >
> > gisound1 ftgen 0,0,4096,10,1
> > gisound2 ftgen 0,0,4096,10,1,0,.5,0,.2,0,.05,0,.01
> >
> > 0dbfs =    1    ;MAXIMUM AMPLITUDE IS SET AT A VALUE OF 1
> >
> > instr 1
> >
> > ;READ IN MIDI NOTE NUMBERS
> > inum notnum
> > ;READ IN MIDI NOTE NUMBERS AS CYCLES PER SECOND
> > icps cpsmidi
> > ;SET SPLIT POINT
> > isplitpoint init 60
> >
> > ;INTERROGATE NOTE NUMBER
> > if (inum<isplitpoint) then
> >   ;SOUND 1 FOR NOTES BELOW SPLIT POINT
> >   asig oscili .5,icps,gisound1
> >
> > else
> >   ;SOUND 2 FOR NOTES ABOVE SPLIT POINT
> >   asig oscili .5,icps,gisound2
> > endif
> >
> > out asig
> >
> > endin
> >
> > ----------------------------------------------------------------------
> >
> >
> > bye, Iain
> >
> >> Date: Thu, 16 Apr 2009 21:18:47 +0200
> >> From: kontrapunktstefan@googlemail.com
> >> To: csound@lists.bath.ac.uk
> >> Subject: [Csnd] midi split pointsplitpoint
> >>
> >> Dear community,
> >> I've created a score that uses 2 different instruments, created with
> >> additive synthesis.
> >> I would like to use the first instrument for the lower, and the second
> >> for the higher register.
> >> I would like to know, if and how this could be done.
> >> Thanks for Your patience
> >> Stefan
> >>
> >>
> >> Send bugs reports to this list.
> >> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> >> csound"
> >
> > ________________________________
> > Rediscover Hotmail®: Now available on your iPhone or BlackBerry Check it
> > out.
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"


Windows Live™: Life without walls. Check it out.

Date2009-04-19 21:00
FromStefan Thomas
Subject[Csnd] Re: RE: midi split pointsplitpoint
Attachmentsmidisplit.csd  
Dear Iain,
thanks for Your helped. I succeeded with one splitpoint and midi-key
60, but I had now success with to different splitpoints.
Here is the (as short as possble) code:


-odevaudio -M1 -b400 ; fuer realtime-Midi

;jetzt gilt es, das erste  Instrument zu definieren

sr = 44100
kr = 4410
ksmps = 10
nchnls = 2
 ipch = 8.02
  iequal = 12



massign    0, 1              ; assign all midi events to instr 1,
pgmassign  0, 1              ; also all program changes
instr 1

 ituningtable = 10         ; the number of the f-table

 imnn    notnum
 indx    =  imnn * 2 + 1   ; values in table alternate between
 icps    table  indx, ituningtable
 icps    table  indx, ituningtable
  iamp    ampmidi    	1000
isplitpoint1 init 60 ; der Midisplitpoint 1 wird festgelegt, bei Taste 60
isplitpoint2 init 72; der zweite ist ne Oktave hoeher

a1    	oscil   iamp, 	icps, 1
a2	oscil	iamp/2, icps*1.1, 1
a3 	oscil	iamp/3,	icps*2.2, 1
amix1 	= a1
amix2 	= a1+a2
amix3	= a1+a2+a3
if (icpsisplitpoint1
; die Partiturereignisse werden definiert

; Tabelle #1, ein Sinuston
f1  0   8193  10   1
f 10  0 256 -23 "../skalen/12tet.cps"
;hier gilt es aufzupassen, ob die Pfadangabe stimmt
t 0 30 ; keine Ahnung, was das heißt

i1   0    3600 ; eine Stunde lang spielen




2009/4/19 Iain McCurdy :
> Hi Stefan,
>
> There should be no reason why your two instruments can't be combined in a
> single instrument block to implement the keyboard split that you want. This
> example I gave with the two gen tables was just to provide a simple
> illustration. You would place your instrument 1 code in the block for SOUND
> 1 after the 'if' statement and the code for instrument 2 in the block for
> SOUND 2 after the 'else' statement.
> If you would like further help perhaps you could post the code for your two
> instruments.
>
> Hope this helps,
> Iain
>
>> Date: Sun, 19 Apr 2009 09:57:00 +0200
>> From: kontrapunktstefan@googlemail.com
>> To: csound@lists.bath.ac.uk
>> Subject: [Csnd] Re: RE: midi split pointsplitpoint
>>
>> Dear Ian,
>> thanks for Your help.
>> But I used two instruments with additive synthesis and I don't know
>> how to use the gen-tables under these circumstances.
>>
>> 2009/4/16 Iain McCurdy :
>> > Hi Stefan,
>> >
>> > You could put your two instruments within one instrument block and
>> > select
>> > the appropriate one according to note played using 'if' statements as
>> > below:
>> >
>> > ----------------------------------------------------------------------
>> >
>> > gisound1 ftgen 0,0,4096,10,1
>> > gisound2 ftgen 0,0,4096,10,1,0,.5,0,.2,0,.05,0,.01
>> >
>> > 0dbfs =    1    ;MAXIMUM AMPLITUDE IS SET AT A VALUE OF 1
>> >
>> > instr 1
>> >
>> > ;READ IN MIDI NOTE NUMBERS
>> > inum notnum
>> > ;READ IN MIDI NOTE NUMBERS AS CYCLES PER SECOND
>> > icps cpsmidi
>> > ;SET SPLIT POINT
>> > isplitpoint init 60
>> >
>> > ;INTERROGATE NOTE NUMBER
>> > if (inum> >   ;SOUND 1 FOR NOTES BELOW SPLIT POINT
>> >   asig oscili .5,icps,gisound1
>> >
>> > else
>> >   ;SOUND 2 FOR NOTES ABOVE SPLIT POINT
>> >   asig oscili .5,icps,gisound2
>> > endif
>> >
>> > out asig
>> >
>> > endin
>> >
>> > ----------------------------------------------------------------------
>> >
>> >
>> > bye, Iain
>> >
>> >> Date: Thu, 16 Apr 2009 21:18:47 +0200
>> >> From: kontrapunktstefan@googlemail.com
>> >> To: csound@lists.bath.ac.uk
>> >> Subject: [Csnd] midi split pointsplitpoint
>> >>
>> >> Dear community,
>> >> I've created a score that uses 2 different instruments, created with
>> >> additive synthesis.
>> >> I would like to use the first instrument for the lower, and the second
>> >> for the higher register.
>> >> I would like to know, if and how this could be done.
>> >> Thanks for Your patience
>> >> Stefan
>> >>
>> >>
>> >> Send bugs reports to this list.
>> >> To unsubscribe, send email sympa@lists.bath.ac.uk with body
>> >> "unsubscribe
>> >> csound"
>> >
>> > ________________________________
>> > Rediscover Hotmail®: Now available on your iPhone or BlackBerry Check it
>> > out.
>>
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>> csound"
>
> ________________________________
> Windows Live™: Life without walls. Check it out.

Date2009-04-19 21:01
FromStefan Thomas
Subject[Csnd] Re: RE: midi split pointsplitpoint
Sorry, I wanted to say:
I had no success!

2009/4/19 Stefan Thomas :
> Dear Iain,
> thanks for Your helped. I succeeded with one splitpoint and midi-key
> 60, but I had now success with to different splitpoints.
> Here is the (as short as possble) code:
> 
> 
> -odevaudio -M1 -b400 ; fuer realtime-Midi
> 
> ;jetzt gilt es, das erste  Instrument zu definieren
> 
> sr = 44100
> kr = 4410
> ksmps = 10
> nchnls = 2
>  ipch = 8.02
>  iequal = 12
>
>
>
> massign    0, 1              ; assign all midi events to instr 1,
> pgmassign  0, 1              ; also all program changes
> instr 1
>
>  ituningtable = 10         ; the number of the f-table
>
>  imnn    notnum
>  indx    =  imnn * 2 + 1   ; values in table alternate between
>  icps    table  indx, ituningtable
>  icps    table  indx, ituningtable
>  iamp    ampmidi       1000
> isplitpoint1 init 60 ; der Midisplitpoint 1 wird festgelegt, bei Taste 60
> isplitpoint2 init 72; der zweite ist ne Oktave hoeher
>
> a1      oscil   iamp,   icps, 1
> a2      oscil   iamp/2, icps*1.1, 1
> a3      oscil   iamp/3, icps*2.2, 1
> amix1   = a1
> amix2   = a1+a2
> amix3   = a1+a2+a3
> if (icps outs    amix1, amix1
> if (icps>isplitpoint1 then
> outs    amix2, amix2
> else
> outs    amix3, amix3
> endif
>
>
>      endin
>
> 
> ; die Partiturereignisse werden definiert
> 
> ; Tabelle #1, ein Sinuston
> f1  0   8193  10   1
> f 10  0 256 -23 "../skalen/12tet.cps"
> ;hier gilt es aufzupassen, ob die Pfadangabe stimmt
> t 0 30 ; keine Ahnung, was das heißt
>
> i1   0    3600 ; eine Stunde lang spielen
> 
> 
>
>
> 2009/4/19 Iain McCurdy :
>> Hi Stefan,
>>
>> There should be no reason why your two instruments can't be combined in a
>> single instrument block to implement the keyboard split that you want. This
>> example I gave with the two gen tables was just to provide a simple
>> illustration. You would place your instrument 1 code in the block for SOUND
>> 1 after the 'if' statement and the code for instrument 2 in the block for
>> SOUND 2 after the 'else' statement.
>> If you would like further help perhaps you could post the code for your two
>> instruments.
>>
>> Hope this helps,
>> Iain
>>
>>> Date: Sun, 19 Apr 2009 09:57:00 +0200
>>> From: kontrapunktstefan@googlemail.com
>>> To: csound@lists.bath.ac.uk
>>> Subject: [Csnd] Re: RE: midi split pointsplitpoint
>>>
>>> Dear Ian,
>>> thanks for Your help.
>>> But I used two instruments with additive synthesis and I don't know
>>> how to use the gen-tables under these circumstances.
>>>
>>> 2009/4/16 Iain McCurdy :
>>> > Hi Stefan,
>>> >
>>> > You could put your two instruments within one instrument block and
>>> > select
>>> > the appropriate one according to note played using 'if' statements as
>>> > below:
>>> >
>>> > ----------------------------------------------------------------------
>>> >
>>> > gisound1 ftgen 0,0,4096,10,1
>>> > gisound2 ftgen 0,0,4096,10,1,0,.5,0,.2,0,.05,0,.01
>>> >
>>> > 0dbfs =    1    ;MAXIMUM AMPLITUDE IS SET AT A VALUE OF 1
>>> >
>>> > instr 1
>>> >
>>> > ;READ IN MIDI NOTE NUMBERS
>>> > inum notnum
>>> > ;READ IN MIDI NOTE NUMBERS AS CYCLES PER SECOND
>>> > icps cpsmidi
>>> > ;SET SPLIT POINT
>>> > isplitpoint init 60
>>> >
>>> > ;INTERROGATE NOTE NUMBER
>>> > if (inum>> >   ;SOUND 1 FOR NOTES BELOW SPLIT POINT
>>> >   asig oscili .5,icps,gisound1
>>> >
>>> > else
>>> >   ;SOUND 2 FOR NOTES ABOVE SPLIT POINT
>>> >   asig oscili .5,icps,gisound2
>>> > endif
>>> >
>>> > out asig
>>> >
>>> > endin
>>> >
>>> > ----------------------------------------------------------------------
>>> >
>>> >
>>> > bye, Iain
>>> >
>>> >> Date: Thu, 16 Apr 2009 21:18:47 +0200
>>> >> From: kontrapunktstefan@googlemail.com
>>> >> To: csound@lists.bath.ac.uk
>>> >> Subject: [Csnd] midi split pointsplitpoint
>>> >>
>>> >> Dear community,
>>> >> I've created a score that uses 2 different instruments, created with
>>> >> additive synthesis.
>>> >> I would like to use the first instrument for the lower, and the second
>>> >> for the higher register.
>>> >> I would like to know, if and how this could be done.
>>> >> Thanks for Your patience
>>> >> Stefan
>>> >>
>>> >>
>>> >> Send bugs reports to this list.
>>> >> To unsubscribe, send email sympa@lists.bath.ac.uk with body
>>> >> "unsubscribe
>>> >> csound"
>>> >
>>> > ________________________________
>>> > Rediscover Hotmail®: Now available on your iPhone or BlackBerry Check it
>>> > out.
>>>
>>>
>>> Send bugs reports to this list.
>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>>> csound"
>>
>> ________________________________
>> Windows Live™: Life without walls. Check it out.
>


Date2009-04-19 22:18
FromIain McCurdy
Subject[Csnd] RE: Re: RE: midi split pointsplitpoint
Hi Stefan,

I spotted a couple of problems in your code.
    if (icps>isplitpoint1<isplitpoint2)
isn't correct syntax, you probably want
    if (icps>=isplitpoint1)&&(icps<isplitpoint2) then
An 'if' statement needs to be concluded with a 'then'.
You will need the '>=' otherwise there will be a note not covered by a keygroup. (Although I think your sound are overlayed so this might not be a problem.)

'if' conditional branches (or a sequence of 'if's 'elseif's and 'else's) should be concluded with an 'endif'

Instead of using a series 'if's, particularly if they are mutually exclusive consider using 'if', 'elseif' and 'else's. (Followed by an endif).

I haven't tried your example as I don't have your 'cps' file but here is a simple example creating 3 'keygroups':

<CsoundSynthesizer>

<CsOptions>
-odevaudio -M0 -b400
</CsOptions>

<CsInstruments>

sr = 44100
ksmps = 100
nchnls = 1

gisound1 ftgen 0,0,4096,10,1
gisound2 ftgen 0,0,4096,10,1,0,.5,0,.2,0,.05,0,.01
gisound3 ftgen 0,0,4096,10,0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1

0dbfs =    1    ;MAXIMUM AMPLITUDE IS SET AT A VALUE OF 1

instr 1

;READ IN MIDI NOTE NUMBERS
inum notnum
;READ IN MIDI NOTE NUMBERS AS CYCLES PER SECOND
icps cpsmidi
;SET SPLIT POINT
isplitpoint1 init 60
isplitpoint2 init 66

;INTERROGATE NOTE NUMBER

if (inum<isplitpoint1) then
  ;SOUND 1 FOR NOTES IN ZONE 1
  asig oscili .5,icps,gisound1

elseif (inum>=isplitpoint1)&&(inum<isplitpoint2) then
  ;SOUND 2 FOR NOTES IN ZONE 2
  asig oscili .5,icps,gisound2

else
  ;SOUND 3 FOR NOTES IN ZONE 3
  asig oscili .5,icps,gisound3

endif

out asig

endin

</CsInstruments>

<CsScore>
f 0 3600    ;DUMMY SCORE EVENT KEEPS PERFORMANCE GOING FOR 1 HOUR
</CsScore>

</CsoundSynthesizer>

-------------------------------------------------------------------------------------



> Date: Sun, 19 Apr 2009 22:00:26 +0200
> From: kontrapunktstefan@googlemail.com
> To: csound@lists.bath.ac.uk
> Subject: [Csnd] Re: RE: midi split pointsplitpoint
>
> Dear Iain,
> thanks for Your helped. I succeeded with one splitpoint and midi-key
> 60, but I had now success with to different splitpoints.
> Here is the (as short as possble) code:
> <CsoundSynthesizer>
> <CsOptions>
> -odevaudio -M1 -b400 ; fuer realtime-Midi
> </CsOptions>
> ;jetzt gilt es, das erste Instrument zu definieren
> <CsInstruments>
> sr = 44100
> kr = 4410
> ksmps = 10
> nchnls = 2
> ipch = 8.02
> iequal = 12
>
>
>
> massign 0, 1 ; assign all midi events to instr 1,
> pgmassign 0, 1 ; also all program changes
> instr 1
>
> ituningtable = 10 ; the number of the f-table
>
> imnn notnum
> indx = imnn * 2 + 1 ; values in table alternate between
> icps table indx, ituningtable
> icps table indx, ituningtable
> iamp ampmidi 1000
> isplitpoint1 init 60 ; der Midisplitpoint 1 wird festgelegt, bei Taste 60
> isplitpoint2 init 72; der zweite ist ne Oktave hoeher
>
> a1 oscil iamp, icps, 1
> a2 oscil iamp/2, icps*1.1, 1
> a3 oscil iamp/3, icps*2.2, 1
> amix1 = a1
> amix2 = a1+a2
> amix3 = a1+a2+a3
> if (icps<isplitpoint1) then
> outs amix1, amix1
> if (icps>isplitpoint1<isplitpoint2)
> then
> outs amix2, amix2
> else
> outs amix3, amix3
> endif
>
>
> endin
>
> </CsInstruments>
> ; die Partiturereignisse werden definiert
> <CsScore>
> ; Tabelle #1, ein Sinuston
> f1 0 8193 10 1
> f 10 0 256 -23 "../skalen/12tet.cps"
> ;hier gilt es aufzupassen, ob die Pfadangabe stimmt
> t 0 30 ; keine Ahnung, was das heißt
>
> i1 0 3600 ; eine Stunde lang spielen
> </CsScore>
> </CsoundSynthesizer>
>
>
> 2009/4/19 Iain McCurdy <i_mccurdy@hotmail.com>:
> > Hi Stefan,
> >
> > There should be no reason why your two instruments can't be combined in a
> > single instrument block to implement the keyboard split that you want. This
> > example I gave with the two gen tables was just to provide a simple
> > illustration. You would place your instrument 1 code in the block for SOUND
> > 1 after the 'if' statement and the code for instrument 2 in the block for
> > SOUND 2 after the 'else' statement.
> > If you would like further help perhaps you could post the code for your two
> > instruments.
> >
> > Hope this helps,
> > Iain
> >
> >> Date: Sun, 19 Apr 2009 09:57:00 +0200
> >> From: kontrapunktstefan@googlemail.com
> >> To: csound@lists.bath.ac.uk
> >> Subject: [Csnd] Re: RE: midi split pointsplitpoint
> >>
> >> Dear Ian,
> >> thanks for Your help.
> >> But I used two instruments with additive synthesis and I don't know
> >> how to use the gen-tables under these circumstances.
> >>
> >> 2009/4/16 Iain McCurdy <i_mccurdy@hotmail.com>:
> >> > Hi Stefan,
> >> >
> >> > You could put your two instruments within one instrument block and
> >> > select
> >> > the appropriate one according to note played using 'if' statements as
> >> > below:
> >> >
> >> > ----------------------------------------------------------------------
> >> >
> >> > gisound1 ftgen 0,0,4096,10,1
> >> > gisound2 ftgen 0,0,4096,10,1,0,.5,0,.2,0,.05,0,.01
> >> >
> >> > 0dbfs =    1    ;MAXIMUM AMPLITUDE IS SET AT A VALUE OF 1
> >> >
> >> > instr 1
> >> >
> >> > ;READ IN MIDI NOTE NUMBERS
> >> > inum notnum
> >> > ;READ IN MIDI NOTE NUMBERS AS CYCLES PER SECOND
> >> > icps cpsmidi
> >> > ;SET SPLIT POINT
> >> > isplitpoint init 60
> >> >
> >> > ;INTERROGATE NOTE NUMBER
> >> > if (inum<isplitpoint) then
> >> >   ;SOUND 1 FOR NOTES BELOW SPLIT POINT
> >> >   asig oscili .5,icps,gisound1
> >> >
> >> > else
> >> >   ;SOUND 2 FOR NOTES ABOVE SPLIT POINT
> >> >   asig oscili .5,icps,gisound2
> >> > endif
> >> >
> >> > out asig
> >> >
> >> > endin
> >> >
> >> > ----------------------------------------------------------------------
> >> >
> >> >
> >> > bye, Iain
> >> >
> >> >> Date: Thu, 16 Apr 2009 21:18:47 +0200
> >> >> From: kontrapunktstefan@googlemail.com
> >> >> To: csound@lists.bath.ac.uk
> >> >> Subject: [Csnd] midi split pointsplitpoint
> >> >>
> >> >> Dear community,
> >> >> I've created a score that uses 2 different instruments, created with
> >> >> additive synthesis.
> >> >> I would like to use the first instrument for the lower, and the second
> >> >> for the higher register.
> >> >> I would like to know, if and how this could be done.
> >> >> Thanks for Your patience
> >> >> Stefan
> >> >>
> >> >>
> >> >> Send bugs reports to this list.
> >> >> To unsubscribe, send email sympa@lists.bath.ac.uk with body
> >> >> "unsubscribe
> >> >> csound"
> >> >
> >> > ________________________________
> >> > Rediscover Hotmail®: Now available on your iPhone or BlackBerry Check it
> >> > out.
> >>
> >>
> >> Send bugs reports to this list.
> >> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> >> csound"
> >
> > ________________________________
> > Windows Live™: Life without walls. Check it out.
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"


Rediscover Hotmail®: Now available on your iPhone or BlackBerry Check it out.

Date2009-04-20 09:04
FromStefan Thomas
Subject[Csnd] Re: RE: Re: RE: midi split pointsplitpoint
Dear Iain,
thanks very much! Now I've understand (at least I think so), the
syntax of the if-clauses. It is not too difficult to understand, but
also not easy for someone like me, who has no experiences with
programming.
Again,
thanks!
Now I know how to do, what I want!

2009/4/19 Iain McCurdy :
> Hi Stefan,
>
> I spotted a couple of problems in your code.
>     if (icps>isplitpoint1 isn't correct syntax, you probably want
>     if (icps>=isplitpoint1)&&(icps An 'if' statement needs to be concluded with a 'then'.
> You will need the '>=' otherwise there will be a note not covered by a
> keygroup. (Although I think your sound are overlayed so this might not be a
> problem.)
>
> 'if' conditional branches (or a sequence of 'if's 'elseif's and 'else's)
> should be concluded with an 'endif'
>
> Instead of using a series 'if's, particularly if they are mutually exclusive
> consider using 'if', 'elseif' and 'else's. (Followed by an endif).
>
> I haven't tried your example as I don't have your 'cps' file but here is a
> simple example creating 3 'keygroups':
>
> 
>
> 
> -odevaudio -M0 -b400
> 
>
> 
>
> sr = 44100
> ksmps = 100
> nchnls = 1
>
> gisound1 ftgen 0,0,4096,10,1
> gisound2 ftgen 0,0,4096,10,1,0,.5,0,.2,0,.05,0,.01
> gisound3 ftgen 0,0,4096,10,0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1
>
> 0dbfs =    1    ;MAXIMUM AMPLITUDE IS SET AT A VALUE OF 1
>
> instr 1
>
> ;READ IN MIDI NOTE NUMBERS
> inum notnum
> ;READ IN MIDI NOTE NUMBERS AS CYCLES PER SECOND
> icps cpsmidi
> ;SET SPLIT POINT
> isplitpoint1 init 60
> isplitpoint2 init 66
>
> ;INTERROGATE NOTE NUMBER
>
> if (inum   ;SOUND 1 FOR NOTES IN ZONE 1
>   asig oscili .5,icps,gisound1
>
> elseif (inum>=isplitpoint1)&&(inum   ;SOUND 2 FOR NOTES IN ZONE 2
>   asig oscili .5,icps,gisound2
>
> else
>   ;SOUND 3 FOR NOTES IN ZONE 3
>   asig oscili .5,icps,gisound3
>
> endif
>
> out asig
>
> endin
>
> 
>
> 
> f 0 3600    ;DUMMY SCORE EVENT KEEPS PERFORMANCE GOING FOR 1 HOUR
> 
>
> 
>
> -------------------------------------------------------------------------------------
>
>
>
>> Date: Sun, 19 Apr 2009 22:00:26 +0200
>> From: kontrapunktstefan@googlemail.com
>> To: csound@lists.bath.ac.uk
>> Subject: [Csnd] Re: RE: midi split pointsplitpoint
>>
>> Dear Iain,
>> thanks for Your helped. I succeeded with one splitpoint and midi-key
>> 60, but I had now success with to different splitpoints.
>> Here is the (as short as possble) code:
>> 
>> 
>> -odevaudio -M1 -b400 ; fuer realtime-Midi
>> 
>> ;jetzt gilt es, das erste Instrument zu definieren
>> 
>> sr = 44100
>> kr = 4410
>> ksmps = 10
>> nchnls = 2
>> ipch = 8.02
>> iequal = 12
>>
>>
>>
>> massign 0, 1 ; assign all midi events to instr 1,
>> pgmassign 0, 1 ; also all program changes
>> instr 1
>>
>> ituningtable = 10 ; the number of the f-table
>>
>> imnn notnum
>> indx = imnn * 2 + 1 ; values in table alternate between
>> icps table indx, ituningtable
>> icps table indx, ituningtable
>> iamp ampmidi 1000
>> isplitpoint1 init 60 ; der Midisplitpoint 1 wird festgelegt, bei Taste 60
>> isplitpoint2 init 72; der zweite ist ne Oktave hoeher
>>
>> a1 oscil iamp, icps, 1
>> a2 oscil iamp/2, icps*1.1, 1
>> a3 oscil iamp/3, icps*2.2, 1
>> amix1 = a1
>> amix2 = a1+a2
>> amix3 = a1+a2+a3
>> if (icps> outs amix1, amix1
>> if (icps>isplitpoint1> then
>> outs amix2, amix2
>> else
>> outs amix3, amix3
>> endif
>>
>>
>> endin
>>
>> 
>> ; die Partiturereignisse werden definiert
>> 
>> ; Tabelle #1, ein Sinuston
>> f1 0 8193 10 1
>> f 10 0 256 -23 "../skalen/12tet.cps"
>> ;hier gilt es aufzupassen, ob die Pfadangabe stimmt
>> t 0 30 ; keine Ahnung, was das heißt
>>
>> i1 0 3600 ; eine Stunde lang spielen
>> 
>> 
>>
>>
>> 2009/4/19 Iain McCurdy :
>> > Hi Stefan,
>> >
>> > There should be no reason why your two instruments can't be combined in
>> > a
>> > single instrument block to implement the keyboard split that you want.
>> > This
>> > example I gave with the two gen tables was just to provide a simple
>> > illustration. You would place your instrument 1 code in the block for
>> > SOUND
>> > 1 after the 'if' statement and the code for instrument 2 in the block
>> > for
>> > SOUND 2 after the 'else' statement.
>> > If you would like further help perhaps you could post the code for your
>> > two
>> > instruments.
>> >
>> > Hope this helps,
>> > Iain
>> >
>> >> Date: Sun, 19 Apr 2009 09:57:00 +0200
>> >> From: kontrapunktstefan@googlemail.com
>> >> To: csound@lists.bath.ac.uk
>> >> Subject: [Csnd] Re: RE: midi split pointsplitpoint
>> >>
>> >> Dear Ian,
>> >> thanks for Your help.
>> >> But I used two instruments with additive synthesis and I don't know
>> >> how to use the gen-tables under these circumstances.
>> >>
>> >> 2009/4/16 Iain McCurdy :
>> >> > Hi Stefan,
>> >> >
>> >> > You could put your two instruments within one instrument block and
>> >> > select
>> >> > the appropriate one according to note played using 'if' statements as
>> >> > below:
>> >> >
>> >> >
>> >> > ----------------------------------------------------------------------
>> >> >
>> >> > gisound1 ftgen 0,0,4096,10,1
>> >> > gisound2 ftgen 0,0,4096,10,1,0,.5,0,.2,0,.05,0,.01
>> >> >
>> >> > 0dbfs =    1    ;MAXIMUM AMPLITUDE IS SET AT A VALUE OF 1
>> >> >
>> >> > instr 1
>> >> >
>> >> > ;READ IN MIDI NOTE NUMBERS
>> >> > inum notnum
>> >> > ;READ IN MIDI NOTE NUMBERS AS CYCLES PER SECOND
>> >> > icps cpsmidi
>> >> > ;SET SPLIT POINT
>> >> > isplitpoint init 60
>> >> >
>> >> > ;INTERROGATE NOTE NUMBER
>> >> > if (inum> >> >   ;SOUND 1 FOR NOTES BELOW SPLIT POINT
>> >> >   asig oscili .5,icps,gisound1
>> >> >
>> >> > else
>> >> >   ;SOUND 2 FOR NOTES ABOVE SPLIT POINT
>> >> >   asig oscili .5,icps,gisound2
>> >> > endif
>> >> >
>> >> > out asig
>> >> >
>> >> > endin
>> >> >
>> >> >
>> >> > ----------------------------------------------------------------------
>> >> >
>> >> >
>> >> > bye, Iain
>> >> >
>> >> >> Date: Thu, 16 Apr 2009 21:18:47 +0200
>> >> >> From: kontrapunktstefan@googlemail.com
>> >> >> To: csound@lists.bath.ac.uk
>> >> >> Subject: [Csnd] midi split pointsplitpoint
>> >> >>
>> >> >> Dear community,
>> >> >> I've created a score that uses 2 different instruments, created with
>> >> >> additive synthesis.
>> >> >> I would like to use the first instrument for the lower, and the
>> >> >> second
>> >> >> for the higher register.
>> >> >> I would like to know, if and how this could be done.
>> >> >> Thanks for Your patience
>> >> >> Stefan
>> >> >>
>> >> >>
>> >> >> Send bugs reports to this list.
>> >> >> To unsubscribe, send email sympa@lists.bath.ac.uk with body
>> >> >> "unsubscribe
>> >> >> csound"
>> >> >
>> >> > ________________________________
>> >> > Rediscover Hotmail®: Now available on your iPhone or BlackBerry Check
>> >> > it
>> >> > out.
>> >>
>> >>
>> >> Send bugs reports to this list.
>> >> To unsubscribe, send email sympa@lists.bath.ac.uk with body
>> >> "unsubscribe
>> >> csound"
>> >
>> > ________________________________
>> > Windows Live™: Life without walls. Check it out.
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>> csound"
>
> ________________________________
> Rediscover Hotmail®: Now available on your iPhone or BlackBerry Check it
> out.