• Posts
  • RSS
  • ◂◂RSS
  • Contact

  • Game Controller MIDI

    June 20th, 2018
    music  [html]
    Expression controllers can make synthesized instruments sound much better, but they're generally pretty expensive. For example, the breath controller I've been playing with cost me EUR 132. There's nothing fundamentally expensive about it, just a low volume product. Which got me thinking: is there some commonly mass produced device that gives a smooth range of outputs? What about a game controller?

    I've never been into console gaming so I don't know much about controllers, but after looking at some pictures it looked like the PS4 one is well laid out for joystick use, so I ordered one ($26, shipped):

    It connects via USB, and pygame can read from it out of the box:

    >>> import pygame
    >>> pygame.init()
    (6, 0)
    >>> j = pygame.joystick.Joystick(0)
    >>> j.init()
    >>> while True:
    ...   for event in pygame.event.get():
    ...      print(event)
    ...
    <Event(7-JoyAxisMotion {
      'joy': 0,
      'value': 0.003906369212927641,
      'axis': 0})>
    <Event(7-JoyAxisMotion {
      'joy': 0,
      'value': -1.000030518509476,
      'axis': 4})>
    ...
    

    Since music is so latency sensitive (though maybe not for expression controllers?) I didn't want to have to go via python, so I decided to write something small against the OSX native API. The docs for the native API are pretty annoying, so the SDL source was a helpful guide.

    It's ready and working, and you can try it out:

    • Build it from source (github):

      $ git clone https://github.com/jeffkaufman/gcmidi.git
      $ cd gcmidi
      $ make run
      
    • Download a binary:

      $ wget https://www.jefftk.com/gcmidi
      $ chmod ugo+x gcmidi
      $ ./gcmidi
      
    It presents as a virtual MIDI controller named "game controller" with ten continuous controller outputs on CC-20 through CC-29.

    Comment via: google plus, facebook, r/WeAreTheMusicMakers

    Recent posts on blogs I like:

    Governance in Rich Liberal American Cities

    Matt Yglesias has a blog post called Make Blue America Great Again, about governance in rich liberal states like New York and California. He talks about various good government issues, and he pays a lot of attention specifically to TransitMatters and our …

    via Pedestrian Observations November 19, 2020

    Collections: Why Military History?

    This week, I want to talk about the discipline of military history: what it is, why it is important and how I see my own place within it. This is going to be a bit of an unusual collections post as it is less about the past itself and more about how we st…

    via A Collection of Unmitigated Pedantry November 13, 2020

    Misalignment and misuse: whose values are manifest?

    Crossposted from world spirit sock puppet. AI related disasters are often categorized as involving misaligned AI, or misuse, or accident. Where: misuse means the bad outcomes were wanted by the people involved, misalignment means the bad outcomes were wan…

    via Meteuphoric November 13, 2020

    more     (via openring)


  • Posts
  • RSS
  • ◂◂RSS
  • Contact