Skip to content

midi_chords.py #23

Closed
Closed

Description

@macdroid53

Hello, I apologize for adding this as an issue, but I don't see any other way of contact and/or my lack of understanding.

attempting to run midi_chords.py

With the code as provided:

@client.set_process_callback
def process(frames):

I get this at the console:

/usr/bin/python3.4 /home/mac/PycharmProjs/JackMIDITest/midi_chords.py
################################################################################
press Return to quit
################################################################################
From cffi callback <function Client.set_process_callback.<locals>.callback_wrapper at 0x7f28d3c04c80>:
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/jack.py", line 720, in callback_wrapper
    return callback(frames, userdata)
TypeError: process() takes 1 positional argument but 2 were given

If I change the code to:

@client.set_process_callback
def process(frames, x):

It runs without error, but I see no midi output.
I made the following mod so as to see midi output:

with client:
    client.connect(outport,"MIDI monitor:midi_in")

The client shows up in Jack in both cases...

Activity

  1. mgeier commented on Jul 13, 2015

    @mgeier
    Member

    It's quite OK to create an issue like this if you have questions!

    Your problem with the number of arguments to process() seems to stem from the fact that you are running the examples from a different version (I guess the "master" branch from Github) than the version of jackclient-python you have installed (I guess version 0.2.0 from PyPI).

    I changed the number of arguments to process() in #7 and there hasn't been a PyPI release since.

    Your second problem is actually expected behavior, since midi_chords.py only creates 2 MIDI ports but doesn't attempt to connect them to any other ports (since it doesn't know what ports you want it to connect to).

    One solution would be to allow command line arguments to specify some (optional) MIDI ports where midi_chords.py should connect to.

    Would this be helpful to you?

    Would you want to specify only the output port (as in your example) or the input port as well?

    How did you connect the input port in your example?

  2. macdroid53 commented on Jul 13, 2015

    @macdroid53
    Author

    So where is the "right" version to get? I didn't do a pull from git and your email implies the git master is not right? I think I followed the instructions from your doc page.

  3. mgeier commented on Jul 14, 2015

    @mgeier
    Member

    When you look at the "Code" section of this page, you'll see a drop-down menu somewhere around the top left named "branch: master".
    You can click on this and select "Tags" and then "0.2.0", this should show you the version of the files corresponding to the 0.2.0 release.
    After that, you can just click through to the file you are interested in.
    This is the direct link: https://github.com/spatialaudio/jackclient-python/blob/0.2.0/examples/midi_chords.py
    This is the raw link if you want to download the file: https://raw.githubusercontent.com/spatialaudio/jackclient-python/0.2.0/examples/midi_chords.py

    I'll try to make a new release soon, then the examples should be in sync again.

  4. macdroid53 commented on Jul 15, 2015

    @macdroid53
    Author

    Ok, I got the code from that link and it does appear to be working now. I've also modified my test code and it's working now as well.

    In my case I'm developing an app that sends commands to mixers and such things ( https://github.com/macdroid53/ShowControl ). Since the configuration would be kept in a configuration file, the command line option would not help me much.

    Thanks for helping!

  5. mgeier commented on Jul 16, 2015

    @mgeier
    Member

    If your problem is solved, please close this issue, if not, feel free to continue posting comments here.

    BTW, I just released a new version: https://pypi.python.org/pypi/JACK-Client/0.3.0
    Now the examples should be in sync again.

    You can get the new version with

    pip install JACK-Client --user --update
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions