Need to play and stop sound file with 1 ms resolution

Hi,
I'm trying to open a .wav file then later play it at a time when another parallel loop activates a boolean local variable which controls playback in my "sound" loop. I need high time resolution in stopping the playing of the .wav file, ~1ms. From what I've gathered, I can't use the "sound output write.vi" because it locks the loop until it finishes outputting a set number of samples. Because of this, "sound output stop.vi" has to wait until the next iteration, which is more than ~1 ms.
In the help menu of the Sound Ouput VIs it says you can set the task ID for the "sound output start.vi" using the "sound output configure.vi." Unfortunately I've only been able to use the "sound output start.vi" following "play sound file.vi", and I don't really know why this is the case.
I can't start my sound with the "play sound file.vi" because it locks the loop its in until it finishes playing the sound. Oddly this only happens when there is a parallel loop running, if I run it by itself, with no other loops, it doesn't lock the loop. I thought it might have something to do with the local variable, but the loop doesn't lock when the loop restarts the sound using the "sound output start.vi." 
After opening a .wav file, can i use the "sound output configure.vi" to create a task ID for the "sound output start.vi" to work? Or do I have to use the "sound output write.vi" after calling the "sound output configure.vi." The help menu makes it seem like the prior suggestion is possible.
Thanks a lot!

Since it sounds like the problem you're running into is getting the data loaded from the file before you're ready to play it, look at the Files sub-palette, specifically the Sound File Read Simple VI.  You can use this VI to load the data into a waveform and have it ready for use later in the program.
So in your overall program, read the file with Sound File Read Simple and configure the output with Sound Output Configure and call Sound Output Write when you're ready to play the waveform.
Alex Person
NI-RIO Product Support Engineer
National Instruments

Similar Messages

  • How to play and stop flv files through NetStream in AIR Application

    Hi,
    In a folder I have 'n' number of flv file, which are DRM protected. when the user try to play those files for the first time through my AIR application, it will prompt for username and password and gets the license/voucher from the server and store it in AIR Runtime. so that from the next time onwords it won't prompt for username and password as because it already has license/voucher.
         My problem is assume there are 500 files, such that for each file the user has to enter his credentials[username and password]. which is a stupid thing. I want to avoid this process by implementing this process internally/programetically. By playing/accessing each file through netstream from the folder and setDRMAuthenticationCredentials for that file and stop the stream. Here I am able to play each file but I am failed to stop it. I mean to say I will get the license for all the flv files internally[while loading my AIR application], such that user should not be interrupted for his credentials for each file.He should play as if he is accessing/playing a non-DRM protected file. I will be very thank full if any one help me out in this.
    public function init():void {
          connectStream();
          getLicenseForAllFiles();
          videoStream.addEventListener(DRMAuthenticateEvent.DRM_AUTHENTICATE, drmAuthenticateEventHandler);
          ppt_videoStream.addEventListener(DRMAuthenticateEvent.DRM_AUTHENTICATE, ppt_drmAuthenticateEventHandler);
            private function getFilesRecursive(rootFolderPath:String):void {
                //the current folder object
                var currentFolder:File = new File(rootFolderPath);
                //the current folder's file listing
                var files:Array = currentFolder.getDirectoryListing();
                //iterate and put files in the result and process the sub folders recursively
                for (var f = 0; f < files.length; f++) {
                    if (files[f].isDirectory) {
                        if (files[f].name !="." && files[f].name !="..") {
                            //it's a directory
                            getFilesRecursive(files[f].nativePath);
                    } else {
                        //it's a file
                        fileList.push(files[f].nativePath);
                        //Alert.show(""+files[0].nativePath);
                        var fileName:String = files[f].name;
                        if(fileName.indexOf("PPT_")!=-1){
                            ppt_videoStream.play(files[f].nativePath);
                            ppt_videoStream.pause();
                        videoStream.play(files[f].nativePath);
                        videoStream.pause();
                private function connectStream():void {
                    videoConnection = new NetConnection();
                    videoConnection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
                    videoConnection.connect(null);
                    ppt_videoConnection = new NetConnection();
                    ppt_videoConnection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
                    ppt_videoConnection.connect(null);
                    videoStream = new NetStream(videoConnection);
                    videoStream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
                    video.attachNetStream(videoStream);
                    ppt_videoStream = new NetStream(ppt_videoConnection);
                    ppt_videoStream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
                    ppt_video.attachNetStream(ppt_videoStream);
             private function netStatusHandler(event:NetStatusEvent):void {
                switch (event.info.code) {
                    case "NetConnection.Connect.Success":
                        //connectStream();
                        break;
                    case "NetStream.Play.StreamNotFound":
                        trace("Unable to locate video: " + videoURL);
                        break;
                private function drmAuthenticateEventHandler(event:DRMAuthenticateEvent):void {
                    videoStream.setDRMAuthenticationCredentials("adobe", "adobe", "drm");
                private function ppt_drmAuthenticateEventHandler(event:DRMAuthenticateEvent):void {
                    ppt_videoStream.setDRMAuthenticationCredentials("adobe", "adobe", "drm");
    Thanks
    Sudheer Puppala

    Hi,
    Please go through following links..this will help you:
    http://lucamezzalira.com/2009/02/28/create-pdf-in-runtime-with-actionscript-3-alivepdf-zin c-or-air-flex-or-flash/
    http://forums.adobe.com/thread/753959
    http://blog.unthinkmedia.com/2008/09/05/exporting-pdfs-in-flex-using-alivepdf/
    Thanks and Regards,
    Vibhuti Gosavi | [email protected] | www.infocepts.com

  • Need help playing and Editing F4V files

    We recently started streaming our church services using FME. Our streaming works fine, however we can not read our recorded files. Does any one know of any tool that will read these files?

    Use the F4VPP tool to flatten the file before you can view it in Flash Media Player or Quicktime or VLC.
    http://www.adobe.com/products/flashmediaserver/tool_downloads/
    I also heard you can edit the files with Quicktime Pro (top and tail) simply rename them .mp4 and rename back when done.
    Matthew Quinn
    Systems Coordinator
    Digital Media Department
    t: 0151 293 8720 | m: 07887 735 405
    f: 0151 293 8722 | w: http://www.liverpoolfc.tv/
    a: Unit 14, The Matchworks, Speke Rd, Liverpool, L19 2RF
    Please consider the environment before printing this email

  • Strange pops when pressing play and stop. Logic 9.1.3, Mac internal Sound

    Hi,
    So I opened Logic for the first time in a while.
    Logic Pro Version 9.1.3 (1697.87) 32bit.
    Mac 2 x 2.8GHz Quad-Core Intel Xeon
    Mac OS 10.6.5
    6GB RAM
    I am using the internal Mac sound card, set up as follows :
    Core Audio
    Built In Line Output
    IO Buffer Size 512
    I am running ONE Mono audio track, with one Space Designer plug-In (mono>Stereo) inserted on the first insert slot.
    There is nothing else playing back on this particular logic song.
    Every time I press the spacebar for play or stop, I get a tiny delay, a pop, and then is starts, or it stops playing.
    This is using the Macs' own internal sound card. With Logic's own Space Deigner, on ONE mono audio track.
    SO, any ideas as to why this happens?
    The only reason I opened Logic, was because I wanted to show a producer friend of mine some personal Space Designer presets I had made a couple of years ago, in case that was the type of ambience he is interested in using for a mix.
    My plan was to use Logic as an effects suite, using a Motu 828mk3 conected via ADAT Lightpipe to my Pro Tools HD converter, to send and recieve 4 stereo sends and returns with 4 instances of Space Designer.
    But, if Logic hiccups with the internal sound card... what will happen when I use the Motu? I dread to think about it, but will test it tomorrow.
    At least I have two weeks to get this working or re-do my convolution reverbs in another plug-in (Waves IR1) that I can use in Pro Tools, in case Logic just does not work out.

    The multi-purpose internal audio chips used in Mac's & PC's has some built in latency and seemes to default to a basic 16-bit 48kHz format. Any change from this and the chip has to change on the fly, I knew sample rate did this, makes sense bit depth might as well.
    Some internal chips have a built in noise gate which can also cause a "thump". (rare)
    Cheap or out-of-spec audio chips with a high DC offset will cause a pop when pressing "Play" and "Stop", as will an audio file that has a high DC offset.
    pancenter-

  • I recorded audio with Quicktime player and the sound files won't disappear from the desktop no matter how I try to put them in the trash...

    I recorded audio with Quicktime player and the sound files won't disappear from the desktop no matter how I try to put them in the trash...tried xing out the red x, putting them in the trash...right clicking to make them disappear...nothing works...

    Just got rid of them... I closed Quicktime and was asked to delete. So I deleted them. Problem solved.

  • How to code a button to play and pause sound using load sound?

    how to code a button to play and pause sound using load sound?I have used load sound methos to attach the sound.Can anyone help me?

    Hey thnx,
    I have used this code on sound's button's frame.and my stop n play button is on another screen.main sound button and stop button is on diffrent screen.
    Here is my code-
    stop();
    adaDrut1.onRelease = function () {
              mySoundC = new Sound(this);
              mySoundC.loadSound("F#/Bhajni1.ark", true);
    mySoundC.onSoundComplete = function() {
    _root.mySoundC.start(0,999); }
             gotoAndPlay("play2");
            _global.myTaalLaya = "Low1";
    adaDrut1 is a sound button.And there are lot of buttons with diffrent sound.
    Thanks..

  • How to remove the button "play" and "stop" in that flash animation?

    The animation is this one ...
    http://adf.ly/OTGyh
    Hello, I made a simple flash animation of a character talking ... The only problem is that this animation has the button "play" and "stop" and I do not want it ...
    I want so carry out the main character speak the message and stop yourself automatically without user intervention to push any buttons ...
    I have the animation code, how do I get this code to the buttons and start the animation so load the page?
    Ah, and how to put the link to a page by clicking on this open a flash site?

    How to do it step-by-step? Because i'm beginner in FLash and that things of animation, codes, functions...
    And I create that simple animation in other program, not using the Adobe Flash, but I think can be edited that file animation in Flash because I have the files ".swf" and ".flv"...
    I don't know how to do it in Adobe Flash CS3, but I have that program installed in my pc, then can you talk me what to do it?
    Sorry my bad english, i'm from Brazil.
    That is the folder contains the files:
    https://dl.dropboxusercontent.com/u/11826717/off/laranja/files_animation.jpg
    That is the Download the files of that folder if you want see better:
    https://dl.dropboxusercontent.com/u/11826717/off/laranja/laranja.rar

  • Would love Steve Jobs to contact me for in setting screen tinting orange for seizures as OK WE HAVE DONE IT AN ORANGE PROTECTIVE SCREEN OVERLAY FOR IPOD AND IPAD STOPPING JOHN'S photosensitivity SEIZURES AND STOPPING EYE PROBLEMS WITH USAGE

    OK WE HAVE DONE IT AN ORANGE PROTECTIVE SCREEN OVERLAY FOR IPOD AND IPAD STOPPING JOHN'S SEIZURES AND STOPPING EYE PROBLEMS WITH USAGE ABLE TO CUT ANY SIZE FOR PHONES EG
    Contact me Steve the idea is great and the pictures are reveal a better depth perception of colour call me a Mum that created a diffence for her son and kept him communicating on his ipod and his ipad proffessors were amazed at childrens hospital and would love to show you my ideas in making it built in to your ipod and ipads or any computer for that matter everyone i show is blown away not only that but a wider customer level will be reached from a Mum that made a difference for her son that was unable to communicate and then had seizures so developed my own cover that allows him to chat all day without having any eye problems.
    So we now sell the covers on ebay to help others access technology that they need in order to survive and live happily as without his ipod or ipad and him telling us what was wrong he would of died he had respritory lung disease photosensitive epilepsy a metabolic condition that could of killed him anytime from stroke or seizure battled with using all types of technology but now is a dream come true.
    Would love for this to be enabled in the setup of all computers alike to protect eyes and allow more users to speak and communicate a big thankyou to the creators and designers fabulous but please can you call me as this could make you even better i mean will and also give me more time.
    From one praying God fearing Mum
    Nadine
    Call me i do have better pics they were too big to upload orange covering on right hand side

    Going through the feedback and support pages will be a waste of your time. Apple won't respond to feedback, and support can't do anything regarding product suggestions, particularly not from a company with an existing product they wish to sell. The only attention you might get from Apple would be possible interest in selling your product through the Apple Stores, and I don't know how Apple chooses the third-party products they sell. All I could suggest would be writing to Apple's corporate headquarters:
    Apple
    1 Infinite Loop
    Cupertino, CA 95014
    with perhaps "Attention: Retail Sales Division" and telling them about your product and your interest in it being sold through the Apple Stores.
    Regards.

  • Why are system and application sound files appearing in itunes?

    Suddenly, over 900 system and application sound files, each about a second or 2 long, have appeared in my iPhone 4S music player. They've also appeared in my iTunes on my desktop iMac. Not sure whether they appeared on the computer first or on the phone first. I can't figure out why they appeared there or how to get rid of them (without also removing them from the system and applications which, of course, I don't want to do).
    I searched through the discussions here and found several other people complaining about the same thing, going back a couple of years, but no solutions offered. I hope someone can offer a clue.

    Thanks for the suggestions and help. While the cause of this problem is still obscure, we've managed, with an Apple tech's help, to remove the system/application sound files from both the iPhone and iTunes. We used Time Machine to backtrack to the point at which the sound files first appeared in the iTunes folder, then moved back one more day and restored the iTunes Media folder (where all the music was stored) and 2 iTunes files: iTunes Library.itl and iTunes Music Library.xml (we could also have simply restored the entire iTunes folder with the same effect). Then we synced the iPhone.
    As for the cause, that's still a puzzle. From Time Machine, we were able to determine that the files were added between midnight and 12:47 AM on a particular day, but that computer was not in use at that time (the user was asleep in bed, and the only other person in the house at the time was me -- and I don't touch that computer).

  • Open a url and view the files with it's timestamp

    Hi guys,
    I need to create a flow service in SAP BC to connect to a server by it's url and display it's files with it's timestamps.
    I have never done this b4, and usinf SAP BC makes it harder for me.. Mostly I need to know how to access the server and view the files with their timestamp.
    Any guidance for me will be much appreciated.
    Thank u.

    Yes,
    It's like this. I will connect to an FTP server. Then I need to view the files it the server or folder i specify with their respective timestamps.
    I am using SAP BC and it's webMethods to create the JAVA flow service. I am only now familiarising myself with SAP BC.
    Moreover I have never done a coding to access a server and list it's file. I can do it o view in a local directory using JFrame aand stuff... But SAP BC doesn't support those..
    So If u can give me some guidelines to follow.. i would appreciate it.
    Here's what i have come up with so far
    public static final void ReadFileServer( IData pipeline ) throws ServiceException
    //define input variables
         IDataCursor idcPipeline = pipeline.getCursor();
         String path = null;
         path = (String)idcPipeline.getValue();
         // Check if url is in the pipeline
         if (idcPipeline.first("path"))
              File dir = new File(path);
              String filesFound[]=dir.list();
              long [] age;
              age = new long[filesFound.length];
              for (int i = 0; i < filesFound.length; i++)
                   age = new File(filesFound).lastModified();
              String temp = "";
              for (int i = 0; i < age.length - 1; i++)
                   for(int k = i+1; k < age.length ; k++)
                        if (age > age [k])
                        temp = filesFound;
                        filesFound = filesFound[k];
                        filesFound[k] = temp;
              for (int i = 0; i < filesFound.length; i++)
              //get url out of the pipeline
              path = (String)idcPipeline.getValue();
              //insert the FILES into the pipeline
              idcPipeline.insertAfter("filesFound", filesFound);
              idcPipeline.insertAfter("age", age);
         //If it is not in the pipeline ERROR
         else
         age = "False";
         idcPipeline.insertAfter("path", path);
         //insert the successFlag into the pipeline
         idcPipeline.insertAfter("age", age);
         //Always destroy cursors that you created
         idcPipeline.destroy();
    return;
    }

  • How to control the line in--- PLAY and STOP ?

    Hi,
       This is the  volume control library downloaded  from NI wed site .It is help for my task.
       My task is to control the line in with LabVIEW, for example STOP, PLAY and adjust volume with LabVIEW button.Though the example I see the volume control can  be enablement.But I don't know how to design the PLAY and STOP button.
       I see it is similar to the volume control.There is function to control the the PLAY and STOP in the system Library-winmm.dll. I don't know  whether all I think is right.I have the following serial question. How to use the function?How to understand the system Library?I can't acquire some information  from it and I don't know the input and output parameter in the funcion.
       Can any one help me out please?
       I'm sorry that my English is poor.
       Thanks.
     lizhi
    Attachments:
    VolCtrl.llb ‏193 KB

    I assume you are referring to audio line-in volume control and lerft-right balance...
    If so, then check out this thread:
    http://exchange.ni.com/servlet/ProcessRequest?RHIVEID=101&RPAGEID=135&HOID=506500000008000000D83A0000&UCATEGORY_0=_49_%24_6_&UCATEGORY_S=0
    Look at the info near the bottom from Paul S & Spectre. They talk about "winmm.dll"
    -cheers-
    JLV

  • Play button for sound files in the browser..?

    I wonder if there's a setting (or something) in Finder so it displays a play button for sound files the same way as it does for video files?
    -- peer

    App Producks wrote:
    that sounds broken, sad no one replied you two years ago .
    Actually is sounds as if it was working correctly. Mute only mutes notifications (phone rings, text, email, etc). What is less explicable is why you felt the need to resurrect this thread.

  • How can I make waveform graph and/or excel file with two different dynamic DBL values?

    As the question describes, I have two dbl sources from a load cell and linear actuator (from firgelli). I want to make a load/displacement curve from the force readings from the load cell and the displacement readings from the linear actuator. The load cell outputs an analog signal that can be acquired by a DAQ and the actuator comes in with a board and VI program to control the speed and measure the displacement of the actuator to a sample rate of my choosing. Is there a way that I can make a VI where it continues to collect data and construct the graph I'm looking for?
    Solved!
    Go to Solution.

    A couple points about your application:
    1.  Synchronization.  Since you're ultimate goal is a stress/strain curve, it is vital that your force and displacement data be synchronized appropriately.  If your sampling is beyond a few times a second, this is not really possible without some form of hardware synchronization via either a trigger and/or sample clock.  Two NI DAQ boards can be synchronized this way easily, but it seems you're using 3rd party hardware for one of these processes.  Would need to know more about that board to know what options you have.  You could specify what your resolution is in distance, and how fast the article will be moving, to get an idea of how fast to acquire, and how well you'll need to synchronize the data.  Another option, since it appears each data stream will be sampled on a hardware-timed sample clock, they will be offset in time, but not skewed during the acquisition.  You may be able to identify a feature in the data set common to each and use that to remove the timing offset after the process is completed.
    2.  Display.  To display data during the acquisition process, I usually recommend at least one display that plots vs. time.  Much easier to spot irregularities with the acquisition process that way.  However, if you'd like to also plot force vs. displacement, you can use an XY Graph to plot parametrically. For Example, in your case you would use the Displacement data as the X coordinates, and the Force data as the Y coordinates.
    3.  Saving data to file.  I would recommend using the Save to Spreadsheet File.vi (File IO pallette) to save your data.  If you use a comma as the delimiter, and save the file with a *.csv extension, you will have a file that is easily read into excel.  The standard tab-delimited spreadsheet file is also fine, it will just require an extra step to read it into excel to specify to excel what the delimiter is.
    4.  Batch vs. Real-Time Recording (Data File).  If your process is short (< 30 sec) you may be better off acquiring the data, Storing it locally to the VI (Array - usually maintained in a shift register), and then writing the file with a header (acquisition parameters, test article information, data column headers) and the data all at once in batch mode to the file after the process is finished.  If, however, it is longer than that you would be better off starting a data file with a header and appending the data to the file as you go, so that if something happens during your test, you at least have data up to that point.
    Hope this Helps,
    Kurt

  • I am programming a DVD-Rom in DVD Studio Pro 4 and need to display and open pdf files, any suggestions?

    I am programming a DVD-Rom in DVD Studio Pro 4 and need to display and open pdf files, any suggestions?

    http://documentation.apple.com/en/dvdstudiopro/usermanual/index.html#chapter=22% 26section=9%26tasks=true

  • I write digital port by 'DAQmx Configure Logging.vi​' and receive TDMS file with 8 boolean channels. How can I write to 1 integer channel?

    Hello!
    I want to write 1 digital port from PXI-6536 with streaming to TDMS file.
    I'm writing by 'DAQmx Configure Logging.vi' and become TDMS file with 8 boolean channels.
    How can I write to 1integer channel?
    Attachments:
    1.JPG ‏27 KB

    Hey Atrina,
    The actual data stored on disk is just the raw data (that is, a byte per sample in your case).  It's really just a matter of how that data is being represented in LabVIEW whenever you read back the TDMS file.
    I'm not sure if there is a better way to do this, but here is a way to accomplish what you're wanting:
    Read back the TDMS file as a digital waveform.  Then there's a conversion function in LabVIEW called DWDT Digital to Binary.  This function will convert that set of digital channels into the "port format" that you're wanting.  I've attached an example of what I mean.
    Note: When looking at this VI, there are a few things that the downgrade process did to the VI that I would not recommend for these TDMS files.  It added a 1.0 constant on the TDMS Open function, and it set "disable buffering" on the TDMS Open function to false; you can get rid of both of those constants.
    Message Edited by AndrewMc on 01-27-2010 11:21 AM
    Thanks,
    Andy McRorie
    NI R&D
    Attachments:
    digitalconvert.vi ‏13 KB

Maybe you are looking for