Einzelnen Beitrag anzeigen
Alt 26-10-2009, 14:11   #1 (permalink)
derChiller
Neuer User
 
Registriert seit: Oct 2002
Ort: Hamburg City
Beiträge: 67
Lightbulb MIDI + Flash: Howto

Moin!

Ich habe gerade ein Video und mein MIDI Gateway (code, as3) online gestellt.

Anbei ein Beispiel für einen Multitouch step-sequencer; über die musikalische Qualität lässt sich streiten aber darum geht es ja auch nicht... Der Spaß stand im Vordergrund.

Sending MIDI with Flash: MIDI Matrix thirtyOne developer blog


Für alle die sich fragen wie sie mit AS3 MIDI Signale senden können..


"You basically send OSC packets to a XML Socket Server. The FLOSC socket server has a output port that transforms the XML/OSC messages back to MIDI. I use a app called “Occam” for the MIDI transformation. (mac only)"

PHP-Code:

package com
.thirtyOne.core{

    
import flash.display.*;
    
import flash.events.*;
    
import org.fwiidom.osc.*;
    
import caurina.transitions.Tweener;

    public class 
MIDIGateway {
        private var 
oscConn:OSCConnection;
        private static const 
STR_LOCAL_IP:String="ZION.local";
        private static const 
STR_REMOTE_IP:String="ZION.local";
        private static const 
NUM_PORT:Number=6666;

        public function 
init() {
            
//Initialize connection to the FLOSC server
            
oscConn=new OSCConnection(STR_LOCAL_IP,NUM_PORT);
            
oscConn.addEventListener(OSCConnectionEvent.ON_CONNECT,onConnect);
            
oscConn.addEventListener(OSCConnectionEvent.ON_CONNECT_ERROR,onConnectError);
            
oscConn.addEventListener(OSCConnectionEvent.ON_CLOSE,onClose);
            
oscConn.connect();
        }

        private function 
onConnect(evtEvent:OSCConnectionEvent):void {
            
trace("MIDI MODULE CONNECTED.");
        }

        private function 
onConnectError(evtEvent:OSCConnectionEvent):void {
            
trace("ERROR");
        }

        private function 
onClose(evtEvent:OSCConnectionEvent):void {
            
trace("CONNECTION TO SERVER CLOSED.");
        }

        public function 
sendMIDI(_note:uint,_velocity:uint):void {
            
//Send the actual OSC packet
            ///osc/midi/out/noteOnchannel (int)key (int)velocity (int)

            
oscConn.sendOSCPacket(new OSCPacket("/osc/midi/out/noteOn",[1,_note+"",_velocity+""],STR_REMOTE_IP,57117));
            
Tweener.addTween(new Sprite(), {alpha:1time:.1onComplete:function():void
                
{
                    
// KILL MIDI NOTE:
                   
oscConn.sendOSCPacket(new OSCPacket("/osc/midi/out/noteOff",[1,_note+"",_velocity+""],STR_REMOTE_IP,57117));
               }});

        }

    }


Grüße kame
__________________
www.thirtyonefps.com
derChiller ist offline   Mit Zitat antworten