# The midiarp thing

**URL:** <https://forum.csound.com/t/the-midiarp-thing/329>\
**Category:** Developers\
**Created:** [May 11, 2021, 10:17am UTC](https://forum.csound.com/t/the-midiarp-thing/329 "2021-05-11T10:17:19Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![tjingboem](https://forum.csound.com/user_avatar/forum.csound.com/tjingboem/32/44_2.png) [@tjingboem](https://forum.csound.com/u/tjingboem)\
**Post date:** [May 11, 2021, 10:17am UTC](https://forum.csound.com/t/the-midiarp-thing/329/1 "2021-05-11T10:17:19Z")

</div>

Hi Rory,  
i think something is not right with midiarp.  
I tried the different settings for kMode, and  
kNote, kTrigger midiarp kTempo, 1  
was very problematic.  
Can you check please?

---

<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:** [May 11, 2021, 10:35am UTC](https://forum.csound.com/t/the-midiarp-thing/329/2 "2021-05-11T10:35:43Z")

</div>

I will. Are you just testing with the sample .csd file?

---

<div class="post-metadata">

**Author:** ![tjingboem](https://forum.csound.com/user_avatar/forum.csound.com/tjingboem/32/44_2.png) [@tjingboem](https://forum.csound.com/u/tjingboem)\
**Post date:** [May 11, 2021, 10:41am UTC](https://forum.csound.com/t/the-midiarp-thing/329/3 "2021-05-11T10:41:39Z")

</div>

yes- but you have to add kMode.  
And can you also test if kMode is really k rate?

---

<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:** [May 12, 2021, 8:56am UTC](https://forum.csound.com/t/the-midiarp-thing/329/4 "2021-05-12T08:56:07Z")

</div>

> [@tjingboem](#):
>
> yes- but you have to add kMode.

I wish I had read this before spending the last 20 minutes wondering why the hell `kMode` wasn’t doing anything 🤣

I don’t noticed any problems wehn kMode is 1. Here is the output from a C chord, with staggered entry of each note (which explains what’s happening at the start):

```
instr 300: p5 = 48.000
instr 300: p5 = 48.000
instr 300: p5 = 52.000
instr 300: p5 = 48.000
instr 300: p5 = 57.000
instr 300: p5 = 48.000
instr 300: p5 = 57.000
instr 300: p5 = 60.000
instr 300: p5 = 48.000
instr 300: p5 = 52.000
instr 300: p5 = 57.000
instr 300: p5 = 60.000
instr 300: p5 = 48.000
instr 300: p5 = 52.000
instr 300: p5 = 57.000
instr 300: p5 = 60.000
instr 300: p5 = 48.000
instr 300: p5 = 52.000
instr 300: p5 = 57.000
instr 300: p5 = 60.000
instr 300: p5 = 48.000
instr 300: p5 = 52.000
instr 300: p5 = 57.000
instr 300: p5 = 60.000
instr 300: p5 = 48.000

```

But I do note that updating `kMode` in perf time is not working. 🤔

---

<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:** [May 12, 2021, 9:06am UTC](https://forum.csound.com/t/the-midiarp-thing/329/5 "2021-05-12T09:06:09Z")

</div>

Actually, I was able to get `kMode` working without having to modify the source code. Can you try this example and MIDI file?

[Chord.MID](https://forum.csound.com/uploads/short-url/kewiC4eSDRGwpwAapckKtizTm8X.MID) (67 Bytes)

[midiarp2.csd](https://forum.csound.com/uploads/short-url/pbyPUxTgHODOzMSRtufhc45ZipL.csd) (1.1 KB)

---

<div class="post-metadata">

**Author:** ![tjingboem](https://forum.csound.com/user_avatar/forum.csound.com/tjingboem/32/44_2.png) [@tjingboem](https://forum.csound.com/u/tjingboem)\
**Post date:** [May 12, 2021, 11:25am UTC](https://forum.csound.com/t/the-midiarp-thing/329/6 "2021-05-12T11:25:59Z")

</div>

midiarp2.csd proves that it does work, at k rate, and

giModes ftgen 1, 0, 4, -2, 0, 1, 2, 3  
kModeIndex phasor .1  
kMode tab kModeIndex, giModes, 1  
is an interesting appraoch- as i was using  
kMode 0, p3, 3.99

but think  
kNote, kTrigger midiarp kTempo, 1  
should just work as well.  
Here it struggles :

[/uploads/default/original/1X/86ce286dfacf9ffafee22b133d4beb5974020ed1.mp4](https://forum.csound.com/uploads/default/original/1X/86ce286dfacf9ffafee22b133d4beb5974020ed1.mp4)

Also Mode 2 does not work right?

---

<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:** [May 12, 2021, 11:41am UTC](https://forum.csound.com/t/the-midiarp-thing/329/7 "2021-05-12T11:41:44Z")

</div>

Hmm, this is all working fine for me. I don’t hear any of the problems you’re facing. Let me double check that my source matches the latest dev tip…

---

<div class="post-metadata">

**Author:** ![tjingboem](https://forum.csound.com/user_avatar/forum.csound.com/tjingboem/32/44_2.png) [@tjingboem](https://forum.csound.com/u/tjingboem)\
**Post date:** [May 12, 2021, 11:43am UTC](https://forum.csound.com/t/the-midiarp-thing/329/8 "2021-05-12T11:43:01Z")

</div>

my build is -Csound version 6.15 (double samples) May 4 2021

---

<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:** [May 12, 2021, 11:51am UTC](https://forum.csound.com/t/the-midiarp-thing/329/9 "2021-05-12T11:51:12Z")

</div>

Sorry, it seems that passing 1 directly also makes a mess of things here. How strange. Leave it with me. And yes, the random stuff does seem to move towards not being very random!

---

<div class="post-metadata">

**Author:** ![tjingboem](https://forum.csound.com/user_avatar/forum.csound.com/tjingboem/32/44_2.png) [@tjingboem](https://forum.csound.com/u/tjingboem)\
**Post date:** [May 12, 2021, 11:53am UTC](https://forum.csound.com/t/the-midiarp-thing/329/10 "2021-05-12T11:53:09Z")

</div>

ha…i get a kick from it every time to establish i am not going crazy 🙂

i’d be glad to test the test!

---

<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:** [May 12, 2021, 11:58am UTC](https://forum.csound.com/t/the-midiarp-thing/329/11 "2021-05-12T11:58:16Z")

</div>

And now pulseaudio crapped itself and can no longer see any devices 😡 Has there ever been a more useless application.

---

<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:** [May 12, 2021, 12:03pm UTC](https://forum.csound.com/t/the-midiarp-thing/329/12 "2021-05-12T12:03:32Z")

</div>

> [@tjingboem](#):
>
> i get a kick from it every time to establish i am not going crazy 🙂

This might hurt then, because mode 2 and 3 seems to work fine for me 🤣 I thought mode 2 was supposed to be random. Hence my stating earlier that is doesn’t work. For me it descends through the notes without issue. I’m still in the dark as to why passing 1 causes such a strange result.

---

<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:** [May 12, 2021, 12:27pm UTC](https://forum.csound.com/t/the-midiarp-thing/329/13 "2021-05-12T12:27:05Z")

</div>

Looking better now I think.

[/uploads/default/original/1X/a950e794e842200402211e25cb3a094b4ddc197a.mp4](https://forum.csound.com/uploads/default/original/1X/a950e794e842200402211e25cb3a094b4ddc197a.mp4)

I just updated the dev tip. Can you pull and try it again?

---

<div class="post-metadata">

**Author:** ![tjingboem](https://forum.csound.com/user_avatar/forum.csound.com/tjingboem/32/44_2.png) [@tjingboem](https://forum.csound.com/u/tjingboem)\
**Post date:** [May 12, 2021, 1:04pm UTC](https://forum.csound.com/t/the-midiarp-thing/329/14 "2021-05-12T13:04:44Z")

</div>

Works perfectly now, using my example:  
instr 200

```
kTempo = 8
kMode line 0,p3,3.99
kNote, kTrigger midiarp kTempo, int(kMode)
printk2 int(kMode)
kFilterFreq lfo 2000, .05, 1
;if kCounter is 1 trigger instrument 300 to play
if kTrigger==1 then 	
    event "i", 300, 0, .5, .5, kNote, abs(kFilterFreq)+200
endif

```

endin

also tried, with all values for kMode: 0,1,2and 3- all works.

I will remove the section Initialization and move kRate and kMode over to the Performance section.  
Then i can close the issue.

I like this opcode, but i wonder if it would be possible to have such an opcode but for non-midi material…i guess grain could do it…

[/uploads/default/original/1X/38f805ffbc2af52051e66cb5c348d2b1816b5cef.mp4](https://forum.csound.com/uploads/default/original/1X/38f805ffbc2af52051e66cb5c348d2b1816b5cef.mp4)
  
…had some fun here…

---

<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:** [May 12, 2021, 1:30pm UTC](https://forum.csound.com/t/the-midiarp-thing/329/15 "2021-05-12T13:30:48Z")

</div>

Ha, that’s nice. I never really used this opcode, but I think I might start!
