Csound Csound-dev Csound-tekno Search About

[Csnd] panorama, with midi

Date2010-03-23 21:33
FromStefan Thomas
Subject[Csnd] panorama, with midi
Attachments12tet.cps  
Dear community,
I would like to create an instrument, where the panorama depends on the note, that is played.
Could You give me a hint, how I could  do it with the below quoted code?
<CsoundSynthesizer>
;Fm-Modulation with one carrier and two modulators:;
;my first trial!
<CsOptions>
-odevaudio -M1 -b400 -m0d
</CsOptions>
; ==============================================
<CsInstruments>
   
sr    =    48000
kr    =    2400
ksmps    =    20
nchnls    =    2
 ipch = 8.02
  iequal = 12
instr 1
 ituningtable = 10         ; the number of the f-table
 inum    notnum
 indx    =  inum * 2 + 1   ; values in table alternate between
                           ; Midi note nums and frequencies
 icps    table  indx, ituningtable
  iamp    ampmidi        10000
icarfrq = 2*icps
imodratio1 = 1.25 ;the ratio to the carrier for modulator 1
imodratio2 = 0.5    ;the ratio to the carrier for modulator 2
ieinschwing = 0.1
;;;;;;; defining the envelopes
kindexhuellA linsegr     0.1,         0.001,         1,   0.2,       0.001, 0.1, 0.1; a short noise
kindexhuellB linsegr     0.1,         0.1,         1,    5,       0.001,  0.1, 0.1 ; much longer
ifmindex1 = 0.5
ifmindex2 = 0.5
  imodfrq1    = icarfrq * imodratio1
  kmodamp1    = imodfrq1 * ifmindex1*kindexhuellA
  imodfrq2    = icarfrq * imodratio2
  kmodamp2    = imodfrq2 * ifmindex2*kindexhuellB

  kfrq_mod_1  oscil kmodamp1, imodfrq1, 1 
  kfrq_mod_2  oscil kmodamp2, imodfrq2, 1 
;the amplitude envelope for the carrier
klauthuell = kindexhuellB
;and now: all together!
asig        oscil klauthuell*iamp    , icarfrq + kfrq_mod_1 + kfrq_mod_2, 1 
outs asig, asig
endin

</CsInstruments>
; ==============================================
<CsScore>
f1  0  2048   10   1 ; a sinewave
f 10  0 256 -23 "12tet.cps"
f 0     15
</CsScore>
</CsoundSynthesizer>


Date2010-03-23 21:42
FromSteven Yi
Subject[Csnd] Re: panorama, with midi
Hi Stefan,

