Mic audio capture and playback

I've been developing in flash for a while now and now I have
a job developing flash and actionscript 3.0. I have come across a
project with a simple concept but I have found it difficult to
implement.
What I want to do is allow the user to click a button and
record their voice and then I want them to click another button and
play it back. I don't need to save or store it and I don't have
access to a flash media server or any alternative.
Is this possible to do and if so could someone please point
me in the right direction.
Thank you

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.

  • CS4 HDV Capture and playback issues

    Hey,
    I am having trouble with HDV capture and playback on Prem Pro CS4. I tried all the steps mentioned on the article posted by Adobe, http://kb2.adobe.com/cps/405/kb405478.html
    None of these steps have helped anything. I used the cleanup utility, re-installed everything and started from fresh and nothing happens. Capture is always out of sync, it ignores in and out points when batch capturing and playback is all jerky regardless of quality settings. The weird thing is, this only started happening out of the blue. I was using it on a project and it was fine. I hadn't used Prem Pro in a little while and then all these problems began. No change in hardware.
    I am using Premiere Pro CS4 on Windows 7 and capturing HDV footage via firewire on a Sony Z7.
    Any help would be much appreciated.
    Thanks!

    With Win7, if you have not already done so...
    Legacy Driver and Capture http://forums.adobe.com/thread/694890?tstart=0
    - And a Picture http://forums.adobe.com/thread/727755?tstart=0

  • CS3 - Video freezes on Capture and Playback - Please Help!

    Hello all,
    Here's the problem:
    When Capturing footage via firewire from Mini DV, shot in standard DV, within a standard NTSC-DV Widescreen 48k Project, the picture freezes after 1 second.  The audio can still be heard and the footage actually does get captured.  However, after the footage has been conformed, and we load the clip into the Source Window and hit play, the video again freezes after 1 second of play.  Again, the audio keeps playing and you can move the marker anywhere on the clip and see that all the footage is indeed there, but as soon as you go to play it from any point - same thing, the picture freezes after 1 second of play, making editing impossible.  The clip is being captured as an .avi and all capture settings appear to be correct.
    Here's the kicker:
    - HDV video captures and plays back fine.
    - The DV video captured correctly at first, this has been a recent problem going on now for several weeks, after no changes to the system.
    - The biggest kicker - after trying successfully to capture, playback and edit HDV video, we closed Premiere, reopened, tried to play the previously captured DV footage and it played just fine suddenly!!!  Then we closed the program, re-opened and tried again - back to the freezing problem and it never played back fine again...
    Here's the specs (I can give more specifics later if needed, it's my partner's computer):
    Sony PD-150 DV-Cam (but recording on Mini DV in standard DV mode, not DV-Cam)
    Windows 7
    Intel Core i7 3.20 ghz
    Asus X58 Motherboard with onboard Audio and Firewire
    6 GB Ram
    Nvidia Geforce 9 Series with PhysX
    Please help if you have any idea how to solve a crazy problem like this.  Thank you!!!
    Greg

    Now that everything is working, make a full drive image to an external USB hard drive
    I use http://www.terabyteunlimited.com/image-for-linux.htm

  • Audio Capture and Play - Problem. can u help?

    hello all
    currently i am working in a project for which i need to capture sound and play that using headphone. for this i have implemented two classes those r CaptureSound.java and PlaySound.java. most of the cases these classes r working fine but some time these do not work perfectly. when i capture i think the recording part works fine but when i am going to play that recorded file then its playing some noisy sound though this sound file is playing perfectly if i use any audio player and i have seen that the file properties r same as which is playing with my PlaySound.java. i have tried to find - what is wrong but i can't
    any one can help me for this problem?
    the classes r :
    import java.io.*;
    import javax.sound.sampled.*;
    import javax.sound.sampled.Port.*;
    public class CaptureSound {
         private AudioFormat audioFormat;
    private TargetDataLine targetDataLine;
    AudioFormat recordingFormat = new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, 11025.0F, 16, 2, 4, 11025.0F, false);
         public CaptureSound(String filePath) {
              AudioFileFormat.Type fileType = null;
              File audioFile = null;
              fileType = AudioFileFormat.Type.WAVE;
              File createDirectory = new File("C:\\Capture\\test");
              if(!createDirectory.exists()) {
                   createDirectory.mkdirs();
              audioFile = new File(createDirectory + "\\1.wav");
              try {
                   audioFormat = recordingFormat;
              DataLine.Info dataLineInfo = new DataLine.Info(TargetDataLine.class, audioFormat);
              targetDataLine = (TargetDataLine) AudioSystem.getLine(dataLineInfo);
              targetDataLine.open(audioFormat);
              targetDataLine.start();
              AudioSystem.write(new AudioInputStream(targetDataLine), fileType, audioFile);
              } catch (Exception e) {
              e.printStackTrace();
              System.out.println("File Not Found");
    import java.io.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import java.io.*;
    import javax.sound.sampled.*;
    import java.net.URL;
    import java.awt.*;
    import java.net.URLConnection;
    public class PlaySound {
    private SourceDataLine sourcedataline;
    private AudioInputStream ais = null;
    private AudioFormat audioformat = null;
    private FloatControl gainControl;
    private InputStream inputStream = null;
    private boolean isPlayEnd = false;
         public PlaySound(String sourceFile) {
              try {
                   ais = AudioSystem.getAudioInputStream(new File("C:\\Capture\\test\1.wav"));
                   audioformat = getAudioFormat(ais);
         DataLine.Info datalineinfo = new DataLine.Info(SourceDataLine.class,audioformat);
              if (AudioSystem.isLineSupported(datalineinfo)) {
         sourcedataline = (SourceDataLine) AudioSystem.getLine(datalineinfo);
              sourcedataline.open(audioformat);
              //Copy data from the input stream to the output data line
              int framesizeinbytes = audioformat.getFrameSize();
              int bufferlengthinframes = sourcedataline.getBufferSize() / 8;
              int bufferlengthinbytes = bufferlengthinframes *framesizeinbytes;
              byte[] sounddata = new byte[bufferlengthinbytes];
              int numberofbytesread = 0;
              while ( (numberofbytesread = ais.read(sounddata, 0, sounddata.length)) != -1) {
                   if (!sourcedataline.isRunning()) {
                        sourcedataline.start();
              sourcedataline.write(sounddata, 0, numberofbytesread);
              isPlayEnd = false;
              isPlayEnd = true;
              } catch (LineUnavailableException lue) {
              } catch (IOException ioe) {
              } catch (NullPointerException npe) {
              } catch (ArrayIndexOutOfBoundsException npe) {
    } catch (UnsupportedAudioFileException use) {
         private AudioFormat getAudioFormat(AudioInputStream ais) throws
              UnsupportedAudioFileException, IOException {
         AudioFormat audioFormat = null;
         try {
              audioFormat = ais.getFormat();
         AudioFormat newformat = new AudioFormat(
         AudioFormat.Encoding.PCM_SIGNED,
         audioFormat.getSampleRate(),
         16, //audioFormat.getSampleSizeInBits()
         audioFormat.getChannels(),
         audioFormat.getChannels() * 2,
         audioFormat.getSampleRate(),
         false);
         AudioInputStream newStream = AudioSystem.getAudioInputStream(
              newformat, ais);
         audioFormat = newformat;
         ais = newStream;
              } catch (Exception e) {
              System.err.println("Exception: " + e.getMessage());
         return audioFormat;
    ///////////////////////////////////////////////////////////////////////////////////////////////////

    hello all
    i have captured sound with the format : AudioFormat recordingFormat = new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, 11025.0F, 16, 2, 4, 11025.0F, false); now i want to play this file. for that i have created AudioInputStream and then i have created AudioFormat like:
    AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(new File("C://Capture//test.wav"));
    AudioFormat audioFormat = audioInputStream.getFormat();after this i have got the format like :
    bigEndian: boolean = true
    channels: int = 1
    frameRate: float = -1.0
    frameSize: int = -1
    sampleRate: float = 48000.0
    sampleSizeInBits: int = -1
    here i have found different file format and it can't play. why this is happening? can any one help for this?
    thanks
    bashar

  • Audio capture and converting the audio data to .wav file

    hi,
    i am new to applet and javax.sound and trying to build online recorder SDK in applet. I could captured the audio data and play the sound from microphone and also store the audio data to .wav file successfully. But when try to play that file from Window Media Player, i got the message "Windows Media Player cannot play the file. The file is either corrupt or the Player does not support the format you are trying to play." I have tried it all in different way but it's not working for last 5-6 days. Is there anyone who could help me , my work is stocked b'coz of this.
    Thanks

    this is the thread in which i am storing the audio data from audio stream to .wav file
    class CaptureThread extends Thread{
                          public void run(){
                                      AudioFileFormat.Type fileType = AudioFileFormat.Type.WAVE;
                                      File audioFile = new File("junk.wav");
                                       try{
                                       final AudioFormat format = getFormat();
                                             line.open(format);
                                          line.start();
                                             AudioSystem.write(
                                              new AudioInputStream(line),
                                              fileType,audioFile);
                                        }catch (Exception e){
                                             e.printStackTrace();
                                          }//end catch
                                     }//end run
                        }//end inner class CaptureThread

  • DNIS capture and playback

    I'm new to UCCX but hoping someone has some advice on this.
    I have a UCCX 8.5 installation and a Communications Manager 8.5 installation at a large university. We have 30,000 numbers in our dial plan but not all the numbers are assigned to devices. In other words some of the numbers are simply not in service.
    I would like to play a message to callers when they attempt to call on of these not in service numbers that includes the number they have dialed.
    For example:
    Caller calls a number that is not in service
    Call is redirected to UCCX script
    Script plays prompt, something like "The number you have dialed..."
    Script captures orginal dialed number (DNIS).
    Script plays back DNIS to caller.
    Script plays prompt, something like "...is not a working number. Please consult your directory and dial again."
    I think the Get Call Contact Info block will capture and store the DNIS I just can't figure how to play the number back. There is a good chance that I'm way off the mark too.
    Any help would be appreciated.

    Add a play prompt under the get contact info and in the play prompt "prompt tab" put S[] inside the brackets type the name of your string variable that collects the dialed number from the get contact step.
    You can combine the beginning and end prompts with the dnis collected info and it should look like this in the play prompt "prompt tab"
    P[beginning prompt] + S[dialedNumber] + P[endprompt]
    Hope this helps and didn't confuse you.
    Regards,
    Yosh

  • Clitching during capture and playback

    hi there, I have been having some major problems with FCP and my computer...I don't know if they are related.
    My HD died on me, so I put in a brand new one...since then, my fcp has been acting goofy.
    When I try to capture video and audio (in firewire NTSC Basic mode), the video stops, but the audio keeps going. When I place the clip in the timeline, the audio doesn't follow the video. I did notice though that even with just my capture window open and video is playing from my deck, it will stutter withough even hitting the capture now button.
    However, I can capture video on the "non-controlable device" mode, but it has some glithces (pixleated colors that appear in the video), but the audio doesn't get off.
    Is this a back firewire port on my computer? I did try a different f.w. cable and it still did it...anyone have a suggestion? Thanks!
    -R

    Once past the immediate AH HA!, I recognize THAT problem (which doesn't seem to be happening), more basic information becomes necessary to track down the problem.
    Video format? DV, HDV, Uncompressed HD of some flavor?
    How captured? iMovie? FCP?
    External drive type and free space? Firewire, USB, e-sata?
    Any filters on the footage?
    Sequence settings?
    How are you viewing the footage? computer screen only, external ntsc/pal monitor?
    And so on.
    Cheers,
    x

  • MIDP2 live audio capture and streming out

    HI,
    I want for my project to capture (capture:/audio) from mobile while speaking and send it to the host live. Ya, i could do this by recording juz a clip and sending over and over (as datagrams) but my requirement is, how to capture audio live.
    But, record controler interface supports only setRecordStream() - can't get data untill commit() and setRecordLocation() - supports only file protocol. So, i found a class inside mmapi RecordCtrl (implements RecordControl) and i thought of writing an extension for it. but there are lots of restrictions too...
    Do i have to go deeper that much to capture live voice?
    Does anyone have done that?
    Easy way you can think of?
    Thanks!
    Cheers,
    Ivana.

    Hi, I have exactly the same requirement. Did you manage to get a solution?

  • Simultaneous capture and playback - is this possible?

    Hello all,
    I'm looking for a way to simultaneously capture NTSC footage into Final Cut and have that captured file available for playback within another program while it is still recording. Kind of like time-shifting with a Tivo. Does anyone know how to do this? Are there certain software/hardware combinations that would allow something like this?
    Thanks for your time,
    Mark

    Yeah, but it is a complex setup and not cheap.
    PICTURE READY.
    http://www.virtualvtr.com/pictureready/pickeyaaresofuse.html
    Shane

  • Capturing and Playback

    Im trying something and i hope you can help me. I have two Mac computers, one dedicated to capturing a event and the other I have is dedicated to playback. They share the hard drive via a network. What I want to know is- is there a way for the dedicated playback machine to access a video file that is still being captured by the capturing machine and play back parts of it in a sequence??

    Hi -
    Check out Picture Ready.
    http://www.virtualvtr.com/pictureready/index.html
    I believe it will allow FCP to do what you want.
    No personal experience, but I have heard it highly spoken of and in use in mission critical applications like live broadcast TV.
    MtD

  • Capture and playback

    Trying to capture minidv to fcp using jvc gr 850. Everything looks fine in log and capture window while capturing. , but when playing back captured clip , it plays very fast. What gives? Tried a lot already.

    If the footage was shot 24pa (advanced), you can remove the pulldown during capture, but if it was shot standard 24p, you can't do that, and must capture at 29.97. That could be causing your problem... has to be 24pa to capture at 24fps. otherwise, just capture at 29.97 because FCP can't remove the pulldown until after it's captured.
    There's little reason to remove the pulldown BTW...it will look the same, and if you are intending to print to film, then you do want to remove the pulldown, or if your program is going to be long, removiing the pulldown will fit more video on a DVD... but otherwise, it will end up looking the same in any event.
    Jerry

  • Audio video capture and combination Nintendo64

    Hi
    I was hoping that someone could help me with mixing a video and audio signal for live playback.
    I have a N64 with its video component hooked up to my TV capture card, and the audio connected to the line in on my sound card.
    the computer i'm using has a fresh install of arch, with xfce. I currently just have alsa installed, as far a sound stuff goes and everything is working fine.
    right now i can see the video from my nintendo with "QT V4L2 test utility" which is all good. I can't make this video full screen or any bigger. I do know i can use cheese to view the video in full screen, but it does not handle any audio.
    so, what program can i use? or how can i play captured audio live?? is there a program (something like cheese or not) that can handle the capture and playback of both audio and video????? the latter is prefered
    any input would be good, some ideas could help me along
    thanks guys

    ok cool VLC seems like a good option, i can capture the video just fine becasue i know the video device name is /dev/video0 but i don't know what the audio device name is..
    i have been looking online for a way to find this out. but i have not yet found a way to tell me what the audio device name is for my sound card. (i have the audio input connected to a PCI sound card)
    i just found this which helped a bit
    http://forum.videolan.org/viewtopic.php?f=32&t=81166
    it turns out that when i have a look the sound card i want to use is alsa://plughw:0,0
    so i go -> show more options -> play another media synchrously and enter alsa://plughw:0,0. all goes well
    Last edited by marno11 (2011-08-18 10:18:26)

  • Problems in sound capture and JMF deployment

    Hello:
    I am new to JMF.
    I made an applet using JDK 1.3 on JBuilder 5. This applet captures and plays audio. When I run it through JBuilder's IDE, it runs fine. But when I run it independently, the applet's GUI appears but sound recording doesnn't work. Remember that I have JRE1.4.2 and JMF2.1.1e installed on my machine.
    When I installed JMF, I enabled the recording, and file writing options for an applet.
    To further check the problem, I ran it through JMF debugger. There I found that it says that ,
    <permission javax.sound.sampled.AudioPermission "record";> is not enabled.
    To enable it I added this entry in java.policy. This allowed the audio capture to work.
    But my question is,
    1. Why isn't this entry present by default in java.policy?
    2. Even one of my user entered this entry in java.policy, but was unable to capture audio.
    3. I want my applet to be running with different users having different versions of JRE,JMF and browser settings. How can I do this, without asking my user to do anything? I simply want that when my user downloads this applet, I should provide him with some installation file that installs JMF as well as configures everything on the system in a way that he can use this applet easily.
    Haven't you guys faced such problems in deploying JMF stuff?
    I'll be grateful for any help.
    Thanks
    Jami

    Hi.
    I am facing very similar problems: it looks like deploying JMF with Java Applets is really a challange!
    On my own test installation, if I enable audio capture and file writing for applets through the JMFRegistry, then I am able to record audio from my test applet, even when executed in the target web browser.
    Nevertheless, how to deploy the applet in such a way clients won't be required to manually install JMF and enable audio capture and file writing through the JMFRegistry?
    It looks like the JMF Customizer is able to produce a custom JAR also embedding user preferences for audio capture from applets and file writing , is this correct?
    Any help would be greatly appreciated.
    Regards,
    Marco.

  • Capture and Export of Mono Audio in FCP HD

    I have just upgraded to FCP HD from FCP 3. My problem is all of my audio needs to be Mono only. In v3 this was simple I just chose Mono from the capture settings and Mono for Export.
    On FCP HD I can't find any way to capture and export as Mono. When I record Voice Over in FCP all I get is the right channel and even when I set it to pan centre it still only comes out the right speaker after export.
    If I've got to manually duplicate tracks everytime it will take me forever.
    Anybody know a simple way to capture and export Mono only (the same for both Ch 1 + 2)
    G4 DP 1.25   Mac OS X (10.4.6)  

    This might seem the long way 'round but it may save a ton of time in the end.
    Do your FCP mix in stereo as Colin suggests, then take the final audio track into STP or Peak and do a "mix to mono" and then save a new AIFF file with the resulting mono clip.
    Then bring that back into FCP on a new audio track, line it up with the stereo, then either disable or delete the stereo tracks. This will give you a true mono audio track.
    But where are you going with this content that will handle mono audio? DVDs require a stereo AC3 files. Are you sure you really need a mono sound track?

Maybe you are looking for

  • How do I run two Apple IDs with one computer and sync music content?

    I have a single PC which I have added all of the music to one my log in. My wife and I have Iphones and I want to run separate accounts for itunes, but sync music content from the single source to both phones. Whenever I have tried to do this in the

  • Mac mini video output problems

    My mini is one bunch of problems, here is what im dealing with, On my screen i have 2 systems connected, when i switched bac from my windows pc to my mini, my screen says no signal. I can press the keyboard etc, nothing happens. Same as when the mini

  • Old Apple ID email/password when trying to restore from iCloud backup

    I've seen variations of this question being asked previously, but I haven't seen any real solutions provided (or any that have worked). About a year or so ago, I changed the primary email on my Apple ID from an old email address I rarely-to-never use

  • QT 7 - not compatible with older PC games?

    My kids have an older (04?) Disney PC game which requires QT 4.0 or greater. As soon as we downloaded QT 7, the game no longer worked. A note pops up that we are required to have QT 4 or greater - although QT 7 is already on the machine! Any ideas? S

  • Problem installing Oracle 9i database release 2.0

    Hi, I encounter this error message while installing Oracle 9i rel 2.0 entreprise edition on Win 2000. "Couldn't connect to the server - Please check the network and that server daemons are running. (Socket error 10061)". Could somebody help, to resol