ofxMidi updates


#21

bernard, that function doesn’t exist in my ofxMidiOut class.

I’m using v 0.02 July 2009.


#22

Yes, you are right. I use the same version, but I forgot something.

**ofxMidi **doesn’t have the **openVirtualPort **function, but **rtMidi **has it.
ofxMidi inherits from rtMidi, but the rtMidi part in ofxMidi is protected.

So, if you define a new class that inherits from **ofxMidiOut **you can acces the protected part.

Example:

in testApp.h :

  
  
#include "ofxMidiOut.h"  
  
class ofExtendedMidiOut : public ofxMidiOut {  
public:  
    void openVirtualPort(const std::string portName)   {  
        midiout.openVirtualPort(portName);  
    }  
};  
  

add also to your testApp class:

  
  
        ofExtendedMidiOut midiOut;  
  

in testApp.cpp :

  
  
void testApp::setup(){  
   midiOut.listPorts();  
   midiOut.openVirtualPort("NameOfYourApplication");  
}  
  

Warning: this works on Mac OS X but not on windows
(for linux I don’t know)

The same can be done for midi input.


#23

//EDIT:

Hey guys. I found the MIDIout files on the openframeworks website.
Thanks anyway :slight_smile:
//

Hey I’m also currently playing around with my OF example.
I also want to send MIDI control messages via IAC to Ableton Live.
My problem is, that in my ofxMidi addon directory there is whether a MidiOut.h or a MidiOut.cpp file. I wasn’t able to find these files in the www.
I’m quite a newby. So I wanted to ask if somebody could “re”-upload these files.
I guess at this moment my programming skills aren’t enough to code a Midiout class that can handel the IAC connection.

I would be so happy if somebody could help me!!

Have a nice day!
Christian


#24

it’s here (jump down)
http://forum.openframeworks.cc/t/ofxmidi-updates/2435/0

you can look at my previous message for virtual midi connections


#25

Has anyone gotten this working recently in Win32? (I’m using Code::Blocks.) I end up with this error:

