Updates from admin RSS

  • How to enable reverb in FMOD iOS

    Ellen 19:40 on May 5, 2013 | 0 Permalink | Reply
    Tags: , iOS

    To enable reverb settings in Fmod Designer click on “Window” > “Reverb Defs”. Select your reverb and click on the play button. The reverb is now active and the project can be built. Notice that for the time being Fmod Designer requires you to always activate this whenever you open your project. This is not done automatically. The name of your reverb, in this case “Reverb00″ is used later on in the code.

    Fmod_designer

    To activate the reverb in the code the follow code needs to be added:

    #import "SoundManager.h"
    #import "mySoundProject.h"
    @implementation SoundManager
    void ERRCHECK(FMOD_RESULT result)
    {
        if (result != FMOD_OK)
        {
            //fprintf(stderr, "FMOD error! (%d) %s\n", result, FMOD_ErrorString(result));
            exit(-1);
        }
    }
    - (id)initWithString:(NSString*)selectedProfile
    {
    system  = NULL;
        eventSystem = NULL;
     
        FMOD_RESULT result      = FMOD_OK;
        char        buffer[200] = {0};
        FMOD_REVERB_PROPERTIES reverb00;
       
        result = FMOD::EventSystem_Create(&eventSystem);
        ERRCHECK(result);
       
        result = eventSystem->init(32, FMOD_INIT_NORMAL | FMOD_INIT_ENABLE_PROFILE  | FMOD_INIT_DISTANCE_FILTERING, NULL, FMOD_EVENT_INIT_NORMAL);
        ERRCHECK(result);
        [[NSString stringWithFormat:@"%@/mySoundProject.fev", [[NSBundle mainBundle] resourcePath]] getCString:buffer maxLength:200 encoding:NSASCIIStringEncoding];
        result = eventSystem->load(buffer, NULL, NULL);
        ERRCHECK(result);
       
        result = eventSystem->getReverbPreset("REVERB00", &reverb00); // Same name as in Fmod Designer.
        ERRCHECK(result);
       
        result = eventSystem->setReverbProperties(&reverb00);
        ERRCHECK(result);
       
        result = eventSystem->getGroup("MySoundProject/MySoundProject", FMOD_EVENT_DEFAULT, &group);
        ERRCHECK(result);

  • Send OSC messages from Unity

    Ellen 11:30 on January 31, 2013 | 1 Permalink | Reply

    Many people wrote to me wondering how to send data from Unity through OSC back to Processing and other applications. Well the answer is simple, write the following code:

    oscListener.oscHandler.Send(Osc.StringToOscMessage(”/Your event name”));

  • Real time blend 2 textures in Unity

    Ellen 08:40 on September 6, 2012 | 3 Permalink | Reply
    Tags: , shaders,

    I had a hard time changing the texture of a game object in real-time where I tried out a movie fading between textures and using Lerp on the material. I wanted it to be dynamic and just be able to pass an argument to my script defining which texture to animate to. Many game objects had different shaders so it didn’t work just to Lerp the current material. So I create custom shaders for different objects that contained 2 textures “_MainTex” and “_Texture2″. I also added the blend option the the shader order to be able to control the blend of the texture from outside. Just adding the shader you can change the blend slider to see the result.

    See example of one diffuse shader with normal map.

    In my javascript I could then pass in which texture to change to and which one to change from.
    I set the textures I want to change between. These are set in the inspector of athouring environment of Unity and passed to the script.

    var firstTexture:Texture;
    var secondTexture:Texture;
    var thirdTexture:Texture;

    The script starts out with setting the default texture of the chosen game object. The game object could have been passed to the script as well. :-)

    function Start () {
        textureObject = gameObject.Find("myTextureObject");
        textureObject.renderer.material.SetFloat( "_Blend", 1 ); // Setting the current texture to be 100% visible
    }

    The public function changeTexture can be accessed from outside to recieve arguments for new textures. newTexture is used to store the new texture as soon as it is time to animate.

    public function changeTexture(myArg : float) {
      yield WaitForSeconds(0.3);

      if(myArg == 1) {
          newTexture = firstTexture;
      } else if (myArg == 2){
          newTexture = secondTexture;
      } else if (myArg == 3){
          newTexture = thirdTexture;
      }

      textureObject.renderer.material.mainTexture = newTexture;
      triggerChange = true;
    }

    In the update function the script always checks if it should change to a new texture. If changeTexture was called it starts blending to the new texture. At the end it sets the old texture to the new one and resets the blend:

    function Update () {
         if(triggerChange == true) {
              changeCount = changeCount - 0.05;

              textureObject.renderer.material.SetFloat( "_Blend", changeCount );
              if(changeCount <= 0) {
                   triggerChange = false;
                   changeCount = 1.0;
                   textureObject.renderer.material.SetTexture ("_Texture2", newTexture);
                   textureObject.renderer.material.SetFloat( "_Blend", 1);
              }

         }
    }

    BlendTextures.js is the entire javascript file of the script above.

    To implement this in Unity follow these steps:
    1. Add your script to the scene. Select the textures and normalmap you defined as public variables in BlendTextures.js.
    2. Create a material and choose your custom shader.
    3. Add the material to your game object.

    blend_textures_unity

    Read up on how to create your custom shaders in the Unity Documentation.

  • Unity + Processing Demo

    Ellen 10:11 on July 2, 2012 | 4 Permalink | Reply
    Tags: osc, , ,

    Test your Unity project with the Processing Osc Demo. Send your events through the Processing app and see them appear in the Unity project. There is also a timer in Processing sending events at all time changing the width of a cube in Unity. Download the Unity OSC example here.
    unity_processing_demo

  • Heavy duty pull sensors

    Ellen 18:21 on June 25, 2012 | 0 Permalink | Reply
    Tags: , , ,

    Interacting with installations with a long life time we turn to heavy duty sensors that can handle a lot of cycles. The string and pull sensors below can handle more than a million cycles and are built for industrial use. They can also be connected to circuit board like Arduino.

    Check out all the pull sensors and string pots from Celesco. Novotechnik also offers a wide range of pull sensors.

    Check out this Processing and Arduino project by nhw3030 with Celesco string sensors.

  • Unity + Processing + Arduino

    Ellen 10:32 on May 31, 2012 | 14 Permalink | Reply
    Tags: , , , ,

    I did a test connecting Arduino and Unity with the help of Processing and a Open Sound Control library. When I am pushing the Flexi Force sensor the values affect a cube within Unity. To get this setup do the following:

    Arduino
    Load the Standard Firmdata on to your Arduino. Check out a full Arduino + Processing tutorial to get the setup.

    Processing
    Download the oscP5 processing library and put it in your Processing sketch folder in the folder libraries.

    Initialize oscP5 library and broadcast data to port 12000. The port Unity will listen to.
    Add the remote location to listen to on port 3200. If Unity would broadcast event in this example, the broadcast port would be set to 3200. Initialise Arduino to be used later on.

    oscP5 = new OscP5(this,12000);
      myRemoteLocation = new NetAddress("127.0.0.1",3200);
      arduino = new Arduino(this, Arduino.list()[0], 57600);

    In the draw function we read the analoge pin 0 to get sensor values from the Flexi Force sensor. Set the OSC message to flexiforce. Unity will listen to this label. Add the message of the sensor value into the osc message with add method. This method can take numbers, strings and byte data.

    float flexiforceSensor = arduino.analogRead(0);
    OscMessage oscMess = new OscMessage("/flexiforce");
    oscMess.add(flexiforceSensor);

    oscP5.send(oscMess, myRemoteLocation);

    The entire Processing sketch can be seen here.

    Unity
    In Unity you can import the Osc.cs and UDPPacketIO.cs to broadcast and listen to UDP data.

    Set up the corresponding host and ports in your Unity script.

    public var OSCHost : String = "127.0.0.1";
    public var SendToPort : int = 3200;
    public var ListenerPort : int = 12000;

    Import the UDPPacketIO and Osc components and feed in the host and ports. Add your specific label of your osc message and what method to call when receiving this event from Processing.

    var udp : UDPPacketIO = GetComponent("UDPPacketIO");
    udp.init(OSCHost, SendToPort, ListenerPort);
           
    handler = GetComponent("Osc");
    handler.init(udp);
    handler.SetAddressHandler("/flexiforce", AffectObject);

    In the receiving method you can print out the label and message values. In this case the sensor value from the Flexi Force. The cube will change width when getting a new value from Processing.

    public function AffectObject(oscMessage : OscMessage) : void
    {      
            Debug.Log("Event name: " + Osc.OscMessageToString(oscMessage));
            Debug.Log("Event data: " + oscMessage.Values[0]);
           
            var myCube = GameObject.Find("Cube");
            var boxWidth:int = 8 - ( oscMessage.Values[0]);
            myCube.transform.localScale = Vector3(boxWidth,5,5);
    }

  • Add app to Facebook page

    Ellen 16:46 on May 30, 2012 | 0 Permalink | Reply
    Tags: , Facebook app,

    If you want to add your app to a Facebook page, you will have to do the following.

    1. Prepare your app

    Make sure your have has valid URLs to point to from the little thumbnail in the Facebook page. Add an image that will be displayed. To fit the image into the area on the Facebook page it needs to be 111 x 74 px.

    add_app_facebook_page

    2. Add the app
    To add the app to the page you need to run the following link:

    https://www.facebook.com/dialog/pagetab?app_id=[APP_ID]&next=[PAGE_TAB_URL]

    The app id can be found https://developers.facebook.com/apps/
    facebook_app_your_app
    3. Add page tab dialog
    The page tab dialog will show all the pages you have admin permissions to.
    add_page_tab_facebook

  • Notes from Facebook Garage in Stockholm

    Ellen 13:40 on May 26, 2012 | 0 Permalink | Reply
    Tags: ,

    facebook_garage_stockholm

    Tagging users
    Application can tag people in updates. Permissions needed.
    The application can add a personal message to the update and also add it after the action was published.

    User generated photos
    It is now possible to post large photos in the news feed even without uploading it to a Facebook album.
    The difference is that the image is uploaded to your own server. The image URL is then passed to the Open Graph together with other optional values like:
    sources – Image URL
    large – If the image should be big (boolean)
    expires_in – How long the post should exist (seconds)
    tags – User ids in array to pass tagged users
    message – Your personal message
    place – Id of Facebook place
    your own actions – Verbs

    Post it to the graph with /me/[namespace_of_app]:your_action

    Download the example application here: https://bitbucket.org/brucehazan/ios-sample-og
    Example includes single sign in with Facebook iOS SDK.

    Add app from Timeline
    If friends are using a Facebook app and a post appears in your news feed and you don’t have the app, you can install the app in a click of a button. The button on the post says “Add app”.
    To enable it put a URL in Profile URL in application settings.

    Publish past on user timeline
    Post past things on the users timeline
    Button to fill out past timeline

    Map Stories
    Specify long and lat on a page can be added in meta tags. Your post can be associated with a location.

    New Feed Aggregations
    The more traffic a post gets it gets highlighted in the news feed.

    Action links on OG Stories
    Accept Diff – Authenticate the application to display application-functionality in the post:
    https://developers.facebook.com/docs/opengraph/actionlinks/

    Permissions
    offline_access – Depreciated
    Valid for 60 days is the only thing that can be used. As long as the user used your app you have 60 days to access the user.

    publish_stream includes publish_actions by default now.

    iOS Deep Linking
    It is possible to deep link into an iOS app from posts of the mobile Facebook app. If the user doesn’t have the app, the user will be directed to the App Store. After installing it the deep link is active.
    This is not new but it just launched for Android.
    To enabled it just check the box of iOS Native Deeplinking in your Application settings.

    Facebook requests
    Facebook requests from Facebook applications can be sent directly to the iOS device linking the user directly to your native iOS app with Facebook integration.

    App Center
    Facebook launched the App Center where all Facebook apps are shown in an App Store-like matter. The apps will show screenshots and rating from users.

  • Geek Girl Meetup in London

    Ellen 15:33 on April 29, 2012 | 0 Permalink | Reply
    Tags: , Geek Girl Meetup 2012, geekgirl,

    Spending the day at Geek Girl Meetup in London. Talked about The Sound of Football and my Arduino projects.

    In the Arduino session I presented my Depressed Shoe Shelf, the bend sensing belt Bad Posture, how to control electronics from the internet using Processing.

    google_campus_society46_680

  • Arduino library for LED Message Display

    Ellen 18:53 on April 15, 2012 | 5 Permalink | Reply
    Tags: , Arduino library, , LED

    Making life a lot easier I wrote an Arduino library that takes care of converting strings and calculating the checksum of all commands sent to the LED Message Display. Compared to the first example of sending text to the display the library can send commands of how long the text should display, how to be animated in and out and display European characters. All included in the BockiMessageBoard library on Github.

    amplus_led_message_display_sundh

    The code below shows how to initiate and send messages:

    #include <BockiMessageBoard.h>

    BockiMessageBoard messageBoard = BockiMessageBoard(0); // 0 is the Id of your message board

    void setup {
          // Configure the display before sending the text.
          int displayTime = 0.5; // Input 0.5 sec or 1 to 25 seconds
          messageBoard.configure(displayTime,SCROLLLEFT,VERTICALCLOSE);
    }

    void loop {
          String euroChars = "Testing with European characters <U45><U44><U76><U65><U64><U61>";
          messageBoard.displayMessage(PAGE_A,euroChars);
    }

    The library generate serial data to the LED Message Display with this setup:

    <ID00><L1><PA><FE><MA><WC><FD>MESSAGE CHECKSUM<E>

    <ID00> - The id of the message board.
    <L1> - Line number
    <PA> - Page id
    <FE> - How the text will appear. Scrolling, twinkeling, snowing…
    <MA> -
    <WC> - Waiting time. How long to display text.
    <FD> - How the text will disappear. Scrolling, twinkeling, snowing…
    MESSAGE - The message text to be displayed
    CHECKSUM - Hex value calculated on all tag sabove.
    <E> - End of data.

    The circuit uses a RJ14 cable to transfer the serial data to the display board:
    ethernet_led_bb

c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
esc
cancel