Giter VIP home page Giter VIP logo

gamepad2midi's Introduction

gamepad2midi

Python application to convert gamepad input to MIDI events.

It displays a graphic user interface for gamepad feedback. It tries to use PyQt 4 or 5, then use pygame if none of them are installed.

The gamepad events are catched using pygame.

The MIDI events are send using rtmidi library.

The binding description is done in Python source code, you can find an example in the file mygamepad2midi.py.

Installation

Ubuntu / Debian / Raspbian

You have to install pygame, PyQt if you like and rtmidi.

sudo apt-get install python-pygame python-pyqt4 python-rtmidi

If rtmidi for Python is not packaged for your distribution, you can install it like that.

sudo apt-get install librtmidi-dev
sudo pip install python-rtmidi

Configuration

You have first to find the name of your gamepad. For that, plug your gamepad and use lsusb, or execute ./mygamepad2midi.py (gamepad names will be displayed).

Then you have to configure the binding provided on mygamepad2midi.py. You can create your own file based on it.

cp mygamepad2midi.py test.py
# configure test.py
./test.py

You can use the application in place by executing mygamepad2midi.py or your own file placed in the same directory. Or you can use it as a library, and execute your own script based on mygamepad2midi.py anywhere you want.

cd gamepad2midi.git
pip install --user .

Todo

  • headless option
  • command line argument
  • file format for the binding
  • use library supporting plug in/out of gamepad

gamepad2midi's People

Contributors

bayo avatar pwqw avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

mutendo64 pwqw

gamepad2midi's Issues

How to install?

I did

$ sudo apt-get install librtmidi-dev
$ sudo pip install python-rtmidi
# edit mygamepad2midi.py
$ ./mygamepad2midi.py

exceptions.. and more exceptions.. finally:

No MIDI ports found.
Traceback (most recent call last):
  File "./mygamepad2midi.py", line 16, in <module>
    main()
  File "./mygamepad2midi.py", line 13, in main
    gamepad2midi("JACK", mapping)
  File "/tmp/gamepad2midi/gamepad2midi.py", line 220, in gamepad2midi
    job = Gamepad2Midi(api, mapping)
  File "/tmp/gamepad2midi/gamepad2midi.py", line 99, in __init__
    self.midi_connector = midi_connector_factory(api)
  File "/tmp/gamepad2midi/gamepad2midi.py", line 81, in midi_connector_factory
    return RtmidiMidiConnector(rtmidi_api)
  File "/tmp/gamepad2midi/util/RtmidiMidiConnector.py", line 17, in __init__
    raise Exception("No port was found")
Exception: No port was found

How to install it?

(ubuntu 16.04)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.