Csound Csound-dev Csound-tekno Search About

[Csnd] Sending f-rate signals to other instruments

Date2019-12-07 21:41
FromBernard Geyer
Subject[Csnd] Sending f-rate signals to other instruments
Hi,

I'm trying to make a flexible harmonizer, and for this, I want to analyse a
sound in one instrument, and make a resynthesis in other instruments
controlled by midi keys, eventually with adding other effects. 

The algorithm I use works very well inside a single instrument, even with
multiple transpositions, but because I don't know how much instances of the
resynthesis  I need, I have to find a way to send the analysis signal to
other instruments.

I tried to do it with outletf and inletf, but csound crash when I add
pvsynth in a receiving instrument.

Here is a simple example: (I use diskin here for easy testing, but it works
also with inch)

connect "source", "source_outlet", "dest", "dest_inlet"
alwayson "dest"

giFFTsize = 512
giHopsize = giFFTsize / 16
giWindow  = 1

instr source
  asigIn diskin p4, 1, 0, 1 ;soundfile given in p4

  asigIn tone asigIn, 4000 ;lowpass-filter
  gkInCps, gkInRms pitchamdf asigIn, 100, 500, 200 ;pitch tracking

  fSig pvsanal asigIn, giFFTsize, giHopsize, giFFTsize, giWindow
  
  /* ;this part works from here:
  kKey = 60
  fTransp pvscale fSig, cpsmidinn(kKey) / gkInCps, 1
  aSig pvsynth fTransp
  outs aSig, aSig
  */
  
  outletf "source_outlet", fSig
endin

instr dest
  fSig inletf "dest_inlet"
  
  kKey = 60 ;will be a parameter
  fTransp pvscale fSig, cpsmidinn(kKey) / gkInCps, 1
  aSig pvsynth fTransp ; <- crash when adding this line
  outs aSig, aSig
endin

Any ideas ?

Best,
Bernard




--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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

Date2019-12-07 21:44
Fromjohn
SubjectRe: [Csnd] Sending f-rate signals to other instruments
Do global variables do what you want?

On Sat, 7 Dec 2019, Bernard Geyer wrote:

> Hi,
>
> I'm trying to make a flexible harmonizer, and for this, I want to analyse a
> sound in one instrument, and make a resynthesis in other instruments
> controlled by midi keys, eventually with adding other effects.
>
> The algorithm I use works very well inside a single instrument, even with
> multiple transpositions, but because I don't know how much instances of the
> resynthesis  I need, I have to find a way to send the analysis signal to
> other instruments.
>
> I tried to do it with outletf and inletf, but csound crash when I add
> pvsynth in a receiving instrument.
>
> Here is a simple example: (I use diskin here for easy testing, but it works
> also with inch)
>
> connect "source", "source_outlet", "dest", "dest_inlet"
> alwayson "dest"
>
> giFFTsize = 512
> giHopsize = giFFTsize / 16
> giWindow  = 1
>
> instr source
>  asigIn diskin p4, 1, 0, 1 ;soundfile given in p4
>
>  asigIn tone asigIn, 4000 ;lowpass-filter
>  gkInCps, gkInRms pitchamdf asigIn, 100, 500, 200 ;pitch tracking
>
>  fSig pvsanal asigIn, giFFTsize, giHopsize, giFFTsize, giWindow
>
>  /* ;this part works from here:
>  kKey = 60
>  fTransp pvscale fSig, cpsmidinn(kKey) / gkInCps, 1
>  aSig pvsynth fTransp
>  outs aSig, aSig
>  */
>
>  outletf "source_outlet", fSig
> endin
>
> instr dest
>  fSig inletf "dest_inlet"
>
>  kKey = 60 ;will be a parameter
>  fTransp pvscale fSig, cpsmidinn(kKey) / gkInCps, 1
>  aSig pvsynth fTransp ; <- crash when adding this line
>  outs aSig, aSig
> endin
>
> Any ideas ?
>
> Best,
> Bernard
>
>
>
>
> --
> Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html
>
> 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

Date2019-12-07 22:18
FromBernard Geyer
SubjectRe: [Csnd] Sending f-rate signals to other instruments
Yes, it works ! Thank you very much !
I didn't know that we can have global f-variables.
Great!




--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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

Date2019-12-08 09:47
Fromjoachim heintz
SubjectRe: [Csnd] Sending f-rate signals to other instruments
yes it is here: https://csound.com/docs/manual/OrchKvar.html

what is not good on this manual page is that arrays are not described 
properly; but global f-sigs are there.



On 07/12/2019 23:18, Bernard Geyer wrote:
> Yes, it works ! Thank you very much !
> I didn't know that we can have global f-variables.
> Great!
> 
> 
> 
> 
> --
> Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html
> 
> 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

Date2019-12-09 12:49
FromBernard Geyer
SubjectRe: [Csnd] Sending f-rate signals to other instruments
Initialisation is missing too, but I found it:pvsinit
(necessary when the receiving instr is declared before the other, f.e. midi
instr 1,2,3..)





--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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