Csound Csound-dev Csound-tekno Search About

several instances of instruments and global recording

Date2016-11-26 14:31
Fromlorangeverte
Subjectseveral instances of instruments and global recording
Hello,

a little novice user in Csound, first apologies for my bad written
expression in english.

However, I’ll try to explain my problem.
 
Actually (within Max just like an interface) I’m playing Csound on a
polyphonical way with numerous instances of different instruments.

Per exemple,
. 2 instances of instrument i1 are selected  
. 3 instances of iinstrument 2 are selected
. Then 1.01, 1.02, 1.03 and 2.01, 2.02, 2.03 can be played simultaneously.

Each of those instances and instruments depended to two unique audio
channel.
 - just for exemple, even if it’s not ma syntax : outch 1, « aL », 2, « aR »

I determined different names of audio channels for each instance, with
sprintf, then any audio variable have the same name but each have the same
channel (1 and 2)

I can record separately each instance which is playing with fout within the
instrument.

A. But it causes to me some problems:

1. as soon as the instrument (1 or 10 instances, it does not matter) is
playing, fout creates automatically on my disk a virgin audio files, and
that even if I don’t start the recording 
(for this action, I make something like that : 
if (kern == 1)
 then fout Sreci1, 18, aL, aR)

2. it’s all the more so problematic because I’m playing with a lot of
turnoff… Sometimes, I can determine that after 4 seconds 1.01 turnoff, but
1.01 can playing again after 4 other seconds and during 10 seconds… so the
fout stop after the first turnoff…

B. So, I have try to make a global recording instrument with fout, using the
same method of severals formatting of audio channel names with the sprintf
opcodes, and using in this case global audio variables… Each instrument is
linked to his own fout on a separate and global instrument (in this global
recording instrument, there are as many fout as instruments)

I think this is the solution that I need, but:

1. It seems that it dosent works when I try to record severals instances of
instruments simultaneously 
2. If 3 instances of an instrument are playing, fout records only the last
instance… 
So, if 1.01, 1.02 and 1.03 are playing, fout records only 1.03….


Would you have some ideas or advices to adjust my problem?

Many thanks,

Lorangeverte.







--
View this message in context: http://csound.1045644.n5.nabble.com/several-instances-of-instruments-and-global-recording-tp5752772.html
Sent from the Csound - General mailing list archive at Nabble.com.

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-11-26 15:42
FromVictor Lazzarini
SubjectRe: several instances of instruments and global recording
Try doing something like this:

 

-W 



sr = 44100
ksmps = 64
nchnls = 2
0dbfs = 1.0

chn_a "mixL",3
chn_a "mixR",3

instr 1
 a1 oscili p4,p5
 chnmix a1, "mixL"
 chnmix a1, "mixR"
endin

instr 2
 a1 vco2 p4,p5
 chnmix a1, "mixL"
 chnmix a1, "mixR"
endin

instr 100
 aL chnget "mixL"
 aR chnget "mixR"
 fout "mymix.wav",2,aL,aR
  out aL,aR
 chnclear "mixL"
 chnclear "mixR"
endin



i1 0 1 0.25 440
i1 2 1 0.25 500
i2 0.9 1 0.5 340
i2 3.1 1 0.5 600
i100 0 10





