A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: communication server - microphone

Hybrid View

  1. #1
    I have been directed to this forum because it is possible that the 'microphone' object as part of the communication server may give me the possibility to measure the amplitude of sound inside flash.

    (All of the Flash graphic equalizers either are faked or rely upon a set of variables to be created externally based on amplitude ,by other software or by guessing, and then fed into flash.)

    Director allows this to be done, though I fear that it is not possible inside flash. If anyone has any ideas how this may be acheived please reply.

  2. #2
    Senior Moderator
    Join Date
    Apr 2000
    Location
    Sheffield, UK
    Posts
    3,881
    As you said, you will have to use an external application to create a sequence of variables from a sound file and then load that data into flash for display.

    The Microphone object only has:

    Code:
    mic.activityLevel
    A numeric value that specifies the amount of sound the microphone is detecting. Values range from 0 (no sound is being detected) to 100 (very loud sound is being detected).

  3. #3
    psx = new Moderator();
    Join Date
    Jan 2001
    Posts
    923
    I think I see what it is you want to do, but not sure if it's possible. I'm guessing you want to play some music through the speakers, and have the mic pick it up, so that you can use the activityLevel to adjust some visual on the screen?

    I tried to get it to work but had some weird issues:

    I made a new mc, just a box, called it box_mc.
    Then on the first frame of the main timeline I had something like this:

    myMic = Microphone.get();

    _root.onEnterFrame = function() {
    box_mc._yscale = myMic.activityLevel;
    }

    BUT --- it doesn't work correctly. To get it to do anything at all, I had to add one more line:

    box_mc.attachAudio(myMic);

    but this is no good because it plays the audio back through the speakers causing feedback.

    Seems it's possible though, since the videoconference stuff with fcs is able to broadcast your audio without you hearing it.

    Another weirdness - first time I tried it, I thought maybe I had the wrong mic chosen in the settings, so when I opened the menu to check it started working, but only while the menu was open.



    Ok --- fought with it for a long time, and finally found an ugly solution:
    Code:
    myMic = Microphone.get();
    
    nc = new NetConnection();
    nc.connect("rtmp://mySvr.myDomain.com/App");
    ns = new NetStream(nc);  
    ns.attachAudio(myMic); 
    
    
    _root.onEnterFrame = function() {
    box_mc._yscale = myMic.activityLevel;
    
    }
    Seems it needs a fake nc to work? Ah well. it works. Hope that was what you were looking for!

    Psx


  4. #4
    Hi Psx

    Thanks for your answer... It is infact not quite what I wanted to do. All I simply want to do it find the volume (amplitude) of music that has already been loaded inside flash... without loading external variables or trying to generate the variables outside flash.

    The reason why the mic object is interesting is because it may be the only way to do this, I would using the mic object without a mic, so try and trick it or bypass it and simply measure the volumn being generated from the music inside flash.

    Back to your work with working with the microphone and speakers... that it really fascinating.... you could use the mic... not just to record levels... but as a navigation device (like a joy stick)... the nearer it is to the speakers, the higher the volume.... and you use the volume and a variable for navigation (perhaps through a soundscape). Forward back... left and right.

    Thanks FlashGuru.

    Cheers
    Disco.

  5. #5
    psx = new Moderator();
    Join Date
    Jan 2001
    Posts
    923
    Hey -
    I messed around some more - what I found is that it needs a real host in the netConnection. So it was actually trying to connect to "mySvr.myDomain.com". wouldn't work otherwise. It doesn't need a flashcom host, just a response I guess. Weird.

    Yeah - I like the soundscape idea, you could do some fun stuff with it - the feedback is weird, and gets really bad if you aren't careful. Would be cool to turn the feedback on and off, or to adjust it somehow, and get cool echo effects by playing short sounds that the mic can pick up, and then shutting it down before it gets too loud...have to mess with it sometime.

    psx

  6. #6
    Junior Member
    Join Date
    Oct 2002
    Location
    malaysia
    Posts
    4
    so we just can get the volume from the mic.
    can we get the the different frequency?
    i just wonder...the possiblity..:>

  7. #7
    Arckid - Curving the Web
    Join Date
    Dec 2000
    Location
    India
    Posts
    1,412
    look at this: arcMicGraph
    Ashvin Savani (Arckid)

    CEO & Founder, Avinashi Systems Pvt. Ltd.
    Team Macromedian
    Avinashi Videomail - My latest work

  8. #8
    Senior Member LeoBeer's Avatar
    Join Date
    May 2002
    Posts
    315
    Hi guys

    Did you figure out a way to do what Disco is trying ?
    I need to do the same thing ASAP, please tell me if you have a solution.

    Thanks,
    LeoBeer

  9. #9
    You can prevent the sound fomr coming back out the speakers

    createEmptyMovieClip("micAudio", 3);
    micAudio.attachAudio(Microphone.get());
    inputMic = Microphone.get();
    inputMic.setUseEchoSuppression(1);
    inputMic.setRate(44);
    inputMic.setSilenceLevel(0);
    inputMic.setGain(20);

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center