LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-24-2009, 04:28 AM   #1
Nareto
LQ Newbie
 
Registered: Jun 2009
Posts: 6

Rep: Reputation: 0
creating MIDI notes from input events: which way to go?


Hello, I own a Rig Kontrol 2 from Native Instruments, which is esentially a sound card with buttons and a pedal (it is meant for guitar use). This device already has a working driver, and the buttons and the pedal produce linux input events. I would like to write a program to transform these into MIDI so as to be able to use the device with audio software.

Precisely i would like to create a Jack midi client that also reads the input events and converts them to MIDI.

I have some basic programming skills but this would be my first real program, and i will certainly need to document. Problem is: what should i learn? Are there some libraries for some high level language (python, perl, ??) which will make me life easier?

Or would it be easier to use some already existing code and hack it? Though i would prefer writing it myself so i learn more.

any suggestion appreciated
Renato
 
Old 06-24-2009, 10:10 PM   #2
kellinwood
Member
 
Registered: Jan 2006
Location: Culver City, California
Distribution: Fedora
Posts: 64

Rep: Reputation: 21
If it were me, I'd be using C or C++ to work with the Jack API. I know there is a Python library for Jack (PyJack?) but I'm not sure it supports MIDI.

Plan on using a ring buffer to send the MIDI events from your main event handling thread to the Jack process cycle callback code. From the process cycle callback you read the MIDI events out of the ring buffer and send them via the Jack MIDI API.
 
Old 12-09-2011, 05:47 AM   #3
Nareto
LQ Newbie
 
Registered: Jun 2009
Posts: 6

Original Poster
Rep: Reputation: 0
had totally forgotten about this post, getting back to it in case someone finds it by googling.

The definitive solution would have been writing something in C or C++ using the linux/input.h library. I was even given a good stub here:
http://permalink.gmane.org/gmane.lin...io.devel/18481

However, due my lack of C experience, it was way easier for me to use supercollider - it has a GeneralHID class which makes making midi from any HID (included my device) a breeze. Here's some example code, rather old and convoluted but should be easy to hack:
http://alsa.opensrc.org/NativeInstruments#SuperCollider
(also go through the GeneralHID help file in supercollider)

In the meantime I've come to know that also puredata has something similar to GeneralHID... I chose supercollider only because I allready knew it a little - if you're gonna learn this from scratch only to do this maybe with puredata you'll be up faster, from what I hear it's easier for simple things like this.

HTH
 
Old 12-09-2011, 07:42 AM   #4
Cedrik
Senior Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 2,140

Rep: Reputation: 244Reputation: 244Reputation: 244
I rather would start from amidi (midi tool installed with alsa package) source file
http://fossies.org/linux/misc/alsa-u...8c_source.html

Edit:
Sorry, I misread the requirement, amidi is only usefull for dealing with hardware midi ports

It seems you need an interface between input events and audio software

Last edited by Cedrik; 12-09-2011 at 07:45 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Trying to get my Wacom Intuos3 working, problem with input devices/events. Ancient_Blade Slackware 17 02-18-2006 03:55 PM
X11 Input drivers (keyboard and mouse), events Cyborg16 Linux - Software 1 05-22-2005 09:01 AM
Software synthesizers and rerouting MIDI events to them fyhuang Linux - Software 0 12-22-2004 02:53 PM
Question on creating ACPI events... sephkeene Linux - Laptop and Netbook 0 08-27-2004 01:15 AM
Gnome sound events & MIDI skip1 Linux - Software 0 05-22-2003 04:39 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:32 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration