rdnzl
Posts: 4
Joined: Mon Nov 11, 2013 1:37 am

Midi Interface, total newbie

Mon Nov 11, 2013 1:43 am

Hello there,

Growing frustrated from bad support for midi / usb on win & mac os, I thought I would do a bit of programming on a raspberry...

So, here it, where do I start? I have some knowledge of the midi implementation in Java, and so I could start there, but I am open to all suggestions...

Kind Regards

KenT
Posts: 758
Joined: Tue Jan 24, 2012 9:30 am
Location: Hertfordshire, UK
Contact: Website

Re: Midi Interface, total newbie

Mon Nov 11, 2013 11:59 am

sudo apt-get install timidity to get midi onto the Pi

Look at the three tetris based Python Games examples. Location of these will be reveled by opening the desktop icon in leafpad
Pi Presents - A toolkit to produce multi-media interactive display applications for museums, visitor centres, and more
Download from http://pipresents.wordpress.com

User avatar
Douglas6
Posts: 4850
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Midi Interface, total newbie

Mon Nov 11, 2013 1:24 pm

Java has excellent MIDI support, and Linux has good support for USB midi devices. I was able to simply plug in my AKAI MPD18 pad controller to trigger MIDI sequences that I used to control a 8x relay board. I haven't tried the Java synthesizer yet, but you can also use Linux virtual MIDI to pass-through to, say, FluidSynth. In my brief tinkering, I was fairly impressed with the latency of the Pi, even without jackd or other tweaks. [EDIT: I am not a musician; your results may vary. Remember it's a Raspberry pi.]

User avatar
AutoStatic
Posts: 326
Joined: Tue Jan 01, 2013 10:27 pm
Contact: Website

Re: Midi Interface, total newbie

Mon Nov 11, 2013 7:36 pm

rdnzl wrote:So, here it, where do I start?
Discover what's already there and make sure you're not going to reinvent the wheel ;) And do you have any idea what you'd like to develop? Software that takes MIDI as an input (synth, drum machine, sampler) or that filters MIDI events? Or maybe something like a sequencer? Or would you like to work on a lower level (thinking drivers here)?
RPi and real-time, low-latency audio: http://wiki.linuxaudio.org/wiki/raspberrypi
RPi audio repository: http://rpi.autostatic.com/
RPi and audio blog: https://autostatic.com/tag/raspberrypi/

rdnzl
Posts: 4
Joined: Mon Nov 11, 2013 1:37 am

Re: Midi Interface, total newbie

Mon Nov 11, 2013 7:47 pm

Hey,

For now, I just want a dead simple midi patch bay. Probably when I get comfortable with the dev cycle, I will filter, then map events, and so on...

User avatar
DougieLawson
Posts: 38523
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Midi Interface, total newbie

Mon Nov 11, 2013 7:58 pm

KenT wrote:sudo apt-get install timidity to get midi onto the Pi
That gets you the software side of MIDI but doesn't provide the hardware side that used to let you wire a MIDI instrument to a PC soundcard (first seen on Apple ][, Apple ][e and C64s).

That could be an interesting hardware project.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

I'll do your homework for you for a suitable fee.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

MoosePi
Posts: 112
Joined: Wed Nov 06, 2013 4:42 pm

Re: Midi Interface, total newbie

Mon Nov 11, 2013 9:37 pm

Pi Forum Search and Google yields answers to many questions

User avatar
AutoStatic
Posts: 326
Joined: Tue Jan 01, 2013 10:27 pm
Contact: Website

Re: Midi Interface, total newbie

Tue Nov 12, 2013 12:54 pm

rdnzl wrote:For now, I just want a dead simple midi patch bay.
Then you might want to check out aconnect or its GUI frontend aconnectgui.
rdnzl wrote:Probably when I get comfortable with the dev cycle, I will filter, then map events, and so on...
Check out midish, mididings or ALSA MIDI Filter.
RPi and real-time, low-latency audio: http://wiki.linuxaudio.org/wiki/raspberrypi
RPi audio repository: http://rpi.autostatic.com/
RPi and audio blog: https://autostatic.com/tag/raspberrypi/

User avatar
AutoStatic
Posts: 326
Joined: Tue Jan 01, 2013 10:27 pm
Contact: Website

Re: Midi Interface, total newbie

Tue Nov 12, 2013 1:13 pm

DougieLawson wrote:That gets you the software side of MIDI but doesn't provide the hardware side that used to let you wire a MIDI instrument to a PC soundcard (first seen on Apple ][, Apple ][e and C64s).

That could be an interesting hardware project.
http://zuzebox.wordpress.com/2012/03/18 ... -pi-v0-10/
You could also do this with a $6 USB-MIDI cable: http://dx.com/p/usb-2-0-to-midi-convert ... gth-110980
RPi and real-time, low-latency audio: http://wiki.linuxaudio.org/wiki/raspberrypi
RPi audio repository: http://rpi.autostatic.com/
RPi and audio blog: https://autostatic.com/tag/raspberrypi/

tjsheffler
Posts: 8
Joined: Sun Aug 25, 2013 4:51 pm

Re: Midi Interface, total newbie

Tue Nov 12, 2013 2:33 pm

Hi rdnzl -

Here are a few pointers I've found useful to get started programming midi on the Pi:

- Python on the Pi comes with PyGame installed and its own midi wrapper around ALSA. Here is an example
that shows how to talk to pygame.midi