========================
Prof. 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 26 Nov 2016, at 14:31, lorangeverte  wrote:
> 
> Hello,
> 
> a little novice user in Csound, first apologies for my bad written
> expression in english.
> 
> However, I’ll try to explain my problem.
> 
> Actually (within Max just like an interface) I’m playing Csound on a
> polyphonical way with numerous instances of different instruments.
> 
> Per exemple,
> . 2 instances of instrument i1 are selected  
> . 3 instances of iinstrument 2 are selected
> . Then 1.01, 1.02, 1.03 and 2.01, 2.02, 2.03 can be played simultaneously.
> 
> Each of those instances and instruments depended to two unique audio
> channel.
> - just for exemple, even if it’s not ma syntax : outch 1, « aL », 2, « aR »
> 
> I determined different names of audio channels for each instance, with
> sprintf, then any audio variable have the same name but each have the same
> channel (1 and 2)
> 
> I can record separately each instance which is playing with fout within the
> instrument.
> 
> A. But it causes to me some problems:
> 
> 1. as soon as the instrument (1 or 10 instances, it does not matter) is
> playing, fout creates automatically on my disk a virgin audio files, and
> that even if I don’t start the recording 
> (for this action, I make something like that : 
> if (kern == 1)
> then fout Sreci1, 18, aL, aR)
> 
> 2. it’s all the more so problematic because I’m playing with a lot of
> turnoff… Sometimes, I can determine that after 4 seconds 1.01 turnoff, but
> 1.01 can playing again after 4 other seconds and during 10 seconds… so the
> fout stop after the first turnoff…
> 
> B. So, I have try to make a global recording instrument with fout, using the
> same method of severals formatting of audio channel names with the sprintf
> opcodes, and using in this case global audio variables… Each instrument is
> linked to his own fout on a separate and global instrument (in this global
> recording instrument, there are as many fout as instruments)
> 
> I think this is the solution that I need, but:
> 
> 1. It seems that it dosent works when I try to record severals instances of
> instruments simultaneously 
> 2. If 3 instances of an instrument are playing, fout records only the last
> instance… 
> So, if 1.01, 1.02 and 1.03 are playing, fout records only 1.03….
> 
> 
> Would you have some ideas or advices to adjust my problem?
> 
> Many thanks,
> 
> Lorangeverte.
> 
> 
> 
> 
> 
> 
> 
> --
> View this message in context: http://csound.1045644.n5.nabble.com/several-instances-of-instruments-and-global-recording-tp5752772.html
> Sent from the Csound - General mailing list archive at Nabble.com.
> 
> 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-11-26 16:55
Fromjoachim heintz
SubjectRe: several instances of instruments and global recording
another solution would be to have this instrument at the end of your 
orchestra:

instr Monitor
  aL, aR monitor
  fout "mysum.wav", 18, aL, aR
endin

then you can use out(ch) in any instrument as you did.

	joachim


On 26/11/16 16:42, Victor Lazzarini wrote:
> Try doing something like this:
>
>  
> 
> -W
> 
> 
>
> sr = 44100
> ksmps = 64
> nchnls = 2
> 0dbfs = 1.0
>
> chn_a "mixL",3
> chn_a "mixR",3
>
> instr 1
>  a1 oscili p4,p5
>  chnmix a1, "mixL"
>  chnmix a1, "mixR"
> endin
>
> instr 2
>  a1 vco2 p4,p5
>  chnmix a1, "mixL"
>  chnmix a1, "mixR"
> endin
>
> instr 100
>  aL chnget "mixL"
>  aR chnget "mixR"
>  fout "mymix.wav",2,aL,aR
>   out aL,aR
>  chnclear "mixL"
>  chnclear "mixR"
> endin
>
> 
> 
> i1 0 1 0.25 440
> i1 2 1 0.25 500
> i2 0.9 1 0.5 340
> i2 3.1 1 0.5 600
> i100 0 10
> 
> 
>
>
>
> ========================
> Prof. 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 26 Nov 2016, at 14:31, lorangeverte  wrote:
>>
>> Hello,
>>
>> a little novice user in Csound, first apologies for my bad written
>> expression in english.
>>
>> However, I’ll try to explain my problem.
>>
>> Actually (within Max just like an interface) I’m playing Csound on a
>> polyphonical way with numerous instances of different instruments.
>>
>> Per exemple,
>> . 2 instances of instrument i1 are selected
>> . 3 instances of iinstrument 2 are selected
>> . Then 1.01, 1.02, 1.03 and 2.01, 2.02, 2.03 can be played simultaneously.
>>
>> Each of those instances and instruments depended to two unique audio
>> channel.
>> - just for exemple, even if it’s not ma syntax : outch 1, « aL », 2, « aR »
>>
>> I determined different names of audio channels for each instance, with
>> sprintf, then any audio variable have the same name but each have the same
>> channel (1 and 2)
>>
>> I can record separately each instance which is playing with fout within the
>> instrument.
>>
>> A. But it causes to me some problems:
>>
>> 1. as soon as the instrument (1 or 10 instances, it does not matter) is
>> playing, fout creates automatically on my disk a virgin audio files, and
>> that even if I don’t start the recording
>> (for this action, I make something like that :
>> if (kern == 1)
>> then fout Sreci1, 18, aL, aR)
>>
>> 2. it’s all the more so problematic because I’m playing with a lot of
>> turnoff… Sometimes, I can determine that after 4 seconds 1.01 turnoff, but
>> 1.01 can playing again after 4 other seconds and during 10 seconds… so the
>> fout stop after the first turnoff…
>>
>> B. So, I have try to make a global recording instrument with fout, using the
>> same method of severals formatting of audio channel names with the sprintf
>> opcodes, and using in this case global audio variables… Each instrument is
>> linked to his own fout on a separate and global instrument (in this global
>> recording instrument, there are as many fout as instruments)
>>
>> I think this is the solution that I need, but:
>>
>> 1. It seems that it dosent works when I try to record severals instances of
>> instruments simultaneously
>> 2. If 3 instances of an instrument are playing, fout records only the last
>> instance…
>> So, if 1.01, 1.02 and 1.03 are playing, fout records only 1.03….
>>
>>
>> Would you have some ideas or advices to adjust my problem?
>>
>> Many thanks,
>>
>> Lorangeverte.
>>
>>
>>
>>
>>
>>
>>
>> --
>> View this message in context: http://csound.1045644.n5.nabble.com/several-instances-of-instruments-and-global-recording-tp5752772.html
>> Sent from the Csound - General mailing list archive at Nabble.com.
>>
>> 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-11-27 11:07
Fromlorangeverte
SubjectRe: several instances of instruments and global recording
Hello,

