# Array in p-field, return values and delay

**URL:** <https://forum.csound.com/t/array-in-p-field-return-values-and-delay/2099>\
**Category:** Newbies\
**Created:** [April 4, 2025, 9:42am UTC](https://forum.csound.com/t/array-in-p-field-return-values-and-delay/2099 "2025-04-04T09:42:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lez](https://forum.csound.com/letter_avatar_proxy/v4/letter/l/c0e974/32.png) [@Lez](https://forum.csound.com/u/Lez)\
**Post date:** [April 4, 2025, 9:42am UTC](https://forum.csound.com/t/array-in-p-field-return-values-and-delay/2099/1 "2025-04-04T09:42:23Z")

</div>

Hi there,

Here I am again with some things I can’t figure out. I have a three questions which are related in the project I’m working on. I try to make an instrument that ‘strums’ a chord, but I am encountering some problems that are not covered in the documentation.  
First I want to pass an array with chord-notes to an instrument and I want to do that in the score. But whatever I try it doesn’t seem possible to do so and I get error messages.  
The second question has to do with the instrument itself. In order to play an undefined number of notes I use a recursive function, but in order to get a strumming effect I need to use a delay in the invocation of the buzz opcode, either in a UDO or an instrument. In order to get that effect I have to use an instrument, because I can use the EVENT opcode, which has a start/delay option. The problem is that an instrument doesn’t return a value i/k/a so I cannot add the audio signals.  
Three: If I want to use a UDO instead I cannot delay it, because the start/delay of EVENT doesn’t work on UDO’s.  
So, the result sofar is that I’m stuck. I can solve it by calling an instrument in the score for every note in the chord and set the appropriate starttime, but that’s not very elegant and it soon becomes a ‘blur’ when a whole chord progression has to be played.

Can you please help me…  
Htnak you

---

<div class="post-metadata">

**Author:** ![rory](https://forum.csound.com/user_avatar/forum.csound.com/rory/32/7_2.png) [@rory](https://forum.csound.com/u/rory)\
**Post date:** [April 4, 2025, 10:40am UTC](https://forum.csound.com/t/array-in-p-field-return-values-and-delay/2099/2 "2025-04-04T10:40:36Z")

</div>

Personally I wouldn’t be doing anything from the score these days.

```csound

giSine ftgen 0, 0, 4096, 10, 1

instr 1
    kChord[] fillarray 60, 65, 67, 71
    kPositions[] fillarray 0, 5, 7, 12
    if metro(1) == 1 then
        kPos = random:k(0, 3)
        event "i", 2, 0, 4, kChord[0]+kPositions[int(kPos)]
        event "i", 2, 0.1, 4, kChord[1]+kPositions[int(kPos)]
        event "i", 2, 0.2, 4, kChord[2]+kPositions[int(kPos)]
        event "i", 2, 0.3, 4, kChord[3]+kPositions[int(kPos)]
    endif
endin

instr 2
    a1 pluck .2, cpsmidinn(p4), cpsmidinn(p4), giSine, 1
    out a1, a1
endin

schedule(1, 0, 3600)

```

---

<div class="post-metadata">

**Author:** ![Lez](https://forum.csound.com/letter_avatar_proxy/v4/letter/l/c0e974/32.png) [@Lez](https://forum.csound.com/u/Lez)\
**Post date:** [April 10, 2025, 10:13am UTC](https://forum.csound.com/t/array-in-p-field-return-values-and-delay/2099/3 "2025-04-10T10:13:08Z")

</div>

Thank you Rory,

maybe these are obvious stupid questions, but I’m working on a piece which is combination/hybrid of traditional note/chord patterns, sometimes based on classical counterpoint and on the other side completely abstract soundscapes. I am trying to create everything in Csound, because during playback I will also modify the instruments used for the ‘traditional’ part. So at this stage I am writing some parts in Csound and for the less regular uses of Csound I am examining what is possible and for those problems I have to find less elegant solutions. By the answer you gave me I have to conclude that the answer to all three questions is NO. That helps me a lot. Now I am thinking that what I want to do can be done using the score, but I will have to code a Swift program to write a score for me that I can import in Csound.That way I can work with a database and during playback have all the countless possibilities that Csound has to offer. In the definitions of the instruments I can incorporate all randoms etc. to humanize the music.

So, thank you again
