Pode's Forum Posts

  • JohnnySix : if I have the time, I'll add the frequencies separation in the Flash code (in JS, it would be too slow for the moment, without a native FFT).

    Sheepy : in the next build, I'm going to add a "microphone level" property, to let people use the microphone like in Zelda, like you describe.

    It should work in mobile browsers supporting Flash, but I think that means only Android now. Since I don't have a Android device, people need to test and tell me.

  • Ubivis : you can, for example, let a player speak his name in front of the mic, and add it to his profile <img src="smileys/smiley2.gif" border="0" align="middle" />.

  • Joannesalfa : I didn't played Mage Gauntlet on iOS, but it's known for that kind of mechanism (perhaps you played it yourself, and it's given you the idea ? <img src="smileys/smiley2.gif" border="0" align="middle" />).

    I would do it like that :

    • every X milliseconds, set a "Starting Point" var as the current (Touch.X, Touch.Y)
    • X milliseconds, check the new (Touch.X1, Touch.Y1)
    • do a check :

    IF ((X1-X) > threshold, (X1-X) > 0, AND (Y1-Y) < variationOnAxis),

    THEN Move 10 pixels to the right.

    IF ((X1-X) < threshold, (X1-X) < 0, AND (Y1-Y) < variationOnAxis),

    THEN Move 10 pixels to the left.

    IF ((X1-X) < variationOnAxis, AND (Y1-Y) > threshold, (Y1-X) > 0),

    THEN Move 10 pixels to the bottom.

    IF ((X1-X) < variationOnAxis, AND (Y1-Y) < threshold, (Y1-X) < 0),

    THEN Move 10 pixels to the top.

    The idea is to 1) set a variation on the vertical or horizontal axis that allows the player to draw lines that aren't "exactly" vertical or horizontal, and 2) check if his finger has moved farther than a pre-determined threshold in one of those direction.

  • Nobody tested it yet ? It's easier for me to erase bugs if people test the plugins on their own config...

  • Animmaniac : in the HTML5 draft, it's possible to set a communication channel between an iframe and it's parent via .postMessage() queues.

  • AJTilley : that's exactly the aim of the .exe wrapper ! <img src="smileys/smiley2.gif" border="0" align="middle" />

  • bjadams : I'm out of town for two weeks (holidays). I still read the forum, but I'm only going to be able to fix the code in two weeks, sorry.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • TL;DR : here's a plugin to access the microphone via Flash, encode the WAV in MP3 or OGG, and it gives you back a base64 string that represent the audio file.

    <img src="https://dl.dropbox.com/u/1412774/MicrophoneC2Demo2/demo.png" border="0">

    In the HTML5 draft, the browsers vendors are planning the use of the Microphone device.

    On some systems and builds, you can even use it in conjunction with the webcam via getUserMedia(). However, there's no build anywhere to use the Local Stream Media to grab the audio from the microphone, and inject it inside an <audio> tag. Even if that code would exist, there's no realistic way to compress that audo in MP3 or OGG in Javascript for the moment.

    However, we can hope that in two or three years from now, that the HTML5 spec would be advanced enough to allow that.

    For the moment, here's a plugin that uses a Flash fallback to grab the Mic, and compress the WAV to MP3 and OGG.

    Once that audio is recorded, you can insert it as a base64 string with the Base64 Audio plugin : http://www.scirra.com/forum/plugin-base64-audio_topic52192_post328265.html#328265.

    The OGG encoder is modded to avoid a full memory clear and reload between each encoding, the MP3 encoder still need to reload itself between each encoding. That means the MP3 encoding part is usually faster than the OGG encoding on the first encoding, but it's slower on the following encoding.

    I need to change the Shine encoder, however the change is heavier, because I need to have a proper Alchemy-encoding gcc installed, and it's not simple...

    To do its job, the Flash part of the plugin display a Security Panel to allow the access to the microphone. That panel is shown and hidden when you need it. (On the HTML side, to hide the panel, I just set the width & height to 1 pixel, because a truly hidden div with a Flash inside won't execute any Flash if it's hidden). To avoid the "dead pixel" effect of that 1 pixel wide div when you want it hidden, you can set the color background of that div, to let it better blend inside your game.

    Since I didn't have the time to add a check to get the proper name of the browser, you need to encode the MP3 or OGG accordingly to the browser brand (Firefox won't play a MP3, Chrome will play both, Opera won't play OGG, and so on...).

    The encoding code is done in Flash, I used the Alchemy tool to accelerate some code to the maximum. It's not native speed, but it's way faster than "simple" Flash, or Javascript. The encoding is asynchronous, so you can do other things while it's done.

    The code of the encoder is going to be published on GitHub, to let you be sure that the code can be trusted (I'll publish everything back from my holidays).

    The MP3 encoder is the Shine MP3 encoder ported to Flash, and the OGG encoder is from there : http://labs.byhook.com/2011/02/15/ogg-vorbis-encoder-for-flash-alchemy-series-part-1/

    The demo : https://dl.dropbox.com/u/1412774/MicrophoneC2Demo2/index.html

    The .zip : https://dl.dropbox.com/u/1412774/MicrophoneC2Demo2/pode_microphone.1.0.zip

    The .capx : https://dl.dropbox.com/u/1412774/MicrophoneC2Demo2/MicrophoneC2Demo2.capx

  • Update : new version added to the first post.

  • : BinaryJS is useful when you want to send & receive data from/to a server directly using bytes, and not a JSON representation (that last one means that each binary information must be transcoded in its textual representation, adding lots of overhead). Apart from that, once it has been received, you need to transform it into something useful to be displayed by the browser (either an image, an audio file, or a javascript code string). Since you need to transform it into the browser to use it, all your client can access the "unencrypted" data anyway...

  • puoidirloatutti : I was talking about ajax, to know the pattern of the "random php function" you are using.

  • Joannesalfa : if you want to affect other object's image, you need to use a plugin or behavior, so it's going to be a behavior... <img src="smileys/smiley2.gif" border="0" align="middle" />.

    andreyin : yes, it's CPU heavy, but I can use some tricks to accelerate it a bit...

  • C2 is unstable when it has a lot of opened tabs at the same time. I was doing a game with 50 layouts, and got the problem. Close all the layout you aren't currently working on...

  • puoidirloatutti : I think you need to do an Ajax GET request on the server before trying to display something, to know the random number. After that, you can create a string using that number with the basic C2's functions, and inject that in the iframe.

  • megatronx : yeas, I also maintain an <iframe> plugin <img src="smileys/smiley2.gif" border="0" align="middle" />.