thank you for you responses. However, my problem remains.

Of course, it's possible to record different instruments with fout and write
the record on an audio file (sum of all audio events for one audio file),
but I would like to record each voice (instances of instruments) on
different and separated stereo audio files, knowing that all of my
instruments have the same audio channels...

I'm trying to do that with something like that:

(in fact, I control parameters of several instances of instrument using
sprintf and the p1 character, then if p1 = 1.01 I'll control the first
instance, if = 1.02 the second, and I attribute different names of audio
channels with the same method)

1. with fout inside the instrument

instr 1

achani1 oscili p4, p5 , p6
outch 1, achani1, 2, achani1

SCaudio1 sprintf "achani1%.2f", p1
chnset achani1, SCaudio1

krec chnget "rec"
if (krec == 1) then
fout "myAudioFiles.wav", 18, achani1, achani1
endif

endin

This method is not complety ok (but fout creates as many separated audio
files as instances have been played, that I want) and:

. Fout creates automatically a virgin audio file for each instrument which
has been played.
. If I turnoff and instrument and play it again fout erase the first audio
file and create a new.

---

So I tried to make a global instrument following exactly the same method

instr 1

gachani1 oscili p4, p5 , p6
outch 1, gachani1, 2, gachani1
SCaudio1 sprintf "gachani1%.2f", p1
chnset gachani1, SCaudio1

gkrec chnget "rec"
endin

instr 100

if (gkrec == 1) then
fout "myAudioFiles.wav", 18, gachani1, gachani1
endin

. No problem but fout just records the last instance... (so if 1.01 and 1.02
are playing, fout record just 1.02 and creates just one audio file...)

Have you other ideas or advices, please?

Regards



--
View this message in context: http://csound.1045644.n5.nabble.com/several-instances-of-instruments-and-global-recording-tp5752772p5752782.html
Sent from the Csound - General mailing list archive at Nabble.com.

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-11-27 12:35
FromVictor Lazzarini
SubjectRe: several instances of instruments and global recording
you should use chnmix instead of chnset (and then chnclear after fout used the
signals).

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

> On 27 Nov 2016, at 11:07, lorangeverte  wrote:
> 
> Hello,
> 
> thank you for you responses. However, my problem remains.
> 
> Of course, it's possible to record different instruments with fout and write
> the record on an audio file (sum of all audio events for one audio file),
> but I would like to record each voice (instances of instruments) on
> different and separated stereo audio files, knowing that all of my
> instruments have the same audio channels...
> 
> I'm trying to do that with something like that:
> 
> (in fact, I control parameters of several instances of instrument using
> sprintf and the p1 character, then if p1 = 1.01 I'll control the first
> instance, if = 1.02 the second, and I attribute different names of audio
> channels with the same method)
> 
> 1. with fout inside the instrument
> 
> instr 1
> 
> achani1 oscili p4, p5 , p6
> outch 1, achani1, 2, achani1
> 
> SCaudio1 sprintf "achani1%.2f", p1
> chnset achani1, SCaudio1
> 
> krec chnget "rec"
> if (krec == 1) then
> fout "myAudioFiles.wav", 18, achani1, achani1
> endif
> 
> endin
> 
> This method is not complety ok (but fout creates as many separated audio
> files as instances have been played, that I want) and:
> 
> . Fout creates automatically a virgin audio file for each instrument which
> has been played.
> . If I turnoff and instrument and play it again fout erase the first audio
> file and create a new.
> 
> ---
> 
> So I tried to make a global instrument following exactly the same method
> 
> instr 1
> 
> gachani1 oscili p4, p5 , p6
> outch 1, gachani1, 2, gachani1
> SCaudio1 sprintf "gachani1%.2f", p1
> chnset gachani1, SCaudio1
> 
> gkrec chnget "rec"
> endin
> 
> instr 100
> 
> if (gkrec == 1) then
> fout "myAudioFiles.wav", 18, gachani1, gachani1
> endin
> 
> . No problem but fout just records the last instance... (so if 1.01 and 1.02
> are playing, fout record just 1.02 and creates just one audio file...)
> 
> Have you other ideas or advices, please?
> 
> Regards
> 
> 
> 
> --
> View this message in context: http://csound.1045644.n5.nabble.com/several-instances-of-instruments-and-global-recording-tp5752772p5752782.html
> Sent from the Csound - General mailing list archive at Nabble.com.
> 
> 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-11-27 15:59
Fromjoachim heintz
SubjectRe: several instances of instruments and global recording
it makes sense that the global audio signal does not work in your case, 
because the latest instance overwrites what the previous one has written.