obj\release\src\testApp.o:testApp.cpp:(.text$_ZN7testAppD1Ev[testApp::~testApp()]+0x48)||undefined reference to `ofxMidiIn::~ofxMidiIn()’

I initially thought that RtMidi wasn’t compiling correctly, since most undefined reference errors seem to point to a previously needed fix of setting #define __WINDOWS_MM__. In ofxMidiConstants.h I manually set #define TARGET_WIN32. However, I still get the error. Any ideas?

To try and minimize complications, I added all needed .h and .cpp files from the oxfMidi plugin into the /src directory with testApp.cpp and testApp.h.

Thanks.


#26

ok, I had also to install ofxmidi on another windows computer, so I can tell you (and verify) what I do (it’s a little more complicated than on the Mac)

  • first download
    download/file.php?id=774
  • decompress it and put the ofxMidi folder into
    of_preRelease_v0062_win_cb_FAT/addons
    or
    of_preRelease_v0061_win_cb_FAT/addons
    (depending which version you use)

  • now open your project in codeblocks
  • right-click on the addons folder on the left toolbar -> add new virtual folder
    and type ofxMidi in the dialog box
  • left-click on the newly created virtual folder and
    open the menu Project -> Add files recursively and locate the ofxMidi folder in of_preRelease_v0062_win_cb_FAT/addons
    -> OK -> OK

  • now open the menu Project -> build options
    select the tab : Search directories and click the button Add
    a dialog will open, click on … (on the right) and locate of_preRelease_v0062_win_cb_FAT/addons/ofxMidi/libs
    on the question Keep this as a relative path click Yes -> OK
    click again Add and now select of_preRelease_v0062_win_cb_FAT/addons/ofxMidi/src
  • close the Project buit option dialog with OK

Go to the manu Build -> Build
there should be no more errors.


#27

Big thanks, bernard. That worked and now I’m up and running. I am curious, though. Do you or anyone else have any idea how I could have gotten an undefined reference to the destructor? I thought the way I set up the project was pretty logical and should have worked. I think there would be value in learning why it didn’t work and hopefully others can avoid doing the same.


#28

Thanks Bernard for your explanation about the virtual midi connections. The connection between Ableton and OF works very well right now.

At the moment I’m stucking a little bit by preparing “right” midi messages for ableton. I use the opencv library for a small color tracking system. Every time a blob is found, a boolean variable is turned to true and a midi message will be send to Ableton. At the moment my problem is that OF every update() loop a new “*.sendNoteOn” will be send to Ableton. In the end I’m not sure how to “teach” OF that a MIDI note also has a certain length.
(instead of 1111111111 I would like to have a Message like: 1(start)hold-hold-hold-hold-…0(end)).
I’m a really fresh programmer (started over quite a year). Unfortunately sometimes I reach problems I’m really not sure how to deal with them. :frowning:

Perhaps I will fix this problem in a few days. Perhaps not. If you can give me a hint I would be very pleased. =)

christian


#29

you control the duration of the note by delaying the note off. you should be sending a noteOff for every noteOn you send. depending on the instrument you’re using it could have an envelope with no sustain so no matter when you send the note off it will stop after the the decay. but for any other case, the note shouldn’t stop until you send the note off


#30

hey arturo . Thanks for your answer. I solved the “delaying” problem I had to deal with an incoming boolean range. (like 1111111111100000000000001111111111111 etc)

What I actually did is to compare the actual incoming value with the on step older value:

transferold = transfernew;

transfernew = INCOMINGBOOLEAN;

if (transferold == 0 && transfernew == 1) midioout.sendNoteOn(x, y, z);

else if (transferold == 1 && transfernew == 0) midioout.sendNoteOff(x, y, z);

////// very easy… but it works.

christian


#31

I’m getting some troubles with my Akai MPD using ofxMidi…

I have to unplug the akai and replug it to be able to use it…

Do i forget something in closing applications routines (even if i close the port in teh destructor of the class using ofxMidi…) ? what is the classical use of ofxMidi ?

Did someone met these troubles ? Does it come from windows 7 ? from Akai (i know the MPD consume a lot of electricity on USB port) ?
Has someone any idea ?


#32

That was the current supply which did troubles…
Some external voltage supplier on my mpd solve everything.

D.


#33

Howdy all,

Where is the current ofxMidi code? I’m looking to jump into midi heavily and want to use it.

I asked Arturo if I can host and maintain the addon on Github, if there are no objections. Chris, you have a empty Github project for it: https://github.com/chrisoshea/ofxMidi Will there be a version there? If not, where’s the latest code I can upload? It should really be in a public repo.


#34

Dan I am on it now, get back to you v shortly


#35

Ok here is a permanent home for ofxMidi

https://github.com/chrisoshea/ofxMidi

It hasn’t been used since OF 0061 so definitely needs to be tested & cleaned up (particularly the event stuff). Please post any specific bugs on github, and of course any code changes.

I’ll also go through some of the forum posts and see whats missing that people need.


#36

I’d have one wish (I don’t think it’s in yet): SysEx message capability. I’m planning on hacking around with my midicontroller’s display, would need sysex for that.


#37

Yes, SYSEX!!! That would be great, it is also the way to control lighting desks and other hardware that uses Midi Show control. For lighting desks it lets you do advanced functions like picking individual cues from cue lists, very helpful for making work that integrates with theaters and lighting designers.


#38

OK, so since I’m not alone, I made an issue in your github repo, Chris: https://github.com/chrisoshea/ofxMidi/issues/1


#39

I am currently working on v0.03 (not online yet)

so far:

  • Cleaned up code for 007
  • Updgraded RtMidi from 1.0.10 to 1.0.14
  • added sendProgramChange() and sendPitchBend() to MidiOut
  • added openVirtualPort() to MidiOut & MidiIn
  • adding ignoreTypes( bool midiSysex = true, bool midiTime = true, bool midiSense = true ) to MidiIn

I am also working on a switchable system so that you can use ofxMidi on desktop or iOS, as requested-here.

Although RtMidi does use CoreMidi on Mac, in theory it could be changed around to also run in iPhone, I would prefer to keep it clean so there is ofxMidiOut for desktop and one for iPhone, that way I’m not having to change anything within RtMidi.

So you would do:

#define OFX_MIDI_USE_RT
#include “ofxMidi.h”

or
#define OFX_MIDI_USE_IOS
#include “ofxMidi.h”

Will get online as quick as I can.

Please tell me more about SysEx messages as I’ve never used them before. What are they, what do they need to do?


ofxMidi on iOS
#40

basically, sysex are messages used by vendors to, e.g. reprogram midi-enabled devices, or upload pathces/templates. i.e. do stuff which is too complicated for “normal” midi messages. In my case, I have a display on my midi controller, the contents of which i can reprogram by sending specifically formed sysex messages.
It’s been harder than I thought to hunt down a nice specification for the sysex message format, but I’ll keep looking. :frowning:

edit: ha found something usable: http://home.roadrunner.com/~jgglatt/tech/midispec/sysex.htm