Microphone bytearray mix and replay

Hello i need your help
I have an application with microphone record and i mix another sound from song. For this step is ok i can save to my desktop and the mix is good.
But i would like to play my mix from bytearray. And is there i have a problem.
The sound is very slow....... and not same that my file save.
My code:
var epos:Number=0
//ByteArray in which the microphone sound data is stored
var soundBytes:ByteArray = new ByteArray();
//Gets your default microphone
var mic:Microphone = Microphone.getMicrophone();
Security.showSettings("microphone");
function init(){
    //Sets the minimum input level that should be considered sound
    mic.setSilenceLevel(0);
    //The amount by which the microphone boosts the signal.
    mic.gain = 50;
    //The rate at which the microphone is capturing sound, in kHz.
    mic.rate = 44;
//function called when start Record button is clicked
function startRecord():void
    mic.addEventListener(SampleDataEvent.SAMPLE_DATA, micSampleDataHandler);
//function called when stop Record button is clicked
function stopRecord():void
    mic.removeEventListener(SampleDataEvent.SAMPLE_DATA, micSampleDataHandler);
function micSampleDataHandler(event:SampleDataEvent):void
    var temp:ByteArray=new ByteArray()
    var mdata:ByteArray=event.data
    var l:Number=mdata.bytesAvailable
    sound_kar.extract(temp,l/4,epos);   
    temp.position=0
    var b:Number=temp.bytesAvailable
    epos+=l/4
    var s1,s2,s3:Number
    while (mdata.bytesAvailable)
        s3= mdata.readFloat();
        s1=0
        s2=0
        if(temp.bytesAvailable>=8){
        s1=temp.readFloat()
        s2=temp.readFloat()
        mixTracks(s1,s2,s3);
function mixTracks(l:Number,r:Number,m:Number):void
    //the function which mixes the microphone audio with background audio...
    var sampleT1_L:Number;
    var sampleT1_R:Number;
    var sampleT2:Number;
    var trackL:Number;
    var trackR:Number;
    sampleT1_L = l;
    sampleT1_R = r;
    sampleT2 = m;
    trackL = (sampleT1_L + sampleT2);
    trackR = (sampleT1_R + sampleT2);
    trackL = trackL > 1 ? 1:trackL;
    trackR = trackR > 1 ? 1:trackR;
    trackL = trackL < -1 ? -1:trackL;
    trackR = trackR < -1 ? -1:trackR;
    mixedTrack.writeFloat(trackL);
    mixedTrack.writeFloat(trackR);
For replay mix:
mixedTrack.position = 0;
soundPlay.addEventListener(SampleDataEvent.SAMPLE_DATA, playbackSampleHandler);
channelPlay = soundPlay.play();
function playbackSampleHandler(event:SampleDataEvent):void
    if (!mixedTrack.bytesAvailable > 0)//if end; return   
        return;   
    for (var i:int = 0; i < 8192/(44/44); i++){   
            var sample:Number = 0;   
                if (mixedTrack.bytesAvailable > 0)    
                    sample = mixedTrack.readFloat();   
                //write sample, i.e., play   
                for(var j:int=0; j<int((44.0/44)*2);j++){//4 for 22 khz?for 8khz   
                    event.data.writeFloat(sample);   
Can you help me to replay my mix in bytearray?
Thanks a lot
Oeann

hello i really need your help and excuse me for my english... i speak french..
i change my function
function playbackSampleHandler(event:SampleDataEvent):void
    for (var i:int = 0; i < 8192 && mixedTrack.bytesAvailable > 0; i++)
                      var sample:Number = mixedTrack.readFloat();
                      event.data.writeFloat(sample);
                      event.data.writeFloat(sample);
the sound play is very slowly......
can  you help me and tell me what i doing wrong?
Thanks again

Similar Messages

  • No microphone while mix

    I can't seem to get volume through front or rear mic jacks when I'm mixing li've on the net. People saying? they hear the music fine but my voice is very low. I have mic volume all the way up but no change in volume. I tried recording voice in what you here mode and in microphone mode, no change. The meter is moving in the control panel showing my voice is detected but it is not being heard over the net. Even my smart recorder meter is showing movement but still I get complaints of low mic volume. I have creative soundblaster x-fi extreme music SBO 730 witch is a oem preinstalled card but seems to respond to the new vista drivers for x-fi. Only the mic issue is my problem. I run a nvidia 680i SL chipset with a ECS PN2 SL+ motherboard powerd by a Intel 2 quad Q6600(2.4ghz 8mg cache 066 mhz fsb). Running on vista 32 bit os. I'd like to use the front or top mounted mic and speaker jacks opposed to the rear sound card jacks but will take which ever I can get to work. If you dj and have mic problems please respond. If you had mic?output issues please respond Thank you.

    I would like you to try the following.
    Click Start, type "Device Manager," and press Enter.
    Expand the "Sound, video, and game controllers" section.
    Right click on your audio device and select "Uninstall."  Remove driver only if prompted.
    Close these windows.
    Click Start, type "uninstall a program," and press Enter.
    Find Skype on this list and uninstall it.
    Reboot your notebook.  When Windows starts it should automatically re-install your audio driver.
    After the installation is complete you will want to install Skype.  Here is a link to the latest version.  
    When Skype is installed go to the audio settings once again and verify that your microphone is selected and the volume is set to max.
    Use Skype and verify whether or not your microphone is working.
    Post the result.
    I will await your response to see if this resolves your issue.  I hope you have a great day
    Please click the white star under my name to give me Kudos as a way to say "Thanks!"
    Click the "Accept as Solution" button if I resolve your issue.

  • [G50-45] stereo mix and mic

    I was able to get stereo mix working on my G50-45 with conexant smartaudio HD card using instructions found here .  The issue i have is that while it picks up sound files playing on my computer it wont pick up the microphone.  If I disable stereo mix and choose mic as default recording device it works fine.   Any ideas on how to get stereo mix and mic working at same time?
    Moderator comment: Subject edit. Model added.

    Hi curiousgeorge,
    Welcome to Lenovo Community Forums!
    Try setting it up as the Stereo mix is the default Recording Device but do not disable the the MIC.
         Rightclick on the Mic and select properties, go to Listen TAB, place  a check under Listen to this device and select the speaker or Headphone as default playback.
    Try this and see if that works.
    Regards
    Solid Cruver

  • USB mixer and Logic Studios

    I am curious how Logic Studios would see a USB mixer. Does it see the entire mixer as one input or each channel on the mixer separately. For example, if I used a regular mixer and hooked it into the microphone jack, everything coming from that mixer would be one single signal. Does a USB mixer work the same way, or does the software see each channel separately. For example, could I put an effect on only one channel without effecting the others? I am slowly piecing together a little mini recording studio and this would help me determine whether it is worth the extra money to get a USB mixer. Does a USB mixer off any other benefits over a regular mixer?

    Hi,
    Which mixer are looking to use?
    Have you read that mixers' manual yet?
    That more than anything in this forum, will answer your question.
    Cheers

  • Using Logic 9 with mixer and audio line in on Mac Book Pro.

    Hello, I Just began studio recording, and am making the switch from garage band to logic 9.
    I do not know how to make my instruments play through logic 9 using a mixer and a Line In connection to the mac like I could with garage band.
    Please scroll down to the bold underline text for tl;dr
    I am self taught, and never thought I would love working with sound, and I spent over a year touring the US doing live sound for concerts and am now helping out with live studio recordings, and projects on my own.
    It started as something to do to fight boredom and to help, basically making sure nobody touched the mixer or to unplug it if things caught on fire.
    By the end of the year I had been helping "Others" with live sound, and I learned a lot about the features and trims on the analog mixer that are more complex than "mixing the volume of each track" lol.
    So please be patient with me. I do not know many of the terms, I just "feel" when something is not right and know where to go to in order to fix it or make it better, I dont have much practice when it comes to the technical side with computers and sound.
    so I will try my best to understand your help. 
    Anyway's, I looked up online, and I cannot figure out how to get logic 9 to playback instruments set up on my mixer.
    I currently have Male L/R 1/4inch to 8th Inch cables coming from main into the Line In port on the mac.
    I know this setup is called "stereo" (I think?) and Im limited with only two separate tracks to record, so I have my selected tracks panned right and left for two separate inputs on the program.
    I know everything works because I had it all setup on garage band, I changed nothing for logic, but all I can find are MIDI tutorials and I am using analog to line in, not MIDI.
    Please let me know what I have to do to bring up two separate tracks, and also be able to hear them wile I play before recording.

    Kudos to figuring it out yourself.
    Yes, Logic is geared to the professional user, you will need to set up the program to your particular way of working, Logic was well developed for professional use long before Apple purchased it, it's not an Apple program per se. It's complex and offers a myriad number of choices so that it can be configured to many styles of working, there's often 3 or 4 ways to perform the same function.
    Logic insists the user educate themselves... which is a good thing.
    Here ya go! 
    http://documentation.apple.com/en/logicpro/
    "Exploring Logic Pro" is a good one to start with.
    Also in the main manual... "Setting Up Your System"

  • Trouble with mediasource mixer and equali

    I have tried to start the mixer and equalizer and get the following messege "unable to change sound device to your selected device." All was working just fine yesterday. Also, I was unable to configure the speaker setup. I had to go to the audio setup and change the speaker setup from desktop to 5.. For some reason it reverted back to desktop.
    I have an Audigy 2ZS.

    Yes, just checked the Presonus release notes for Universal Control 1.7.2 (the latest), and it has removed support for Snow Leopard (OSX10.6.8), so that may be a possible source of the problem - might be worth contacting Presonus Tech support to confirm.
    You could update your OSX, but I'd be a bit careful there - not sure if Mavericks supports Logic 8.  If not, I believe there are places where you can still get hold of Mountain Lion (which is supported by UC1.7.2) - a quick net search should do the trick.
    Also, I've just re-read your post and notice you ask about the start up order.  The Presonus manual says to switch the desk on first, then fire up the computer.  This used to work with me, but I've recently updated to a new Macbook Pro and had to start using a firewire to thunderbolt connector, and I found that I could now only get the Studiolive to show up in Logic if I start the computer first, then fire up the desk then open Logic.  I raised a tech support ticket with Presonus and they were baffled by this, and couldn't see any reason why it should be, but nonetheless, it's the only way it'll work for me, so probably worth giving it a shot.

  • Adding Pause and Replay Buttons

    Ok here is my script for an external XML loading Flash
    Gallery...
    1. How do I add a "constant" Pause and Replay on this?
    2. Every time I add something to the stage the "fade effect"
    affects that too!
    Thanks in advance.
    delay = 5000;
    function loadXML(loaded) {
    if (loaded) {
    xmlNode = this.firstChild;
    image = [];
    description = [];
    total = xmlNode.childNodes.length;
    for (i=0; i<total; i++) {
    image
    = xmlNode.childNodes.childNodes[0].firstChild.nodeValue;
    description
    = xmlNode.childNodes.childNodes[1].firstChild.nodeValue;
    id = setInterval(preloadPic, 100);
    } else {
    content = "file not loaded!";
    xmlData = new XML();
    xmlData.ignoreWhite = true;
    xmlData.onLoad = loadXML;
    xmlData.load("images.xml");
    var loadTot = 0;
    var k = 0;
    function preloadPic() {
    clearInterval(id);
    var con = picture.duplicateMovieClip("con"+k, 9984+k);
    con.loadMovie(image[k]);
    var temp = _root.createEmptyMovieClip("temp"+k, 99+k);
    temp.onEnterFrame = function() {
    var total = con.getBytesTotal();
    var loaded = con.getBytesLoaded();
    percent = Math.round((loaded/total*100)/image.length);
    preloader.preload_bar._xscale = loadTot+percent;
    info.text = "Loading picture "+k+" of "+image.length+"
    total";
    if (loaded == total && total>4) {
    con._visible = 0;
    nextPic();
    loadTot += percent;
    delete this.onEnterFrame;
    function nextPic() {
    if (k<image.length-1) {
    k++;
    preloadPic();
    else {
    firstImage();
    preloader._visible = 0;
    info.text = "";
    listen = new Object();
    listen.onKeyDown = function() {
    if (Key.getCode() == Key.LEFT) {
    prevImage();
    } else if (Key.getCode() == Key.RIGHT) {
    nextImage();
    Key.addListener(listen);
    previous_btn.onRelease = function() {
    prevImage();
    next_btn.onRelease = function() {
    nextImage();
    var p = 0;
    var current;
    MovieClip.prototype.fadeIn = function() {
    if (this._alpha<100) {
    current._alpha -= 5;
    this._alpha += 5;
    } else {
    current._visible = 0;
    delete this.onEnterFrame;
    function nextImage() {
    if(p<(total-1)){
    current = this["con"+p];
    p++;
    var picture = this["con"+p];
    picture._visible = 1;
    picture._alpha = 0;
    picture.onEnterFrame = fadeIn;
    desc_txt.text = description[p];
    picture_num();
    slideshow();
    if (isPaused == true) {
    current = this["con"+p];
    p<total-1 ? p++ : p=0;
    preloadPic();
    function prevImage() {
    if (p>0){
    current = this["con"+p];
    p--;
    var picture = this["con"+p];
    picture._visible = 1;
    picture._alpha = 0;
    picture.onEnterFrame = fadeIn;
    desc_txt.text = description[p];
    picture_num();
    function firstImage() {
    con0._visible = 1;
    con0._alpha = 0;
    con0.onEnterFrame = fadeIn;
    desc_txt.text = description[0];
    picture_num();
    slideshow();
    function picture_num() {
    current_pos = p+1;
    pos_txt.text = current_pos+" / "+total;
    function slideshow() {
    myInterval = setInterval(pause_slideshow, delay);
    function pause_slideshow() {
    clearInterval(myInterval);
    if (p == (total-1)) {
    //Resetting...fadeout=300 milliseconds.
    endFadeOut = setInterval(fadeOut, 300);
    //Try using a movie clip called restart_mc that is a button
    _root.attachMovie("restart_mc");
    } else {
    nextImage();
    Here is the Source Files:
    Download the
    Sources

    anyone?

  • Interface to go between mixer and computer.

    I'm looking for something to hook up between my mixer and my computer so I can record at least 2 separate tracks at one time in GB.
    Anyone have an idea of what I'm looking for?
    PB G4 Ti   Mac OS X (10.4.6)  

    If all you want is 2 tracks at once, then the mixer will do that as described, or a 2 channel interface will do that ALONE, and the mixer wouldn't be needed. I see no reason to connect the mixer to an interface to get 2 separate tracks. Using the mixer in this way WOULD be desirable if you were wanting to get a stereo mix of a drum kit, for example. Then you could pan the drums where you like and have 2 tracks of the drums in stereo, but that doesn't sound like what you are saying. If you simple want 2 separate tracks, then either will do fine. Both are not necessary.

  • How does mix and match works in ECC6.0?

    How does mix and match works in ECC 6.0?
    Can some shared on this topic?
    Thanks in advance

    It;s a term used in Retail for combination of sales item eg buy 3 get 1 any other  @ xx price.

  • I used to have eight genius mixes and now I have four...I changed the genres around and nothing happened...I've added many more songs since it changed from 8 to 4 mixes...how can I get more again and why did it go from 8 to 4?

    I used to have eight genius mixes and now I have four...I changed the genres around and nothing happened...I've added many more songs since it changed from 8 to 4 mixes...how can I get more again and why did it go from 8 to 4? I had the Hardcore mix and a rap mix and classic rock and grunge mixes...now I don't...I kinda want those back...the mixes I have now make no sense as most the songs on each do not correlate AT ALL to the genre mix they have been placed in. If someone could give me an answer that'd be great.

    1. Don't confuse "Apple ID" with iTunes Account ID.  You can have many Apple IDs but only one iTunes account active at a time.
    2. If you "changed" your iTunes account ID, you actually have 2 accounts - one under the old name plus the new name.
    3. You can't merge the accounts - they remain separate.  Apps purcahsed under the old account name will update ONLY WHEN THE PHONE IS SIGNED IN TO THE OLD ACCOUNT NAME  and visa versa.
    4. Likewise, you can sync only the apps, music, media purchased under the account the phone AND iTunes are signed in to.

  • Logic 10.1 for a specific project; there is no mixer and the display is completely erratic.

    Logic 10.1 for a specific project; there is no mixer and the display is completely erratic.  For other projects it's working for now.  Please help

    Try this Safari5.1 from the installer package
    http://www.filefactory.com/file/cc9005d/n/Safari.pkg.zip
    The download worked better with Firefox not sure why. At the bottom of the page after the captcha>> slow down load is the Free link,  it took about 4 minutes to download on my test.

  • Mixing and Matering with Logics Audio Effects Plugins

    I have a general question for those using Logic Pro to mix and perhaps master music. I've had the software for approximately a year-and-a-half. In that time I've auditioned several high-end, third-party, native AU plugins for EQ and compression (Waves SSL, PSP, Sonalksis, etc.) Certainly they sound great. But in the end, I often find myself getting just as good a sound with Logic's own plugs after a little bit of work. It's not as quick, mind you - and you really do have to play to get to know the plugins well because they're capable of some horrible sounds too. But the good stuff is in there.
    I see Logic's EQ's and compressors trashed sometimes in forums and I'm wondering if I'm missing something. Yes, I'm familiar with UAD and the quality/authenticity of their emulations. But at the end of the day, all I need is a great sound - not a particular historic sound, as good as some of those may be.
    The one thing I haven't been able to hear is Focusrite's Liquid Mix and I'm tempted to buy one just to hear it, with, of course the option to return it if it's nothing special.
    So here's what I want to know - and I am just curious. Are any of you out there mixing in the box with just Logic's plugins and really getting great results? Or perhaps mixing with mostly Logic plugins and a few indispensible others (L1 comes to mind). If so, are you mixing pop/rock, R&B, acoustic - basically, something other than electronic/dance?
    Thanks

    Are any of you out there mixing in the box with just Logic's plugins and really getting great results? Or perhaps mixing with mostly Logic plugins and a few indispensible others
    My 'indispensible others' would be Izotope's Ozone, PSP Vintage Warmer and to a lesser extent TriTone's ColorTone Pro.
    But in the end, I often find myself getting just as good a sound with Logic's own plugs after a little bit of work. It's not as quick, mind you - and you really do have to play to get to know the plugins well
    I agree completely. I'm often reading here that this plug or that gadget is a must have - actually, learning what's already in the Logic Pro suite is often the solution. The essential ingredient are ears, and the ability to know what sound you're looking for, as opposed to twiddling in the hope that you'll come across a happy accident.
    because they're capable of some horrible sounds too
    If you want to hear some truly awful sounds, Ozone can destroy a mix in short order

  • Microphone , Audigy Se and Windows 7 64bit

    *Microphone , Audigy Se and Windows 7 64bit's I have wasted several hours today trying to resolve this issue upto and including trawling the internet for a solution and completely removing and reinstalling drivers from disc and updating twice. Ultimately I downloaded an update from WIndows - Absolutely nothing, nada works!
    I have the Mic Jack for my headphones plugged into the blue line in port - tried and tested on my system card (which works) but I consistently get Line--in Currently Unavailablke for this port suggesting that Creative are totally out to lunch on this one.
    I have right-clicked and set levels, tried setting it as default, etc, etc, etc... nothing.
    Has anyone succesfully got their mic to work uunder Win 7 64bit's
    - Love how it says on the box that Vista nad WIn 7 are supported,,,? guess the partially bit was omitted!
    I loathe wondows on any given day of the week but my Mac is currently down so I have no choice but to use this, my wifes machine... NOthiong but lost time whereas if I were on the mac I would be using that time producti'vely, with working software too I might add!
    Hope someone has a fix for this because this machine is just one reboot away from going out the frogging window!!!

    'sHi,
    Are you using this driver? Are you getting no sound from your microphone or is nothing being recorded?
    Please go to Control Panel, Sound make sure that the Microphone option is set as default and that the mic levels are adjusted accordingly, not mute.
    If this is not working for you, Customer Support can be contacted using this http://support.creative.com/Downloads/searchdownloads.aspx?filename=

  • HT1689 On the new version of  iTunes the shuffle button and replay buttons appear to have disappeared on the genius tab and am always having to listen to shuffled songs now :( how can I stop this?

    On the new version of  iTunes the shuffle button and replay buttons appear to have disappeared on the genius tab and am always having to listen to shuffled songs now :( how can I stop this?

    It appears from many other posts that the " Keep This iPod in the Source List" function isn't included in iTunes 7 unfortunately. You can leave your feedback on it's absence at this link: Apple Product Feedback
    You can check out a workaround at this link which may help out for now: Create ready-to-sync playlists for Shuffles in iTunes 7

  • I am getting quicktime error 50 when I attempt to export a retimed project in fcpx to youtube. I mix and match retime rates. I usaully have no issues. The entire project is retimed.

    I am getting quicktime error 50 message when I try to share a project to youtube. I use retime frequently, mixing and matching rates with no issues. I am having trouble with this project. The entire project is retimed ( which  I have done before), it is four minutes and change in length. I used different rates, holds as well, and
    secondary storylines ( retimed to match the primary clip rate ). Any suggestions would be helpfull, thank you.

    I figured it out:
    FCPX does not support NTFS drives, even with Paragon NTFS working perfectly for everything else on the system.
    I guess Apple (just) assumes that nobody will, or should, be using any other filesystem than Mac with FCPX.
    I wasted hours looking for a solution, when a better error message besides a misleading "cannot allocate memory" could have been something more useful.
    Not impressed.

Maybe you are looking for

  • Oracle 10g Express Edition presentation

    Hi everybody, I'm an Italian university student and I have to make a presentation about Oracle 10g Express Edition for an exam. The points of this presentation will be: - Portability - Compatibility with SQL92 standard - Interfaces - Installation and

  • Keep getting a message to connect to internet when attempting to download apps

    I am connected to the internet & have temporarily disabled the firewall & I keep getting an error telling me to connect to the internet. Please help.

  • T61 with T-Mobile?

    I have a T61 (7659-D22) that I bought used. I understand that it includes a WLAN card for Verizon, but my cell-phone service is T-Mobile. Is there any way of using the machine as-is with T-Mobile, or is there a T-Mobile-compatible WLAN card for it?

  • Can't update iTunes on my Pc with Windows 8

    I have updated my iPhone 4 to ios7 via wifi because I was not able to  update iTunes on my Windows 8 pc and update the iPhone by synching.  Now however, my computer won't recognize my phone and says to upgrade iTunes. When I try I keep getting the fo

  • Is it worth upgrading from IOS 6.1.3 to IOS 7.1 ?

    I recently upgraded my iPhone 4S from IOS 5 to IOS 6.1.3. While everything else seems okay, the battery life has decreased significantly. Infact I can clearly feel the battery drains at double the speed compared to how it was with IOS 5. On the inter