What criteria are you trying to map?  Is it by pitch maps to a spatial
location?  Or are you saying just how to do panning in genearl? I'd
look at using pan2 (http://csounds.com/manual/html/pan2.html) to do
panning in stereo and either set the value once in the instrument or
can use a value passed in by pfield.

Hope that helps!
steven

On Tue, Mar 23, 2010 at 5:33 PM, Stefan Thomas
 wrote:
> Dear community,
> I would like to create an instrument, where the panorama depends on the
> note, that is played.
> Could You give me a hint, how I could  do it with the below quoted code?
> 
> ;Fm-Modulation with one carrier and two modulators:;
> ;my first trial!
> 
> -odevaudio -M1 -b400 -m0d
> 
> ; ==============================================
> 
>
> sr    =    48000
> kr    =    2400
> ksmps    =    20
> nchnls    =    2
>  ipch = 8.02
>   iequal = 12
> instr 1
>  ituningtable = 10         ; the number of the f-table
>  inum    notnum
>  indx    =  inum * 2 + 1   ; values in table alternate between
>                            ; Midi note nums and frequencies
>  icps    table  indx, ituningtable
>   iamp    ampmidi        10000
> icarfrq = 2*icps
> imodratio1 = 1.25 ;the ratio to the carrier for modulator 1
> imodratio2 = 0.5    ;the ratio to the carrier for modulator 2
> ieinschwing = 0.1
> ;;;;;;; defining the envelopes
> kindexhuellA linsegr     0.1,         0.001,         1,   0.2,       0.001,
> 0.1, 0.1; a short noise
> kindexhuellB linsegr     0.1,         0.1,         1,    5,       0.001,
> 0.1, 0.1 ; much longer
> ifmindex1 = 0.5
> ifmindex2 = 0.5
>   imodfrq1    = icarfrq * imodratio1
>   kmodamp1    = imodfrq1 * ifmindex1*kindexhuellA
>   imodfrq2    = icarfrq * imodratio2
>   kmodamp2    = imodfrq2 * ifmindex2*kindexhuellB
>
>   kfrq_mod_1  oscil kmodamp1, imodfrq1, 1
>   kfrq_mod_2  oscil kmodamp2, imodfrq2, 1
> ;the amplitude envelope for the carrier
> klauthuell = kindexhuellB
> ;and now: all together!
> asig        oscil klauthuell*iamp    , icarfrq + kfrq_mod_1 + kfrq_mod_2, 1
> outs asig, asig
> endin
>
> 
> ; ==============================================
> 
> f1  0  2048   10   1 ; a sinewave
> f 10  0 256 -23 "12tet.cps"
> f 0     15
> 
> 
>
>


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"


Date2010-03-23 21:49
Fromjoachim heintz
Subject[Csnd] Re: panorama, with midi
An easy way to do should be if you bind inum to the pan parameter of  
pan2. So after your asig ... line:
aL, aR pan2 asig, inum/127 (or another relation if you like)
outs aL, aR
Ciao -
	joachim

Am 23.03.2010 um 22:33 schrieb Stefan Thomas:

> Dear community,
> I would like to create an instrument, where the panorama depends on  
> the note, that is played.
> Could You give me a hint, how I could  do it with the below quoted  
> code?
> 
> ;Fm-Modulation with one carrier and two modulators:;
> ;my first trial!
> 
> -odevaudio -M1 -b400 -m0d
> 
> ; ==============================================
> 
>
> sr    =    48000
> kr    =    2400
> ksmps    =    20
> nchnls    =    2
>  ipch = 8.02
>   iequal = 12
> instr 1
>  ituningtable = 10         ; the number of the f-table
>  inum    notnum
>  indx    =  inum * 2 + 1   ; values in table alternate between
>                            ; Midi note nums and frequencies
>  icps    table  indx, ituningtable
>   iamp    ampmidi        10000
> icarfrq = 2*icps
> imodratio1 = 1.25 ;the ratio to the carrier for modulator 1
> imodratio2 = 0.5    ;the ratio to the carrier for modulator 2
> ieinschwing = 0.1
> ;;;;;;; defining the envelopes
> kindexhuellA linsegr     0.1,         0.001,         1,   0.2,        
> 0.001, 0.1, 0.1; a short noise
> kindexhuellB linsegr     0.1,         0.1,         1,    5,        
> 0.001,  0.1, 0.1 ; much longer
> ifmindex1 = 0.5
> ifmindex2 = 0.5
>   imodfrq1    = icarfrq * imodratio1
>   kmodamp1    = imodfrq1 * ifmindex1*kindexhuellA
>   imodfrq2    = icarfrq * imodratio2
>   kmodamp2    = imodfrq2 * ifmindex2*kindexhuellB
>
>   kfrq_mod_1  oscil kmodamp1, imodfrq1, 1
>   kfrq_mod_2  oscil kmodamp2, imodfrq2, 1
> ;the amplitude envelope for the carrier
> klauthuell = kindexhuellB
> ;and now: all together!
> asig        oscil klauthuell*iamp    , icarfrq + kfrq_mod_1 +  
> kfrq_mod_2, 1
> outs asig, asig
> endin
>
> 
> ; ==============================================
> 
> f1  0  2048   10   1 ; a sinewave
> f 10  0 256 -23 "12tet.cps"
> f 0     15
> 
> 
>
> <12tet.cps>



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"

Date2010-03-23 22:13
FromStefan Thomas
Subject[Csnd] Re: Re: panorama, with midi
Dear Steven,
Yes, I would like to have a spatial location for every pitch.

2010/3/23 Steven Yi <stevenyi@gmail.com>
Hi Stefan,

What criteria are you trying to map?  Is it by pitch maps to a spatial
location?  Or are you saying just how to do panning in genearl? I'd
look at using pan2 (http://csounds.com/manual/html/pan2.html) to do
panning in stereo and either set the value once in the instrument or
can use a value passed in by pfield.

Hope that helps!
steven

On Tue, Mar 23, 2010 at 5:33 PM, Stefan Thomas
<kontrapunktstefan@googlemail.com> wrote:
> Dear community,
> I would like to create an instrument, where the panorama depends on the
> note, that is played.
> Could You give me a hint, how I could  do it with the below quoted code?
> <CsoundSynthesizer>
> ;Fm-Modulation with one carrier and two modulators:;
> ;my first trial!
> <CsOptions>
> -odevaudio -M1 -b400 -m0d
> </CsOptions>
> ; ==============================================
> <CsInstruments>
>
> sr    =    48000
> kr    =    2400
> ksmps    =    20
> nchnls    =    2
>  ipch = 8.02
>   iequal = 12
> instr 1
>  ituningtable = 10         ; the number of the f-table
>  inum    notnum
>  indx    =  inum * 2 + 1   ; values in table alternate between
>                            ; Midi note nums and frequencies
>  icps    table  indx, ituningtable
>   iamp    ampmidi        10000
> icarfrq = 2*icps
> imodratio1 = 1.25 ;the ratio to the carrier for modulator 1
> imodratio2 = 0.5    ;the ratio to the carrier for modulator 2
> ieinschwing = 0.1
> ;;;;;;; defining the envelopes
> kindexhuellA linsegr     0.1,         0.001,         1,   0.2,       0.001,
> 0.1, 0.1; a short noise
> kindexhuellB linsegr     0.1,         0.1,         1,    5,       0.001,
> 0.1, 0.1 ; much longer
> ifmindex1 = 0.5
> ifmindex2 = 0.5
>   imodfrq1    = icarfrq * imodratio1
>   kmodamp1    = imodfrq1 * ifmindex1*kindexhuellA
>   imodfrq2    = icarfrq * imodratio2
>   kmodamp2    = imodfrq2 * ifmindex2*kindexhuellB
>
>   kfrq_mod_1  oscil kmodamp1, imodfrq1, 1
>   kfrq_mod_2  oscil kmodamp2, imodfrq2, 1
> ;the amplitude envelope for the carrier
> klauthuell = kindexhuellB
> ;and now: all together!
> asig        oscil klauthuell*iamp    , icarfrq + kfrq_mod_1 + kfrq_mod_2, 1
> outs asig, asig
> endin
>
> </CsInstruments>
> ; ==============================================
> <CsScore>
> f1  0  2048   10   1 ; a sinewave
> f 10  0 256 -23 "12tet.cps"
> f 0     15
> </CsScore>
> </CsoundSynthesizer>
>
>


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"