Audio capture/playback

I'm using a TargetDataLine to record, and a SourceDataLine to simultaneously playback, and the playback is delayed by about 100ms. Can you get rid of that delay?

Here you go.  I use this script so I know it works.  You need to have at least flash player 10.
You need 3 buttons.  1 record button - linkage = micRec , 1 play button - linkage = soundPlay  and one stop recording button - linkage = stopRecord
i keep the stop button off the stage and have it moved onto the stage when the record button is pushed.  Then finally move both the record and the stop recording button off the stage when the stop recording button is pushed.
micRec.addEventListener(MouseEvent.CLICK,recordMic);
function recordMic(event:MouseEvent){
micRec.x = -250;
stopRecord.x = 117;
const DELAY_LENGTH:int = 4000;
var mic:Microphone = Microphone.getMicrophone();
mic.setSilenceLevel(0, DELAY_LENGTH);
//mic.gain = 80;
mic.rate = 25;
mic.addEventListener(SampleDataEvent.SAMPLE_DATA, micSampleDataHandler);
stopRecord.addEventListener(MouseEvent.CLICK,SREC);
var soundBytes:ByteArray = new ByteArray();
function micSampleDataHandler(event:SampleDataEvent):void
    while(event.data.bytesAvailable)
        var sample:Number = event.data.readFloat();
        soundBytes.writeFloat(sample);
function SREC(event:MouseEvent):void
stopRecord.x = -250;
    mic.removeEventListener(SampleDataEvent.SAMPLE_DATA, micSampleDataHandler);
    soundBytes.position = 0;
    var sound:Sound = new Sound();
    sound.addEventListener(SampleDataEvent.SAMPLE_DATA, playbackSampleHandler);
soundPlay.addEventListener(MouseEvent.CLICK,SP1);
function SP1(event:MouseEvent){
soundBytes.position = 0;
    sound.play();
function playbackSampleHandler(event:SampleDataEvent):void
    for (var i:int = 0; i < 8192 && soundBytes.bytesAvailable > 0; i++)
        var sample:Number = soundBytes.readFloat();
        event.data.writeFloat(sample);
        event.data.writeFloat(sample);

Similar Messages

  • Is it possible to do the audio capture and playback simultaneously?

    In short :
    Is it possible to do the audio capture and playback simultaneously? . If it is not supported directly by Sun, pl suggest another way to achieve the same.
    In detail:
    I am doing a voice chat application by using the streaming through UDP . I am able to play the byte stream. But , is it possible to capture sound simultaneously (while playing the audio) to send to the other end?
    Edited by: dhillarun on Jan 4, 2008 7:11 AM

    If you're Airplaying from you computer, you might be able to do this. Here's what I would try:
    Go to the Airplay icon in iTunes. You should see both your Apple TV and your speakers listed as options. Select "Multiple speakers." You'll see both devices together. Turn the volume all the way down on the Apple TV. You should be getting the video on the TV, but only hear audio through the speakers.
    Using the "Multiple Speakers" option will sync the output of your devices so that the sound matches the picture.
    I haven't tried this myself, but I'm thinking this would work. However, this approach will only work when using Airplay from your computer – not from am iPad or iPhone – as they don’t have the "Multiple Speakers" option (as far as I know). It also won't work with content streamed directly to your ATV, obviously, because there's no way to stream from ATV to other devices.
    Let me know if this works.

  • Audio Capture from DV Tape

    I've reviewed many posts here about audio capture but, I am unable to figure out what the "trick" is to capturing audio alone with the video using the new iMovie. I'm connected via Firewire and I'm able to view the video in capture mode but, I hear no sound. I've checked iMovie Preferences and System Preferences and everything seems to be OK there.
    Is this the way this new version of this program functions? I wish I didn't have to post a msg here because, I'm trying to read the previous post and trying anything that seems to pertain to my issue without the desired results.
    Can someone please shed some light on what's going on with this function of this program?

    I assume you are wanting to hear the audio as you are importing and not that you have no audio once it is imported.
    imovie 08 doesn't play audio while importing. While you are using tape (that imports in real time) imovie now imports from a variety of different types of camera such as AVCHD (which isn't imported at real time. Therefore it is no longer logical to playback audio on import.

  • Audio Capture only happens if its more than 5 seconds

    Hello,
    I'm writing a midlet that does audio capture on the LG CU500 phone. When I capture for 5 seconds or more, audio capture works as intended, however if I only record for under 5 seconds, it doesn't work. There is no timer. Would could be causing the problem?
    Thanks
    aztec30

    Here is a snippet of the code that i'm using. When playing back, if I record say 10 seconds, I only hear about 7 seconds of the recording. About 3 seconds are cut off at the end. If I record for say less than 4 seconds, nothing seems to be recorded, nothing plays back.
    To record I do the following
    try {
    if(player != null)
    player.stop();
    if(ctrl != null)
    ctrl.commit();
    player.deallocate();
    player.close();
    ThreadSleep(500);
    if (player==null) {
    player = Manager.createPlayer("capture://audio?encoding=audio/amr");
    player.realize();
    player.prefetch();
    player.addPlayerListener(playerListener);
    is = new ByteArrayOutputStream();
    ctrl = (RecordControl)player.getControl("RecordControl");
    ctrl.setRecordStream(is);
    ctrl.startRecord();
    player.start();
    } catch (Throwable e) {
    Once recording is stopped I do this
    try {
    player.stop();
    ctrl.commit();
    player.deallocate();
    player.close();
    Thread.sleep(500);
    if (is !=null) {
    playback= Manager.createPlayer(new ByteArrayInputStream(is.toByteArray()),
    "audio/amr");
    playback.addPlayerListener(playerListener);
    playback.start();
    } catch (Throwable e) {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Control volume of audio capture

    Hi,
    i'm facing a problem using the java sound demo.jar provided by sun: http://java.sun.com/products/java-media/sound/samples/JavaSoundDemo/index.html
    for the capture/playback panel;when a song is playing on my system i press button record and in fact the capture is being performed.when i stop record and press the play button to playback recorded audio then i hardly can hear the sound : it seems the volume or balance were not properly set in capture code.
    Now the question : how can i control the volume/balance of a capture process using java sound api ?
    thanks for helping.

    I think you can control the volume of a whole movie clip, but you will need to use the Sound class.
    On your main timeline
    var mySound:Sound=new Sound(_root);
    mySound.setVolume(10);
    I believe that will set the maximum volume for the entire swf. I just tried it with a parent and a dynamically loaded swf. I set the volume for the _root and it controlled both timeline placed audio on the loaded file and code controlled audio.
    Why do you not want to use the sound class?

  • No audio during playback

    Hello all, I am extremely consfused as to what is wrong with the premiere pro settings. I have a blackmagic intensity pro installed. I can use it just fine to capture video. No matter what audio files or Videos I use, the audio meters show audio during playback, but my speakers are not playing anything. I have searched for a solution. My only guess is that the program is pointing audio to the blackmagic intensity pro and not to my audio card. Any suggestions?

    I talked to Blackmagic about this problem and was told that they could only guarantee audio/video sync if their output was used so their presets only let you do this. With the Decklink studio this is a bit of a pain if you are working in 5.1 as there are only 4 analogue outs, I had to build a rack of D to As to get my monitoring working.
    Richard Knight

  • Repeated audio capture in midlets... a new audio everytime from user...

    Hi guys can you help me in getting repeated audio capture in midlets... a new audio everytime from user...
    just the part where
    captureplayer,playbackplayer to null
    recordcontrol=null.....
    manager to realize captureplayer
    recordcontrol.setstream ---->doesn't work for me.
    Any ideas will be helpful

    I assume you are wanting to hear the audio as you are importing and not that you have no audio once it is imported.
    imovie 08 doesn't play audio while importing. While you are using tape (that imports in real time) imovie now imports from a variety of different types of camera such as AVCHD (which isn't imported at real time. Therefore it is no longer logical to playback audio on import.

  • [SOLVED] Setting default audio capture device

    I have a USB webcam with a microphone that is recognized by ALSA after the on-board line-in. This is fine in Skype because I can set the capture device to the USB microphone, but Flash seems to only use the first capture device (listing only "Linux Microphone") recognized by ALSA. Is there any way to set the default (presumably, the first) audio capture device, or get Flash to see my USB microhone?
    Last edited by matkam (2010-09-10 22:01:53)

    Solved by creating ~/.asoundrc file containing the following:
    pcm.usb
    type hw
    card U0x46d0x81d
    pcm.!default
    type asym
    playback.pcm
    type plug
    slave.pcm "dmix"
    capture.pcm
    type plug
    slave.pcm "usb"

  • System Settings-Audio Capture

    In FCE, trying to capture VHS via DV converter box. The sound is not coming over. In system settings/scratch disk (internal hard drive) the audio capture is grayed out. Analog RCA composite video & stereo audio connectors in place. How do I get my sound?

    You can't get audio during capture as firewire has control.
    Use the audio from the play device if you need to hear what's happening. You will notice latency on the FCE capture window, that's normal as well.
    Al

  • I just moved my itunes library from a win 7 computer to a win 8.1 computer. Getting an error message "iTunes has detected a problem with your audio configuration. Audio/Video playback may not operate properly. Can't play CDs or get audio file from web!

    Help! I just moved my itunes library from a Win 7 computer to a new Win 8.1 computer following the instructions on the itunes website. Everything is good except I'm getting an error message on the Win 8 computer if I try to play a CD or get an audio file off of the internet. I get an error message that says "iTunes has detected a problem with your audio configuration. Audio/Video playback may not operate properly. I don't know where to look for or fix the audio configuration on the win 8 computer. As far as I can tell the iTunes configuration looks the same as on the other computers in the house. At this point I don't dare plug my ipod touch into the Win 8 computer for fear it will get messed up.

    I have the same problem and I know that it is due to my PCI Audio driver not being compatible with WIndows 8.1.
    iTunes isn't the only program that can't direct sound to the built-in speakers anymore. The obvious solution would be to update the drivers, but unfortunately Dell does not provide an updated driver for my model, so I am stuck with that.
    However, saying that, only my laptop speakers are affected by this. I can use sound fine on applications where I can choose the output device and direct sound to the head phones, but for some reason iTunes does not let you choose the audio device manually.
    To listen to music I imported the iTunes Library in Windows Media Player and changed the audio output using the following instructions: http://windows.microsoft.com/en-us/windows7/c00d11ba
    However, I would also like to rent movie's from iTunes, 
    Would be great if iTunes would let you choose the output device, too, like most other applications using sound  from Skype to Windows Media Player,...

  • Error message after upgrade to iTunes 11: "iTunes has detected a problem with your audio configuration. Audio/Video playback may not operate properly."  At this point my PC running XP loses all audio.

    Several attempts to upgrade to iTunes 11 have failed.  After an upgrade to 11 the error message reads: "iTunes has detected a problem with your audio configuration. Audio/Video playback may not operate properly."  At this point--after the upgrade to iTunes 11--my PC running Windows XP loses audio playback for all functions--in iTunes, in the browser and the volume icon disappears from the System Tray.  Only by removing iTunes 11, and then using System Restore to turn back the OS settings can I return the PC to normal functioning.
    I did that.  I reinstalled iTunes 10.5.  Everything seemed fine, but when I try to plug in and copy a CD to my iPhone 4S an error message reads roughly: 'iPhone 4S requires iTunes 10.5 or higher to work.'
    What might be the problem with my audio configuration?
    Why doesn't my iPhone 4S work with iTunes 10.5?  It used to work with iTunes 10.5.
    Please advise.
    ep

    This forum is for questions about iTunes U, Apple's service for colleges and universities to post educational material in the iTunes Store. You'll be most likely to get help with this issue if you ask in the general iTunes for Windows forums.
    Regards.

  • When I connect my I pod shuffle to USB it shows an error message - " I Tunes has deducted a problem with your audio configuration. Audio/Video playback may not operate properly" due to this problem each and every earphone am inserting goes unusable

    When I connect my I pod shuffle to USB it shows an error message - " I Tunes has deducted a problem with your audio configuration. Audio/Video playback may not operate properly" due to this problem whenever i connect  earphone each and every earphone gets un usable. Already made a factory reset. please arrange for a rectification.. :'(

    Hi Ganeshpandianm,
    Welcome to the Support Communities!
    The article below may be able to help you with this issue.
    Click on the link to see more details and screenshots. 
    iTunes for Windows: iTunes cannot run because it detects an issue with QuickTime
    http://support.apple.com/kb/TS1371?viewlocale=en_US
    "iTunes cannot run because it has detected a problem with your audio configuration"
    Cheers,
    - Judy

  • Media Encoder not finding "audio capture device"

    Hi,
    Im using Adobe Flash Media Encoder with Dxtory for Twitch streaming, and at first it worked fine. Recorded both my mic and game audio perfectly. Then seemingly suddenly, I fired it up  and it wouldn't stream the game audio. It would my Mic, but thats it. I then unplugged the mic and it started saying I had no Audio Capture Device. I checked in Dxtory and its set up the same as it was when it was working. It picks up both the mic and speakers like it should. I have uninstalled this program multiple times, both 3.1 and 3.2 versions, and each time when I re-download it, it loads up the same profile I had before. So when I am uninstalling it, its not uninstalling everything for some reason. Even though the program is no where to be found after its uninstalled. I have downloaded xsplit, and it picks up the game audio and my mic. So its just this program. Anyone have any ideas? I cant seem to find anything online about this issue.
    Thanks!

    From where?  PP sequence?  PP bin?  PP Source Monitor?  Watch folder?

  • Audio Capture problem

    When Capturing from a DV device on to final cut express HD, only audio is "caught". When I checked the scratch bin the audio selection was disabled (like, the check-bow was dimmed and unable to be changed). I'd like to be able to capture audio without using the voiceover feature and having to completely match audio with video. Ya dig?
    Thank you (for at least reading this)!

    then why is FCE capturing video but not audio. all the settings are correct, the only thing i fan find wrong is the "audio capture" check box in sratch disk settings under system settings is nulled to where you can't do anything to it. So, unless it's normally like that, I'd say it has something to do with the way it captures audio.
    so, please tell me that has nothing to do with it so I can find another reason why it won't capture audio.
    Macbook Pro   Mac OS X (10.4.8)  

  • Audio capture

    I want to whether the cross-platform supports the audio capture?
    If not ,are there any methods to finish audio capture on handheld

    Hey DaddyPaycheck, the tape deck is actually one of those boombox/shelf stereo with cd carousel, and dual tape deck (5.1 speaker system). Audio was working just before I disconnected the speakers. I tried using the speaker output jacks, as well as another audio out, but neither one of them was putting out audio through my computer's speakers. The sound preference recognizes the iMic, but not the Pyro. But the apps I mentioned recognizes both. Selecting the iMic for output in the system preference doesn't work either. I see the bars moving, but I believe that's just random noise the iMic is picking up.
    So, by all intent and purpose, the set up I have should technically work?

Maybe you are looking for

  • 11G ADF BC: How to arrange the position of items in a query scenario?

    Hi, I am creating a search page with a search scenario at the top and a result table at the bottom using Jdev 11G (11.0.0.0.1) ADF BC. In my search scenario, there are about 35 items. Now they are evenly divided in 3 columns by default. I have certai

  • IPad 2 connects via iphone hotspot, but not router

    I have a iPad 2 that refuses to see or connect to my "G" wi-fi network. Both my iphones and iPad mini connect to the same wi-fi network without any issues. But, the iPad 2 will connect to to my iPhone 5 via AT&T personal hotspot (wi-fi... is this rea

  • What wires are needed to connect to a projector

    What wires are needed to connect a macbook to a projector

  • Smoothing not working

    Hi, In flash and illustrator my paint strokes are smoothed out very noticeably which I really like. In photoshop  with smoothing on I cannot notice any difference at all, the lines look jagged I tried on and off next two lines next to each other and

  • Double payment taken online

    On 31st May, I paid my monthly bill, in full as normal.  I noticed when looking at my account later on that 2 payments had been taken.  I contact customer services who told me to contact my bank to get it back.  I did this and the bank advised that a