in addition to what victor explained about chnmix, you could also use 
one instrument which records a multi channel file, all pairwise for your 
instances.  this would require that you know in advance how many 
instances you have in total; not sure if this is your case.

	joachim


On 27/11/16 12:07, lorangeverte wrote:
> Hello,
>
> thank you for you responses. However, my problem remains.
>
> Of course, it's possible to record different instruments with fout and write
> the record on an audio file (sum of all audio events for one audio file),
> but I would like to record each voice (instances of instruments) on
> different and separated stereo audio files, knowing that all of my
> instruments have the same audio channels...
>
> I'm trying to do that with something like that:
>
> (in fact, I control parameters of several instances of instrument using
> sprintf and the p1 character, then if p1 = 1.01 I'll control the first
> instance, if = 1.02 the second, and I attribute different names of audio
> channels with the same method)
>
> 1. with fout inside the instrument
>
> instr 1
>
> achani1 oscili p4, p5 , p6
> outch 1, achani1, 2, achani1
>
> SCaudio1 sprintf "achani1%.2f", p1
> chnset achani1, SCaudio1
>
> krec chnget "rec"
> if (krec == 1) then
> fout "myAudioFiles.wav", 18, achani1, achani1
> endif
>
> endin
>
> This method is not complety ok (but fout creates as many separated audio
> files as instances have been played, that I want) and:
>
> . Fout creates automatically a virgin audio file for each instrument which
> has been played.
> . If I turnoff and instrument and play it again fout erase the first audio
> file and create a new.
>
> ---
>
> So I tried to make a global instrument following exactly the same method
>
> instr 1
>
> gachani1 oscili p4, p5 , p6
> outch 1, gachani1, 2, gachani1
> SCaudio1 sprintf "gachani1%.2f", p1
> chnset gachani1, SCaudio1
>
> gkrec chnget "rec"
> endin
>
> instr 100
>
> if (gkrec == 1) then
> fout "myAudioFiles.wav", 18, gachani1, gachani1
> endin
>
> . No problem but fout just records the last instance... (so if 1.01 and 1.02
> are playing, fout record just 1.02 and creates just one audio file...)
>
> Have you other ideas or advices, please?
>
> Regards
>
>
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/several-instances-of-instruments-and-global-recording-tp5752772p5752782.html
> Sent from the Csound - General mailing list archive at Nabble.com.
>
> 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-12-19 15:56
Fromlorangeverte
SubjectRe: several instances of instruments and global recording
Hello Victor and hello Joachim,

thank you very much for your responses (and excuse me for my late
answer...).

Regarding to my problem (the solution is not perfect), I've finally chosen a
mix between the use of chnmix and a strict declaration of the number of
channels for the fout opcode (this number is equal to the number of
instrument instances which are arbitrarily determined).

It's not completely that I want... even if it's works well! 
So another little question... Do you know a way to create "dynamically" -
this point is depending to the number of instances which are playing, the
several channels of the fout opcode?

Thank's again,

Regards,

Lorangeverte.



--
View this message in context: http://csound.1045644.n5.nabble.com/several-instances-of-instruments-and-global-recording-tp5752772p5753498.html
Sent from the Csound - General mailing list archive at Nabble.com.

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