Sound file write

Hi,
I am taking sound input from mic and writing it in a wav file (using example Sound Input to file).
but when i feed the signal from function (signal) generator greater than 1 V then the recorded wav file shows clipping in the example read sound file to chart.
Regards,
Shrek

shrekt wrote:
Hi,
 I am taking sound input from mic and writing it in a wav file (using example Sound Input to file).
 but when i feed the signal from function (signal) generator greater than 1 V then the recorded wav file shows clipping in the example read sound file to chart.
 Regards,
 Shrek
Clipping will occur then you go outside the AD converter voltage range. So what did you hope to see from your test? 
Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)

Similar Messages

  • Is it right to use the "sound file write simple.vi"?

    I had a problem to use the Sound File Write Simple.vi  that is it can not save the data.
    The links are shown in the following picture.
    I wonder is it right for me to use that vi like that shown in the picture?
    And why I can not save file as *.wav while I can save it as a *.txt?
    Thank you!
    Attachments:
    Image00003.jpg ‏77 KB

    No command lines do not work inside stored procedures.
    Firstly, remember that the stored procedure is running on the database server so any files it can access have to be on the server itself.
    ZIP is an operating system command, so you would have to have some java code or some other means of shelling out to the operating system to execute it, an area which I'm not to familiar with doing myself as I've never found a need to.
    Have you looked at Oracles own UTL_COMPRESS package?

  • How do I transfer a sound file via TCP?

    I have a .wav file that I'm trying transfer via TCP.  Using LV 8.5, I modified the "Sound File to Output.vi" example to send the data across a TCP connection to a client vi.  But, I've encountered numerous errors along the way with trying to convert the sound data which is a  1-D array of waveform double.  I've attached my server and client VI, but essentially, what I tried to do is break down the array into the y and dt components, send those over the TCP connection, rebuild the waveform client-side, and then play the waveform.  Is there something I'm missing?  Do I need the timestamp information as well and send that over too?  Please let me know how this can be accomplished.  Thanks!
    Attachments:
    Streaming Music - Server.vi ‏97 KB
    Streaming Music - Client.vi ‏65 KB

    One thing to clarify: While the Sound Output Write does not need the dt information, the dt information wouold be required when you use the Configure VI in order to set up the rate.  However, you only need to send that parameter once. Thus, it would seem to me that you want to change your client code so that it checks to see if it receives a special command or something to indicate the start of a new song that may have been sampled at a different rate. If this is the case, then you can reconfigure the sound output. Otherwise, all that you're listening for is just song data that you send along to the Sound Output Write.

  • How to input sound file into MS Access Database, not random folder?

    Hi, I am trying to input a sound file into an MS Access 2000 database, I know it can be copied and pasted into there, but how can u input into the database with a user record, i also need the code to extract it as well as inputting it....at the moment it records the sound and stores it as test.wav on the local drive....
    here is my code for my applet do far....
    compile this file first....
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.*;
    import java.io.IOException;
    import java.io.File;
    import java.net.URL;
    import javax.sound.sampled.DataLine;
    import javax.sound.sampled.TargetDataLine;
    import javax.sound.sampled.AudioFormat;
    import javax.sound.sampled.AudioSystem;
    import javax.sound.sampled.AudioInputStream;
    import javax.sound.sampled.LineUnavailableException;
    import javax.sound.sampled.AudioFileFormat;
    public class VoicePasswordRecorder extends Thread {
         private TargetDataLine m_line;
         private AudioFileFormat.Type m_targetType;
         private AudioInputStream m_audioInputStream;
         private File m_outputFile;
         public VoicePasswordRecorder(TargetDataLine line,
                             AudioFileFormat.Type targetType,
                             File file)
              m_line = line;
              m_audioInputStream = new AudioInputStream(line);
              m_targetType = targetType;
              m_outputFile = file;
         /** Starts the recording.
             (i) The line is started,
              (ii) The thread is started,
         public void start()
              /* Starting the TargetDataLine. It tells the line that
                 data needs to be read from it. If this method isn't
                 called then it won't be able to read data from the line.
              m_line.start();
              /* Starting the thread. This call results in the
                 method 'run()'being called. There, the
                 data is actually read from the line.
              super.start();
         /** Stops the recording.
             Note that stopping the thread is not necessary. Once
             no more data can be read from the TargetDataLine, no more data
             can be read from the AudioInputStream. The method 'AudioSystem.write()'
             (called in 'run()' returns. Returning from 'AudioSystem.write()'
             is followed by returning from 'run()', and then the thread
             stops automatically.
         public void stopRecording()
              m_line.stop();
              m_line.close();
         /** Main working method.
             'AudioSystem.write()' is called.
              Internally, it works like this: AudioSystem.write()
             contains a loop that is trying to read from the passed
             AudioInputStream. Since there is a special AudioInputStream
             that gets data from a TargetDataLine, reading from the
             AudioInputStream leads to reading from the TargetDataLine. The
             data read this way is then written to the passed File. Before
             writing of audio data starts, a header is written according
             to the desired audio file type. Reading continues until no
             more data can be read from the AudioInputStream. In this case,
             it happens if no more data can be read from the TargetDataLine.
             This happens if the TargetDataLine is stopped. Then,
             the file is closed and 'AudioSystem.write()' returns.
         public void run()
                   try
                        AudioSystem.write(
                             m_audioInputStream,
                             m_targetType,
                             m_outputFile);
                   catch (IOException e)
                        e.printStackTrace();
         public static void main(String[] args)
              if (args.length != 1 || args[0].equals("-h"))
                   printUsageAndExit();
              /* There is only one command line argument.
                 This is taken as the filename of the soundfile
                 to store to.
              String     strFilename = args[0];
              File     outputFile = new File(strFilename);
              /* For simplicity, the audio data format used for recording
                 is hardcoded here. The PCM 44.1 kHz, 16 bit signed,
                 stereo was used.
              AudioFormat     audioFormat = new AudioFormat(
                   AudioFormat.Encoding.PCM_SIGNED,
                   44100.0F, 16, 2, 4, 44100.0F, false);
              /* Here, the TargetDataLine is being received. The
                 TargetDataLine is used later to read audio data from it.
                 If requesting the line was successful, it will open it.
              DataLine.Info     info = new DataLine.Info(TargetDataLine.class, audioFormat);
              TargetDataLine     targetDataLine = null;
              try
                   targetDataLine = (TargetDataLine) AudioSystem.getLine(info);
                   targetDataLine.open(audioFormat);
              catch (LineUnavailableException e)
                   out("unable to get a recording line");
                   e.printStackTrace();
                   System.exit(1);
              AudioFileFormat.Type     targetType = AudioFileFormat.Type.WAVE;
              /* The creation of the VoicePasswordRecorder object.
                 It contains the logic of starting and stopping the
                 recording, reading audio data from the TargetDataLine
                 and writing the data to a file.
              VoicePasswordRecorder     recorder = new VoicePasswordRecorder(
                   targetDataLine,
                   targetType,
                   outputFile);
              /* It is waiting for the user to press ENTER to
                 start the recording.
              out("Press ENTER to start the recording.\n");
              try
                   System.in.read();
              catch (IOException e)
                   e.printStackTrace();
              /* Here, the recording is actually started.
              recorder.start();
              out("Recording...\n");
              /* It is waiting for the user to press ENTER,
                 this time to signal that the recording should be stopped.
              out("Press ENTER to stop the recording.\n");
              try
                   System.in.read();
              catch (IOException e)
                   e.printStackTrace();
              /* Here, the recording is actually stopped.
              recorder.stopRecording();
              out("Recording stopped.\n");
         private static void printUsageAndExit()
              out("VoicePasswordRecorder: usage:");
              out("\tjava VoicePasswordRecorder -h");
              out("\tjava VoicePasswordRecorder <audiofile>");
              System.exit(0);
         private static void out(String strMessage)
              System.out.println(strMessage);
    import java.awt.*;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.io.*;
    import javax.sound.sampled.*;
    import javax.swing.*;
    public class AppletTest extends JApplet
        implements ActionListener
        public AppletTest()
            comp = null;
            startrecording = null;
            stoprecording = null;
            recorder = null;
        public void init()
            Panel panel = new Panel(new FlowLayout(1));
            comp = new JTextArea(50, 50);
            comp.setPreferredSize(new Dimension(50, 50));
            comp.setEditable(false);
            JButton startrecording = new JButton("Start");
            JButton stoprecording = new JButton("Stop");
            comp.append("Please record your Voice Password...\n");
            GridBagLayout gridbag = new GridBagLayout();
            GridBagConstraints c = new GridBagConstraints();
            getContentPane().setLayout(gridbag);
            c.weightx = 1.0D;
            c.weighty = 1.0D;
            gridbag.setConstraints(comp, c);
            gridbag.setConstraints(panel, c);
            getContentPane().add(comp, c);
            getContentPane().add(panel, c);
            c.weightx = 0.0D;
            c.weighty = 0.0D;
            startrecording.setEnabled(true);
            stoprecording.setEnabled(true);
            startrecording.addActionListener(this);
            gridbag.setConstraints(startrecording, c);
            getContentPane().add(startrecording, c);
            stoprecording.addActionListener(this);
            gridbag.setConstraints(stoprecording, c);
            getContentPane().add(stoprecording, c);
            int width = 300;
            int height = 200;
            setSize(width, height);
            setVisible(true);
            boolean looping = false;
        public void actionPerformed(ActionEvent ae)
            if(ae.getActionCommand().equals("Start"))
                createRecorder();
                recorder.start();
                System.out.println("Start Button Clicked");
            } else
            if(ae.getActionCommand().equals("Stop"))
                recorder.stopRecording();
                System.out.println("Stop Button Clicked");
        private void createRecorder()
            String strFilename = "C:\test.wav";
            File outputFile = new File(strFilename);
            AudioFormat audioFormat = new AudioFormat(javax.sound.sampled.AudioFormat.Encoding.PCM_SIGNED, 44100F, 16, 2, 4, 44100F, false);
            javax.sound.sampled.DataLine.Info info = new javax.sound.sampled.DataLine.Info(javax.sound.sampled.TargetDataLine.class, audioFormat);
            TargetDataLine targetDataLine = null;
            try
                targetDataLine = (TargetDataLine)AudioSystem.getLine(info);
                targetDataLine.open(audioFormat);
            catch(LineUnavailableException e)
                comp.append("unable to get a recording line\n");
                e.printStackTrace();
                System.exit(1);
            javax.sound.sampled.AudioFileFormat.Type targetType = javax.sound.sampled.AudioFileFormat.Type.WAVE;
            recorder = new SimpleAudioRecorder(targetDataLine, targetType, outputFile);
            comp.append("Press ENTER to start the recording.\n");
            try
                System.in.read();
            catch(IOException e)
                e.printStackTrace();
            comp.append("Recording...\n");
            comp.append("Press ENTER to stop the recording.\n");
            try
                System.in.read();
            catch(IOException e)
                e.printStackTrace();
            comp.append("Recording stopped.\n");
        private JTextArea comp;
        private JButton startrecording;
        private JButton stoprecording;
        private SimpleAudioRecorder recorder;
    }I intend to use this for verifying the username, password and a voice password over the web....as shown in the following code...
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <meta http-equiv="Content-Language" content="en-us">
    <title>Home Page</title>
    <meta name="GENERATOR" content="Microsoft FrontPage 5.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <meta name="Microsoft Theme" content="artsy 011, default">
    <meta name="Microsoft Border" content="tl, default">
    </head>
    <body background="arttilea.jpg" bgcolor="#000000" text="#FFFFCC" link="#FF9900" vlink="#999900" alink="#669933">
    <!--mstheme--><font face="Arial, Helvetica">
          <p align="left"><font size="4" color="#FFFFFF">Please enter login
          details below:</font></p>
    <form>
    <!--mstheme--></font><table border=0 cellpadding=3 cellspacing=3>
    <tr>
        <td align=right width="74"><!--mstheme--><font face="Arial, Helvetica">
          <p align="left"><font face="Arial, Helvetica, sans-serif"><b><i>Username</i></b></font></p>
        <!--mstheme--></font></td>
        <td width="335"><!--mstheme--><font face="Arial, Helvetica">
          <p align="left"><input type=text
          name=username size="20"></p>
        <!--mstheme--></font></td>
    </tr>
    <tr>
        <td align=right width="74"><!--mstheme--><font face="Arial, Helvetica">
          <p align="left"><font face="Arial, Helvetica, sans-serif"><b><i>Password</i></b></font></p>
        <!--mstheme--></font></td>
        <td width="335"><!--mstheme--><font face="Arial, Helvetica">
          <p align="left">
            <input
            type=password name=password size="20"></p>
          <!--mstheme--></font></td>
      </tr>
      <tr>
        <td align=center width="74"><!--mstheme--><font face="Arial, Helvetica">
          <p align="left"><font face="Arial, Helvetica, sans-serif"><b><i>Voice
          Password Check</i></b></font></p>
        <!--mstheme--></font></td>
        <td width="335"><!--mstheme--><font face="Arial, Helvetica">
           <p align="left">
    <APPLET CODE="AppletTest.class" ALIGN="MIDDLE" WIDTH=272 HEIGHT=38 NAME="AppletTest.class"></APPLET> </p>
        <!--mstheme--></font></td>
      </tr>
    <tr>
        <td colspan=2 align=center><!--mstheme--><font face="Arial, Helvetica">
        <p align="left"><font face="Arial Narrow"><input type=submit value="Enter Website" name="Submit"></font></p>
        <!--mstheme--></font></td>
    </tr>
    </table><!--mstheme--><font face="Arial, Helvetica">
    </form>
          <p align="left">This page was last updated on <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d/%m/%y" startspan -->25/03/04<!--webbot bot="Timestamp" endspan i-checksum="12776" -->.</p>
    <!--mstheme--></font></body>
    </html>I will be very grateful if somebody could help me out....as this is my first time at java programming ....also my first time for using this forum!
    Thanks,
    Regards,
    Mayur Patel

    Hi
    I Learned how to read a file text and Parse as StringTokenizer. But still i don't know how to read the Individual tokens into to database.
    But now i face a new Problem, i am not able to sort it out.
    i am posting my code
    import java.io.FileReader;
    import java.io.FileWriter;
    import java.io.BufferedReader;
    import java.io.PrintWriter;
    import java.io.IOException;
    import java.io.*;
    import java.util.*;
    public class CSVExample {
        public static void main(String[] args) throws IOException {
            BufferedReader inputStream = null;
            PrintWriter outputStream = null;
            try {
                inputStream = new BufferedReader(new FileReader("file.csv"));
              String text;
                 while((text=inputStream.readLine())!= null)
                    StringTokenizer st = new StringTokenizer(text);
                         if(st.hasMoreTokens())
                        System.out.println(st.nextToken());
            } finally {
                if (inputStream != null) {
                    inputStream.close();
    }Here the Problem is The file.csv has got two fields ID, NAME The content of this file is as follows
    T12,MR.RAJ KUMAR
    T13,MR.EARNEST DIES
    T14,MR.MATHEW HYDEN
    Now when i StringTokenize this File The Output printed as follows
    T12,MR.RAJ
    T13,MR.EARNEST
    T14,MR.MATHEW
    That means when it finds the Space it is not printing the Remaining Text.
    Please Help me in this and then Tell me how to INSER The Tokens into the Database Table
    Thank you for your service
    Cheers
    Jofin

  • 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

  • Sound File not creating from simulate signal

    I am trying to create a white noise sound file.
    100 Hz to 8000 Hz 100ms long with a 10 ms ramp up and 10 ms ramp down.
    I have been able to create the signal and sound in this vi.
    Create sound - 8000 hz white noise
    High pass filter - remove noise below 100 hz
    ratio window - causes ramps
    turn back into waveform - why oh why
    normalize after filtering - for some reason the filtering changes the height of the whole waveform, if you have a solution to this......
    play back sound
    write sound to wav file.
    The problem is, I can only get a file as short as 500 ms.  I did this by changing the simulate signal options selecting 8000 samples at 16000 Hz.
    If I select 1600 samples (the number of samples needed for 100 ms) some error occurs in the writing process, and the file thinks it's still open by labview.  If I close labview, the file still does not work.  How can I do what I need to do?  Why can't I just reduce the number of samples to 1600 and get a 100 ms long waveform?
    -Regards
    eximo
    UofL Bioengineering M.S.
    Neuronetrix
    "I had rather be right than be president" -Henry Clay
    Attachments:
    white noise generator.vi ‏169 KB
    White noise generator.PNG ‏40 KB

    The Labview sound system is something that NI do not care much about. They actually neglect it. Errors reported in version 8.6 are still not fixed in Version 2010. And if they fix errors you can be sure some new errors will be introduced. What you can try to do is using the old sound system (used in 7.x) for writing your data to file. In your case it should have much to say. You will find the old sound system here ..\National Instruments\LabVIEW 20xx\vi.lib\sound\sound.llb
    Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
    (Sorry no Labview "brag list" so far)

  • Sound File into AIFF file, 8 Bits, 8 Khz.

    Write a small program that takes any sound file and converts it to: AIFF file, 8-bit, and 8-kHz, and a single channel.
    Explain each step plese.

    No, you should not lose any quality. File sizes are comparable, but .aiff supports a tag to which you can add artwork, .wav doesn't. If you want smaller files with no loss of quality convert to Apple Lossless. One of my test files is about 2/3 the size of the original.
    tt2

  • Sound file and custom play.

    Hello, I have an sound file and, want to play part's of this file not the whole sound file every time, in my application.
    e.g i want to play from 1:23 min till 1:29 min can i do this in an iphone app and how?
    Thanks in advance!

    yes i know that way, but i want to have a big sound file and keep some pointers in an array with the seconds i want, depending some user actions, the whole sound file is usable, but in different user actions different parts of it will be played! Is there a way doing that? Without splitting the file into pieces?
    A similar example could be found at youtube comments when someone writes a time point...example 3:25 of the video this refers to a link and when its pressed you auto transferred to the 3:25 'th second of the video....I tried to give you a related usage...I dont know if you understand what i mean...
    thanks anyway!
    Message was edited by: ZaaBI_AlonSo

  • Reg: File Write err-

    Hi Experts,
    I've a procedure where I'm using
    DBMS_XSLPROCESSOR.clob2file(v_xml_charset,'TEST_DIR',v_filename);to place a XML generated into a Server directory (in an UNIX box).
    On executing the proc, a blank file (size=0) is getting generated in the UNIX directory. But it also throws an error to the client where I'm executing the proc.
    Error at line 1
    ORA-29285: file write error
    ORA-06512: at "SYS.UTL_FILE", line 183
    ORA-06512: at "SYS.UTL_FILE", line 1169
    ORA-06512: at "XDB.DBMS_XSLPROCESSOR", line 333
    ORA-06512: at "SCHEMA_X.PROC_X", line 136
    ORA-06512: at line 4Also I checked the Grants, Do i need to give READ/WRITE grants to this directory??
    Found a similar thread: Error with dbms_xslprocessor.clob2file
    Any help is much appreciated.
    Thanks,
    Ranit

    ranit B wrote:
    I didn't understand you clearly but this sounds like something helpful. Can you put some more light on this?
    Why because -
    "This is in directory TEST_DIR"
    -rw-r--r--   1 oracle   emk            0 May  8 01:54 file_x.xml
    "This is in directory TEST_X"
    -rw-r--r--   1 oracle   oinstall  116274 May  8 02:09 file_x.xmlWhat does the 4th column indicate? Some special user?The 4th column is the unix group name rather than the 3rd column which is the owner name.
    Did you manually create that file_x.xml in the TEST_DIR directory, or has that been created by Oracle? If so, then Oracle has been able to write to the directory, so the issue may be around space on the disk?
    Just to check do...
    df -k .in the TEST_DIR directory and see what it reports.

  • Sound file storing in Database &  accessing these files

    Hi Friends
    i have working on the project of Sound Recognization system
    the requirement is that sound should be passed through mike input device & that sound should be stored in to database along with the user & password
    for recognization & identification of user
    But problem in storing the sound files in the database so how can i store the files into the database so please guide me.

    brad103 wrote:
    In my particular application, I process the byte array from the TargetDataLine. Then I save this to a db using new ByteArrayInputStream(soundData), soundData.length); where soundData is my byte[].
    Am I correct that this will save the data in the relevant format (eg PCM_SIGNED, 8k, 16bit, etc), but the header information is not included? That's correct. Essentially, in JavaSound, that data has an associated "Format" object that was part of the line the data came from, would need to be given to any line the data was going to...and that format object is essentially a container for all of the header data...
    And if so, then if I control the saving and retrieval then I can omit that step anyway as I know the format?You can omit the AudioSystem.write step and store the byte[] directly into the database...as long as you're capable of, as above, recreating the Format object that was originally associated with the data.
    And my next question (digressing slightly, sorry umeshS), is that when using the tritonus gsm library and converting from above format to gsm, should I be using AudioSystem.write to write to an outputstream prior to calling AudioSystem.getAudioInputStream(targetEncoding, originalAIS) to convert encodings?AudioSystem.write adds the file header to the stream, and that's all. If you're using a "stream", you have to have the Format object in order to create an AudioInputStream, so there's no need to add the file header (and the file header will screw things up if you're not using the File or URL versions of getAudioInputStream)...
    So, as a giant summary...
    AudioSystem.write adds a file header, which will include format information. This should only be used if you're planning on using AudioSystem.getAudioInputStream(File f) to read the file the next time.
    Otherwise, just save the data and the Format object associated with the data, so you can read it all back in later by building an AudioInputStream around your favorite IO stream.
    And in retrospect, after explaining all of that...umeshS, the problem with the way you're doing it is that when you copy the file into the database, you're copying the file header. And then, because you're not using the "File" version of AudioSystem.getAudioInputStream, the system isn't handling the file header being there correctly.
    You need to copy things into the database by creating an audioinputstream of your file, and then saving out the raw byte[] data. You can just call "read" on the ais a bunch of times and throw the results into your stream. Then, you can play it by pulling the data out of the database via a stream, and playing that stream by throwing it back into an AudioInputStream.

  • The sound file not work

    HI,
    Here i want to get sound file then i want to play it . I did that but when i play it , it's not work .why ??
    my code :
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.event.ActionListener;
    import java.io.*;
    import javax.sound.sampled.*;
    import javax.sound.sampled.UnsupportedAudioFileException;
    import javax.swing.*;
    public class SoundTest extends JFrame {
        private JPanel panel, mainPanel;
        //   private JTextField textField;
        private JButton getButton, playButton;
        private JFileChooser fileChooser;
        private MyActionListener myActionListener;
        public SoundTest() {
            myActionListener = new MyActionListener();
            panel = new JPanel(new BorderLayout());
            mainPanel = new JPanel(new FlowLayout());
            //       textField = new JTextField(10);
            getButton = new JButton("get audio file");
            getButton.addActionListener(myActionListener);
            playButton = new JButton("play");
            playButton.addActionListener(myActionListener);
            //     mainPanel.add(textField);
            mainPanel.add(getButton);
            mainPanel.add(playButton);
            panel.add(mainPanel, BorderLayout.WEST);
            getContentPane().add(panel);
            fileChooser = new JFileChooser();
        public static void main(String[] args) {
            SoundTest soundTest = new SoundTest();
            soundTest.setDefaultCloseOperation(SoundTest.EXIT_ON_CLOSE);
            soundTest.setSize(new Dimension(600, 300));
            soundTest.setLocationRelativeTo(null);
            soundTest.setVisible(true);
        private class MyActionListener implements ActionListener {
            SourceDataLine sourceDataLine = null;
            public void actionPerformed(ActionEvent e) {
                if (e.getSource() == getButton) {
                    int returnValue = fileChooser.showOpenDialog(SoundTest.this);
                    if (returnValue == JFileChooser.APPROVE_OPTION) {
                        File file = fileChooser.getSelectedFile();
                        crateAudio(file);
                } else if (e.getSource() == playButton) {
                    playAudio();
            private void crateAudio(File file) {
                AudioInputStream audioInputStream = null;
                try {
                    audioInputStream = AudioSystem.getAudioInputStream(file);
                } catch (UnsupportedAudioFileException ex) {
                    ex.printStackTrace();
                } catch (IOException ex) {
                    ex.printStackTrace();
                AudioFormat audioFormat = audioInputStream.getFormat();
                DataLine.Info info = new DataLine.Info(SourceDataLine.class, audioFormat);
                try {
                    sourceDataLine = (SourceDataLine) AudioSystem.getLine(info);
                    sourceDataLine.open(audioFormat);
                } catch (LineUnavailableException ex) {
                    ex.printStackTrace();
            private void playAudio() {
                sourceDataLine.start();
    }Thanks in advnce

    beshoyatefw wrote:
    Here i want to get sound file then i want to play it . I did that but when i play it , it's not work .why ??Because there's no code that actually plays the file? Source data lines don't play the file when you open them, you have to manually read data from the AudioInputStream and write it to the SourceDataLine...and you're not doing that.
    You essentially walked into the bathroom, lifted the toilet seat and unzipped your pants...and wondered why the toilet wasn't making that "I'm peeing" sound. It's because you didn't start actually moving urine from your bladder to the toilet...

  • Problems with sound VIs - can't create usable new sound file

    hello all!
    I'm trying to create a VI that will, in real time, take a sound file and place it, on demand, as many times as you want into a longer sound file.  it should place the file once each time a button is pressed.  The rest of the audio I want to be just silence, but still filling time so that the output file is in real time.
    (i am a sound editor for TV shows, and for my master's thesis i'm trying to create this program so that I could say, watch a video clip of someone walking and at the same time place footstep sounds in real time while watching the clip, just by pressing a button each time i see a footfall.)
    i attached the VI i have so far.  the only subVIs are in the Sound VI palette (no custom subVIs are used).  No external hardware is used, so you should be able to see exactly what i see.  i would attach the WAV file, but it's not an allowed attachment.  You should be able to use any WAV, stereo 16-bit, 44.1 kHz file.
    the problem i'm having so far:
    the resulting WAV file is not playable by any means I can figure out.  and it's always 4 KB.  So obviously I'm missing something - maybe misuse of the Sound VIs?  (Though the VI does recognize that I'm feeding it a stereo, 44.1kHz, 16-bit file.  so that's good.)
    i'm working on a Mac Powerbook G4, Labview 8.2, 1.5 GHz, Mac OS 10.4.8, 1 GB RAM.  and i've tried both the
    internal sound card and an external sound card (Digidesign's MBox which works with
    ProTools).
    thanks so much for your help!!
    --Liz F.
    Attachments:
    prototypeA.vi ‏31 KB

    Is a printer connected? Is it turned ON? Is the driver up to date?
    Illustrator checks this every time and also writes information on the printer into the file.

  • Make sound file from byte array?

    Ok say I have a program that gets a byte array from a sound file and then randomly removes some of the samples from the array, so that instead of having a value the bytes are just zeroes. I then want to play my new byte array. Here is the code I try to use but when I use it nothing happens.
    AudioFormat = ((AudioInputStream) AudioSystem.getAudioInputStream(**The Original Sound File**)).getFormat();
    int numBytesRead = 0;
    DataLine.Info dataLineInfo = new DataLine.Info(SourceDataLine.class, audioFormat);
    SourceDataLine sourceDataLineTemp = (SourceDataLine)AudioSystem.getLine(dataLineInfo);
    sourceDataLineTemp.write(audioArray, 0, audioArray.length);(Try..catch removed for clarity.)
    Also, is it possible to convert a byte array to a .wav sound file?

    Im pretty sure if you just write that byte array to disk and open it as a wav file that will do the trick, because thats all a wav file is anyways, a stream of bytes representing audio

  • Read sound file from disk in Java

    Write a simple application that reads a sound file from disk (use a Clip). Play the sound backwards by arranging the byte arrays/frames in the reverse order.
    Please I need an explanation of every step.
    Get some Duke Dollars for your help.

    Hi,
    When execute this code, I see this: "[Ljava.io.File;@111f71".   
    How I can see the name of the File, and How I can run a program with one by one from the files reader in a parameter ???
      Thank's.
       Hervey P.                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • [svn:bz-3.x] 15191: Minor update to the build. xml and only make files write protected with chmod.

    Revision: 15191
    Revision: 15191
    Author:   [email protected]
    Date:     2010-04-01 07:06:21 -0700 (Thu, 01 Apr 2010)
    Log Message:
    Minor update to the build.xml and only make files write protected with chmod.
    Modified Paths:
        blazeds/branches/3.x/modules/sdk/build.xml

    DyNamic I agree that is sounds like you may be facing a network configuration issue.  Please let your network people know that you need access to the following servers and ports to download Adobe applications through the Adobe Application Manager:
    ccmdls.adobe.com:443
    ims-na1.adobelogin.com:443
    na1r.services.adobe.com:443
    prod-rel-ffc-ccm.oobesaas.adobe.com:443
    lm.licenses.adobe.com:443
    In addition for updates to download properly you will also need access to the following servers:
    http://www.adobe.com/:80
    htttp:///swupmf.adobe.com/:80
    http://swupdl.adobe.com/:80
    http://crl.adobe.com/:80

Maybe you are looking for

  • Heat cpu/hdd hp pavilion dv6t-7000

    Product name: HP Pavilion dv6t-7000 CTO Entertainment Notebook Problem: Over heating on the CPU and fan noizes More details: O.S. Windows 7 Ultimate Service Pack 1 CPU: Intel Core i7-3610 QM @ 2.30 GHZ RAM: 8.00 GB 64 Bit My message:  Greetings fella

  • Problem with OCI call  and  how to install and use 'DEBUG_EXTPROC' on Linux

    Hi, Can any one let me know how I can install and use this debug_extproc package. I have installed oracle XE server on Linux machine(32-bit). When I use : DEBUG_EXTPROC.STARTUP_EXTPROC_AGENT' ... i get an error saying that : it is not declared. I tri

  • Printing a Numbers document

    I want to print a Numbers document from an iPad2 to a WiFi Canon MX882 printer. I have Numbers Version 1.5 on my iPad and Numbers '08 on my new iMac with Lion. I've tried sending the document to Numbers on the iMac but it says I must use Numbers '09.

  • Auto Login from System A to System B on click on link from application

    Hi, I am developing a application in which I am trying to integrate multiple systems. For example : The application has been developed from System A. System A calls System B,C,D,E,F,G etc on click on corresponding links. Looking for ABAP code to call

  • AppleWorks documents not opening

    So I don't really know what I am doing. I have a really old version of Apple Works on my old computer and have taken all the documents from it and put them on my MBP. I have not bought Word, Page 2, or Apple Works. Any suggestions on which one I shou