mididings help

What other apps and distros do you use to round out your studio?

Moderators: khz, MattKingUSA

Auzain
Established Member
Posts: 3
Joined: Sat Nov 14, 2015 2:19 pm

mididings help

Postby Auzain » Sat Nov 14, 2015 2:33 pm

Ave,
I have two problems:

1/ I am french and I dont very understand english!

2/ I am new in mididings, I understand the most. Bud I dont understand how I could test 2 keys in the same moment.

KeyFilter('c2') >> Harmonize('c', 'major', ['unison', 'thirth']) #works
[KeyFilter('bb1'), KeyFilter('c2')] >> Harmonize('c', 'major', ['unison', 'thirth']) #don't works

Can you help me?
Thanks

User avatar
noedig
Established Member
Posts: 136
Joined: Wed Feb 12, 2014 4:39 am
Location: South Africa

Re: mididings help

Postby noedig » Sat Nov 14, 2015 5:27 pm

You have a typo, 'thirth' instead of 'third'. It worked for me when I fixed this.

Auzain
Established Member
Posts: 3
Joined: Sat Nov 14, 2015 2:19 pm

Re: mididings help

Postby Auzain » Sun Nov 15, 2015 8:31 am

Yes ok, it's my fault.
Is not what I want. I know it's working but the result is wrong.
In the 2nd part, it plays a C when I touch the C key and a B when i touch the B key. No it's not what I want.
C when I touch the C key, ok. And a Cm when I touch the B key and when I continue to touching the C key in the same time.

I hope it's clear ;)

User avatar
noedig
Established Member
Posts: 136
Joined: Wed Feb 12, 2014 4:39 am
Location: South Africa

Re: mididings help

Postby noedig » Sun Nov 15, 2015 11:21 am

If I understand you correctly:
  • When you touch only C, you want to hear a C major chord.
  • When you touch both the C and B key at the same time, you want to hear a C minor chord.

I'm not sure how to do it with only Mididings units. However, here is a somewhat elaborate hack using a Python function:

Code: Select all

from mididings import *
from mididings.extra import *
from mididings.event import *
from mididings.extra.osc import OSCInterface
from mididings.extra.inotify import *


hook(AutoRestart())   # Auto reload script when changes are made


b1_down = 0 # velocity of last b1 event
c2_down = 0 # velocity of last c2 event
b1 = 47 # note number of b1
c2 = 48 # note number of c2


def myFilter1(ev):
   global b1_down
   global c2_down
   if ev.type == NOTEON:
      if ev.note == b1:
         b1_down = ev.velocity
         if c2_down:
            # if b noteon and c is down: return [c noteoff, b noteon]
            return [ev, NoteOffEvent(ev.port, ev.channel, c2)]
         else:
            # if b noteon and c is up: return None
            return None
      elif ev.note == c2:
         c2_down = ev.velocity
         if b1_down:
            # if c noteon and b is down: return b noteon
            return NoteOnEvent(ev.port, ev.channel, b1, ev.velocity)
         else:
            # if c noteon and b is up: return c noteon
            return ev
   elif ev.type == NOTEOFF:
      if ev.note == b1:
         b1_down = 0
         if c2_down:
            # if b noteoff and c is down: return [b noteoff, c noteon]
            return [ev, NoteOnEvent(ev.port, ev.channel, c2, c2_down)]
         else:
            # if b noteoff and c is up: return None
            return None
      elif ev.note == c2:
         c2_down = 0
         if b1_down:
            # if c noteof and b is down: return b noteoff
            return NoteOffEvent(ev.port, ev.channel, b1)
         else:
            # if c noteoff and b is up: return c noteoff
            return ev
   
   return None

   

run(
   Filter(NOTE) >> [KeyFilter('b1'), KeyFilter('c2')] >> Process(myFilter1) >>
   [
   KeyFilter('c2') >> Harmonize('c', 'major', ['unison', 'third']) ,
   KeyFilter('b1') >> Harmonize('c', 'minor', ['unison', 'third'])
   ]
   
)


Auzain
Established Member
Posts: 3
Joined: Sat Nov 14, 2015 2:19 pm

Re: mididings help

Postby Auzain » Sun Nov 15, 2015 8:03 pm

Yes!!! it is.
I must now code all the octave, but now I see what is to do.
Thanks.

Perhaps, is there something like that? An "auto-accompagnement" like yamaha PSR-180 because a have this and it begins to bug and I learn the codes. Now I go to the pc-keyboard Audio KeyRig49 and I want the same system.


Return to “Linux Distributions & Other Software”

Who is online

Users browsing this forum: No registered users and 1 guest