pypm.Input reads all keys and pedals from usb midi device; pyo.CtlScan only reads events from petals

119 views
Skip to first unread message

Skylar Saveland

unread,
Jun 23, 2012, 1:27:25 AM6/23/12
to pyo-d...@googlegroups.com
running the 02_midi_ctl_scan.py script, I only see events from my pedals, 64, 66 and 67:

(pyo)skyl@skyl-i5:~/Code/pyo/examples/utilities$ python 02_midi_ctl_scan.py
pyo version 0.6.2 (uses single precision)
MIDI devices:
0: OUT, name: Midi Through Port-0, interface: ALSA
1: IN, name: Midi Through Port-0, interface: ALSA
2: OUT, name: UM-1SX MIDI 1, interface: ALSA
3: IN, name: UM-1SX MIDI 1, interface: ALSA
4: OUT, name: qjackctl, interface: ALSA

Enter your Midi interface number : 3
Buffer size set to Jack engine buffer size: 1024
Play with your Midi controllers...
Do you want to continue ? (y/n) : y
Continue...
controller number = 64
ctl number : 64, ctl value : 0, midi channel : 1
ctl number : 64, ctl value : 127, midi channel : 1
ctl number : 64, ctl value : 127, midi channel : 1
ctl number : 64, ctl value : 0, midi channel : 1
controller number = 67
ctl number : 67, ctl value : 127, midi channel : 1
ctl number : 67, ctl value : 0, midi channel : 1
ctl number : 67, ctl value : 127, midi channel : 1
ctl number : 67, ctl value : 0, midi channel : 1
controller number = 66

However, with pypm's test script; I can retrieve events from all the keys and pedals:

(pyo)skyl@skyl-i5:~/Code/elmusic/pyportmidi$ python test_pyportmidi.py

enter your choice...
1: test input
2: test output
   
1
1 Midi Through Port-0   (input)  (unopened)
3 UM-1SX MIDI 1   (input)  (unopened)

Type input number: 3
Midi Input opened. Reading  100  Midi messages...
Got message  1 : time  7825 ,  144   100   41 0
Got message  2 : time  7868 ,  144   103   31 0
Got message  3 : time  7870 ,  144   101   25 0
Got message  4 : time  7935 ,  128   101   64 0
Got message  5 : time  7940 ,  128   103   64 0
...
Got message  23 : time  223583 ,  176   64   127 0

For the pypm numbers:
1) 144 is NOTEON, 128 is NOTEOFF, 176 is pedal
2) keys are [21-108], pedals are 64, 66, 67
3) velocity
4) ?, always 0

The same is true whether using JACK or ALSA.

Not sure how I might get these key events going in pyo.

Paul M

unread,
Jun 27, 2012, 5:14:18 PM6/27/12
to pyo-d...@googlegroups.com
I've got what I think is exactly the same question -- i.e. How do I poll for Midi note messages in Pyo?

Cheers,
Paul

PJ leonard

unread,
Jun 27, 2012, 5:51:37 PM6/27/12
to pyo-d...@googlegroups.com

I don't think you can poll for note messages.  You need to use a Notein object and the streams it creates.  Paul.

On Jun 27, 2012 10:14 PM, "Paul M" <pmm...@gmail.com> wrote:

Paul M

unread,
Jun 27, 2012, 6:12:51 PM6/27/12
to pyo-d...@googlegroups.com
Thanks for the fast response. I'm still trying to wrap my head around the structure of pyo.  

I'm trying to do something like the following, to see what notes are being triggered. This doesn't work, but hopefully you'll understand what I'm shooting for. Basically, I just want to represent the MIDI input in terms of their integer values.


from pyo import *
s = Server()
s.boot()
s.setMidiInputDevice(1) # enter your device number (see pm_list_devices())
s.start()
notes = Notein(poly=1,scale=0,channel=1)

while 1:
    print notes['pitch']

s.gui(locals()) 

PJ leonard

unread,
Jun 28, 2012, 6:57:19 AM6/28/12
to pyo-d...@googlegroups.com

Hi,

You need to understand that the streams live in C code.  To observe a stream you can use the pyo Print object. 

Replace your loop with

Print(notes['pitch'])

But this is really only useful for debugging. What are you really trying to do? You probably want to use the Notein streams as inputs to other pyo objects.

Cheers Paul.

PJ leonard

unread,
Jun 28, 2012, 7:42:09 AM6/28/12
to pyo-d...@googlegroups.com
Here is a simple sine wave synth that plays midi.

------------------------------
from pyo import *

pm_list_devices()

rate=44100.0
s = Server(sr=rate)
s.setMidiInputDevice(3)

s.boot()

notes = Notein(poly=4,scale=1)


trigs=notes['velocity']
freqs=notes['pitch']

env = MidiDelAdsr(trigs, delay=.0, attack=.05, decay=.51, sustain=.8, release=1)

b = Sine(freq=freqs, mul=env)

b.out()

env.ctrl()

s.gui(locals())
---------------------------------

Bryan Smart

unread,
Jun 28, 2012, 1:18:59 PM6/28/12
to pyo-d...@googlegroups.com
Olivier, I don't want to be a pest, but can you give any info on when you think you will be able to post these?

Thanks.
Bryan

Olivier Bélanger

unread,
Jun 28, 2012, 3:12:38 PM6/28/12
to pyo-d...@googlegroups.com
Hi,

Sorry, that should be done by now but I had a last-minute change to do and it takes me a couple of days... I want to double check E-Pyo on Windows tonight and then, I begin to build the packages.

Olivier

2012/6/28 Bryan Smart <bryan...@bryansmart.com>
Reply all
Reply to author
Forward
0 new messages