Wondering if this is currently possible to do using the ZExternalLibrary component,. and some Windows API voodoo,.. . ? (also is it possible for Android?)
I am building a "linear feedback bit-shifting long cycle sequencer" or that is what I am calling it,. the idea is based largely on the Triadex Muse; http://m.matrixsynth.com/2011/07/triade ... music.html
although I come to it from the interest in this one; http://musicthing.co.uk/modular/?page_id=21
My version f the simple one attached. The larger system is coming along, howevr not posted yet..,
So basically I am finding that looping bit-shit registers with digital feedback are rather interesting for making patterns.
Currently these are playing zge/sunvox sounds, but it could be cool to try sending MIDI notes outside,.
Anyway, MIDI input and output from ZGE could be interesting for sound/graphics control experiments and stuff.
MIDI - can I send MIDI notes/data using ZExternalLibrary ?
Moderator: Moderators
- jph_wacheski
- Posts: 1005
- Joined: Sat Feb 16, 2008 8:10 pm
- Location: Canada
- Contact:
MIDI - can I send MIDI notes/data using ZExternalLibrary ?
- Attachments
-
- FlippinBits_001.zip
- .zgeproj and .exe
- (40.15 KiB) Downloaded 481 times
iterationGAMES.com
Re: MIDI - can I send MIDI notes/data using ZExternalLibrary
Hi jph,

http://msdn.microsoft.com/en-us/library ... 98495.aspx
K
Surejph_wacheski wrote:Wondering if this is currently possible to do using the ZExternalLibrary component and some Windows API voodoo?

http://msdn.microsoft.com/en-us/library ... 98495.aspx
K
- jph_wacheski
- Posts: 1005
- Joined: Sat Feb 16, 2008 8:10 pm
- Location: Canada
- Contact:
Cool thanks Kjell, exactly what I was looking for!
ok so I got this;
and figuring that we need this;
So we can set note and velocity here. What I can not find/figure out is how to get hMidiOut ?
Seems this is the needed 'handle' to the midi device the windows driver has,. not sure how to get it??
ok so I got this;
Code: Select all
ZZDC<?xml version="1.0" encoding="iso-8859-1" ?>
<ZExternalLibrary ModuleName="winmm">
<Source>
<![CDATA[
// simple MIDI
int midiOutOpen( int lphMidiOut, int uDeviceID, int dwCallback, int dwInstance, int dwFlags ) {}
int midiOutClose( int hMidiOut ) {}
int midiOutShortMsg( int hMidiOut, int dwMsg ) {}]]>
</Source>
</ZExternalLibrary>
Code: Select all
//set up to play a MIDI note
int note = 60; //for C. C# = 61, etc.
int event = 144; //event 144 = play on channel 1
int loWord = (note*256)+event;
int velocity = 127;
int hiWord = velocity*256*256;
int dwMsg = loWord + hiWord;
Seems this is the needed 'handle' to the midi device the windows driver has,. not sure how to get it??
iterationGAMES.com
Hi jph,
And you should use bit-shifting instead of multiplication. Use "note << 8" instead of "note * 256" and "velocity << 16" instead of "velocity * 256 * 256" 
K
As mentioned on MSDN; LPHMIDIOUT lphmo is a ..jph_wacheski wrote:What I can not find/figure out is how to get hMidiOut ?
So, make sure to define lphMidiOut in the function prototype as ref / xptr ( see below ) .. then the handle will be written to the passed variable / array ( ZGE only accepts arrays for xptr arguments ).Pointer to an HMIDIOUT handle. This location is filled with a handle identifying the opened MIDI output device.
Code: Select all
int midiOutOpen(ref int lphmo, int uDeviceID, xptr dwCallback, xptr dwCallbackInstance, int dwFlags){}

K