Using high instr numbers
Date | 2016-01-06 14:22 |
From | Peter Burgess |
Subject | Using high instr numbers |
Hi there, as I understand it, csound allocates resources for each instrument when it compiles an orchestra. if I were to use only two instruments, but they were called instr 1 and instr 9999999, would it allocate enough resources for 2 instruments, or 9999999 instruments? I'm sure it probably only allocates for 2, but I thought it worth asking just to be sure. Pete 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 |
Date | 2016-01-06 14:56 |
From | Rory Walsh |
Subject | Re: Using high instr numbers |
If you only have two instruments Csound will only allocate and instantiate two instruments. It can't instantiate what isn't defined. Careful with your instrument numbers however. I think I ran into a problem some time ago with an instrument number that was too large. I think John fixes the issue then however. But instr 9 million seems like an ambitious kind of scenario! On 6 January 2016 at 14:22, Peter Burgess <pete.soundtechnician@gmail.com> wrote: Hi there, as I understand it, csound allocates resources for each |
Date | 2016-01-06 15:19 |
From | Peter Burgess |
Subject | Re: Using high instr numbers |
Lol, yeah, that was an exagoration. It's either going to be up to 12,000 or 120,000. What was the number that caused the issue, and what version of csound was that? On Wed, Jan 6, 2016 at 2:56 PM, Rory Walsh |
Date | 2016-01-06 15:25 |
From | Steven Yi |
Subject | Re: Using high instr numbers |
I think there is an array used to lookup the instrument definition, but I don't know if it dynamically allocated. (Not on a computer to check the code at the moment.) On Wed, Jan 6, 2016, 10:20 AM Peter Burgess <pete.soundtechnician@gmail.com> wrote: Lol, yeah, that was an exagoration. It's either going to be up to |
Date | 2016-01-06 15:30 |
From | jpff |
Subject | Re: Using high instr numbers |
There is a cost. A vector of pointers is alloated as long as the highest instr number used, and it is expandable. So yes onlyto instruments but 9999997 empty slots ==John ff On Wed, 6 Jan 2016, Peter Burgess wrote: > Lol, yeah, that was an exagoration. It's either going to be up to > 12,000 or 120,000. What was the number that caused the issue, and what > version of csound was that? > > On Wed, Jan 6, 2016 at 2:56 PM, Rory Walsh |
Date | 2016-01-06 15:32 |
From | Victor Lazzarini |
Subject | Re: Using high instr numbers |
It gets extended if a high number is needed. Victor Lazzarini Dean of Arts, Celtic Studies, and Philosophy Maynooth University Ireland
|
Date | 2016-01-06 15:38 |
From | Rory Walsh |
Subject | Re: Using high instr numbers |
Does this mean that when Csound is processing each instrument in turn, it is continuously checking empty instruments slots in that vector you mention? Can I ask why the vector isn't the same size as the number of instruments defined? Probably some low level C answer to this one.. On 6 January 2016 at 15:30, jpff <jpff@codemist.co.uk> wrote: There is a cost. A vector of pointers is alloated as long as the highest instr number used, and it is expandable. So yes onlyto instruments but 9999997 empty slots |
Date | 2016-01-06 15:39 |
From | Rory Walsh |
Subject | Re: Using high instr numbers |
[edit] MIGHT be checking empty instrument slots, depending on how you number your instruments... On 6 January 2016 at 15:38, Rory Walsh <rorywalsh@ear.ie> wrote:
|
Date | 2016-01-06 15:44 |
From | Peter Burgess |
Subject | Re: Using high instr numbers |
Ok, well based on that I've had a rethink, and I'm going to create my long lists of instrs in c++, and send whatever instrs I'm using at the time to csound as instr 1, instr 2, instr 3, etc. That should avoid the costs, and probably makes more sense to my app in the long run :D On Wed, Jan 6, 2016 at 3:39 PM, Rory Walsh |
Date | 2016-01-06 15:50 |
From | Victor Lazzarini |
Subject | Re: Using high instr numbers |
No, it goes from one instance to another. One thing is the instr list, the other the active instances. Victor Lazzarini Dean of Arts, Celtic Studies, and Philosophy Maynooth University Ireland
|
Date | 2016-01-06 15:59 |
From | Rory Walsh |
Subject | Re: Using high instr numbers |
That makes sense. I better be careful or I'm eventually going to understand how Csound works! On 6 January 2016 at 15:50, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
|
Date | 2016-01-06 16:03 |
From | Victor Lazzarini |
Subject | Re: Using high instr numbers |
Steven must still have some slides from his talk at Berklee. Don't go anywhere them. Victor Lazzarini Dean of Arts, Celtic Studies, and Philosophy Maynooth University Ireland
|
Date | 2016-01-06 17:00 |
From | Peter Burgess |
Subject | Re: Using high instr numbers |
Ok, so what I'm gathering you're saying is that the performance cost would only happen once at either the beginning of the performance or during compilation, but it won't happen every time it plays an instrument, is that right? On Wed, Jan 6, 2016 at 4:03 PM, Victor Lazzarini |
Date | 2016-01-06 17:18 |
From | Victor Lazzarini |
Subject | Re: Using high instr numbers |
I think the cost is mostly memory, rather than performance. 99799 x 8 bytes of extra memory use. Victor Lazzarini Dean of Arts, Celtic Studies, and Philosophy Maynooth University Ireland > On 6 Jan 2016, at 17:00, Peter Burgess |
Date | 2016-01-06 17:30 |
From | Rory Walsh |
Subject | Re: Using high instr numbers |
That's not a whole lot, but more memory than came with the IBM PS/2 back in 1986? I guess Csounders only counted till 64 back then ;) On 6 January 2016 at 17:18, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote: I think the cost is mostly memory, rather than performance. 99799 x 8 bytes of extra memory use. |
Date | 2016-01-06 17:40 |
From | Victor Lazzarini |
Subject | Re: Using high instr numbers |
No Csound for DOS or OS/2 in 86, I am afraid. Victor Lazzarini Dean of Arts, Celtic Studies, and Philosophy Maynooth University Ireland
|
Date | 2016-01-06 17:51 |
From | Rory Walsh |
Subject | Re: Using high instr numbers |
Ah, I was making the assumption that it was running on that machine. Wasn't it one of the more popular systems back then? Keep in mind I wasn't long out of nappies then, so what do I know? On 6 January 2016 at 17:40, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
|
Date | 2016-01-06 17:59 |
From | Victor Lazzarini |
Subject | Re: Using high instr numbers |
It might have been, but Csound was strictly UNIX until someone on this list ported it to DOS on a rainy Saturday. It was also ported to the Mac at MIT in the early 90s. Victor Lazzarini Dean of Arts, Celtic Studies, and Philosophy Maynooth University Ireland
|
Date | 2016-01-06 18:16 |
From | Peter Burgess |
Subject | Re: Using high instr numbers |
Lol. Well, I can live with the extra memory. My app still has a pretty small memory footprint, far smaller than I guessed it would. Though I reckon dynamic orchestra construction is probably a good bet anyway. On Wed, Jan 6, 2016 at 5:59 PM, Victor Lazzarini |
Date | 2016-01-07 02:32 |
From | Steven Yi |
Subject | Re: Using high instr numbers |
The sentence is ambiguous: I want to believe it was meant to be "Don't go anywhere without them" but I fear you meant "Don't go anywhere near them". :P The slides are available at: http://www.kunstmusik.com/howCsoundWorksPresentation/index.html To elaborate on Victor's and John's answers, the instrument definitions are organized in two ways. First is the array: each instrument definition is stored by their instrument number as the index into the array. This makes lookup very fast when an i-event is processed. (For named instruments, instrument names are mapped to an instrument number, then the number used to index into the array.) For performance, the instrument definitions (INSTRTXT) also have pointers to the next instrument definition (i.e. they're singly-linked lists). This organization is used at perf-time to iterate through all instrument definitions in a loop. For each instrument definition, the performance code checks and performs any active instance of the instrument. So even if there's an instrument 999999, if there's only three real instrument definitions, the perf-code will only loop through three times to run instances of instruments. So using large numbers for instrument definitions only affects that array size for lookup, but has no performance cost for processing at perf-time. Performance then is only affected by actual number of instrument definitions. If you're concerned about performance, you may need to watch how many instrument definitions you have (and that includes UDOs, which are instrument definitions under the hood). I would suspect that for most people though that any kind of performance penalty is a non-issue. On Wed, Jan 6, 2016 at 11:03 AM, Victor Lazzarini |
Date | 2016-01-07 04:03 |
From | thorin kerr |
Subject | Re: Using high instr numbers |
Slightly straying from topic - sorry.
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
Steven... when you say "The instrument definitions (INSTRTXT) also have pointers to the next instrument definition (i.e. they're singly-linked lists)" Does the iteration through the list lead to the situation where you need increasing numbered instruments to sequentially process audio stored in global variables? That was a long sentence. I'm referring to situations like the one referred to here: If so, how hard would it be to change the pointers if you wanted to dynamically re-route audio? Thorin On Thu, Jan 7, 2016 at 12:32 PM, Steven Yi <stevenyi@gmail.com> wrote: The sentence is ambiguous: I want to believe it was meant to be "Don't |
Date | 2016-01-07 05:58 |
From | Steven Yi |
Subject | Re: Using high instr numbers |
I haven't researched all the areas where the pointers are used, but I'm not much in favor of dynamically changing instrument order myself. If dynamic ordering is desired, I think the new processing graph proposal (emailed to the list earlier) would be a better fit as it works with instances of instruments rather than their definitions and has a lot more flexibility. Changing the ordering of instruments by numbers in the "classic" processing (or lack of a better term) -- to me -- invites confusion (i.e. what happens if instruments are reordered and a new instrument definition is compiled? Where would it get inserted?) I think the classic system may have some limitations, but it's well-known and simple to reason about. The new processing graph would give the user both the flexibility to order instances of instruments as they wish as well as the responsibility to manage it themselves. It's a well known model from SuperCollider and I think would be very useful for realtime work as well as assembling processing graphs for mixers/effects system. The last I had a chance to think about this, the idea I had was to have pre and post-processing graphs that were run before and after the classic graph. The idea is that: - pre-graph - used to generate always-on control signals. For example, oscillators used as LFO's that are read instrument wide (phase is continuously updated then, similar to analog synths) - classic graph - used as usual, but primarily for polyphonic instantiation of instruments to act as source signals into a bus. - post-graph - processes signals from the bus, to be used for mixer/effects processing. All dynamically re-patchable. In the above, users can use just the graphs they'd like, or all three of them. They could use just the pre or post graph and none of the others and essentially get the same processing possibilities as SC3. Or they could use a mix to clarify what acts like synthesizers and what acts like a mixer. Anyways, it's all speculation. I'm very interested to start looking at implementing and experimenting with the new graph to see what it feels like to use and if it will indeed work out as imagined. I was planning to take a stab at it in a couple weeks once I'm finished with some other work (unless someone else gets to it first :) ). On Wed, Jan 6, 2016 at 11:03 PM, thorin kerr |
Date | 2016-01-07 08:11 |
From | Rory Walsh |
Subject | Re: Using high instr numbers |
Thanks for posting these. I think before I figure out how Csound works, I'll have to figure the magic order to the slides in your presentation! Up, Left, Left, Down, Right.... I know sooner or later I'll unlock the next level! On 7 January 2016 at 02:32, Steven Yi <stevenyi@gmail.com> wrote: The sentence is ambiguous: I want to believe it was meant to be "Don't |
Date | 2016-01-07 10:58 |
From | Peter Burgess |
Subject | Re: Using high instr numbers |
Cheers for all the info! That has helped immensely. "If you're concerned about performance, you may need to watch how many instrument definitions you have (and that includes UDOs, which are instrument definitions under the hood). I would suspect that for most people though that any kind of performance penalty is a non-issue." I would think then that dynamically sending instruments if they're needed for the performance in question is the right way to go. I need to squeeze every ounce of performance out of csound for my purposes, so this is definately an area I need to address. Thank you all for your help! On Thu, Jan 7, 2016 at 8:11 AM, Rory Walsh |