https://bitbucket.org/pygame/pygame/src ... es/midi.py

- I've enjoyed reading this series of articles by Craig Stuart Sapp. He shows simple programming examples in C
for talking to OSS devices and ALSA devices.

https://ccrma.stanford.edu/~craig/articles/linuxmidi/

- Before you begin compiling C code that access ALSA you'll need to install the libasound2-dev package. (You'll need gcc too, of course)
% sudo apt-get install libasound2-dev
- Here's a nice article on how ALSA reveals itself through the /proc filesystem

http://alsa.opensrc.org/Proc_asound_documentation

Have some fun!

rdnzl
Posts: 4
Joined: Mon Nov 11, 2013 1:37 am

Re: Midi Interface, total newbie

Wed Dec 25, 2013 12:08 am

Okay,

I might start doing some work, will read the articles, and have a good look at mididings...

Cheers

ilmostro
Posts: 1
Joined: Fri Oct 03, 2014 12:12 pm

Re: Midi Interface, total newbie

Fri Oct 03, 2014 1:05 pm

A MIDI interface to RTP (Midi over Ethernet) would be awesome. I believe the RTP code is open source, so it should be possible.

User avatar
robin48gx
Posts: 17
Joined: Mon Jul 16, 2012 11:20 am
Location: Brighton

Re: Midi Interface, total newbie

Mon Dec 22, 2014 9:13 am

Hi

Midi is just Rs-232 at 31k bps I think.
Does the timidity program act as a USB host. If so it might be quite easy
to get the timidity program to simply pass midi messages it receives
on to the Rs-232. Viola! and we have a midi interface that can go on a modern piano which only
has USB (like the Yamamha P105)

ur_rnorn_says_hi
Posts: 4
Joined: Sun Jan 11, 2015 5:11 am

Re: Midi Interface, total newbie

Sun Jan 11, 2015 1:59 pm

This falls in line somewhat with a project I am about to startt. About to as in later this afternoon... unless i can't find any real direction or find out i'm going in the wrong direction. I am going to work on a device that will trigger lighting, or other visual effects via either an internal trigger (for things like projection or random graphics) or an external relay bank (for dumb lights, christmas lights etc) or via midi (dmx technically, but dmx is just modified midi, for 'smart' lighting). I would like to be able to bind triggers to things like specific notes @ specific frequencies, a progression of notes, at a specific time in the track, at the 'break down' or 'break' (so basically at drastic changes, but also would like to try and use predictive analysis to try and determine the length in beats of the 'break' so that a dramatic lighting change would already be waiting )... I know that something like Pure Data and Max MSP would do what im trying to do, but it's too robust and processor intensive for what i am envisioning... anyone have any thoughts, or suggestions?

JovianPyx
Posts: 112
Joined: Fri Nov 20, 2015 9:34 pm

Re: Midi Interface, total newbie

Mon Jan 04, 2016 11:32 pm

AutoStatic wrote:
DougieLawson wrote:That gets you the software side of MIDI but doesn't provide the hardware side that used to let you wire a MIDI instrument to a PC soundcard (first seen on Apple ][, Apple ][e and C64s).

That could be an interesting hardware project.
http://zuzebox.wordpress.com/2012/03/18 ... -pi-v0-10/
You could also do this with a $6 USB-MIDI cable: http://dx.com/p/usb-2-0-to-midi-convert ... gth-110980
I have this exact USB-MIDI cable (DIGIFLEX) and while lsusb shows the device and ALSA can connect it, I've not been able to make it work with ZynAddSubFX. My MIDIsport 2x2 works perfectly, but when I use the DIGIFLEX cable device, I get error messages from ZynAddSubFX such as:

Code: Select all

Damage("/part15/")
Info, other non-handled midi event, type: 36
other type numbers were output as well along with

Code: Select all

Damage("/part0/")
I don't know what those messages mean, but they don't occur when I use the MIDIsport device - and the synth plays notes with the MIDIsport where it plays nothing with the DIGIFLEX.

I have made the assumption that there's no driver to install?

I'm using a Raspberry Pi 2 B running Arch Linux with kernel 4.1.13-1.2-WSP (the WSP part is there because I'm also using a Cirrus/Element14 audio card).

Can anyone shed some light?

rroor
Posts: 1
Joined: Wed Mar 01, 2017 9:24 am

Re: Midi Interface, total newbie

Wed Mar 01, 2017 9:36 am

by ilmostro » Fri Oct 03, 2014 1:05 pm
A MIDI interface to RTP (Midi over Ethernet) would be awesome. I believe the RTP code is open source, so it should be possible.
For the moment, no RTP MIDI stack and drivers looks available under Linux. Best solution is to use an external MIDI interface to get RTP connectivity. Midigateway Network MIDI interface from Cinara looks to make the job by providing access to MIDI ports and RTP midi sessions over Ethernet. Connection to the host (rpi) is done using USB.

User avatar
mclarenlabs
Posts: 9
Joined: Sun Nov 25, 2018 10:35 pm
Contact: Website

Re: Midi Interface, total newbie

Thu Jan 03, 2019 12:47 am

Take a look at rtpmidi from McLaren Labs.

https://mclarenlabs.com

It is a commercial product, but not expensive. And it was designed for the Raspberry Pi :-)

Return to “Graphics, sound and multimedia”