Writting a wave without specifying the length.

I'm trying to write a wave file (ULAW 8000.0 Hz, 8 bit, mono, 1 bytes/frame) and I get the following error:
Exception in thread "main" java.io.IOException: stream length not specified
     at com.sun.media.sound.WaveFileWriter.write(WaveFileWriter.java:114)
     at javax.sound.sampled.AudioSystem.write(AudioSystem.java:1297)
     at com.bell.cts.vsaudioprocessor.AudioProcessor.convertAudio(AudioProcessor.java:164)
     at TestMe.main(TestMe.java:67)
I use the AudioSystem.write(...) method to stream my audio. And because the original audio format is an MP3 I cannot know the length (in frames) of the result file.
Do you know another way to stream my audio? Or a way to get the length of the file without reading it completly.
Thanks.
Guillaume Girard

I'm trying to write a wave file (ULAW 8000.0 Hz, 8 bit, mono, 1 bytes/frame) and I get the following error:
Exception in thread "main" java.io.IOException: stream length not specified
     at com.sun.media.sound.WaveFileWriter.write(WaveFileWriter.java:114)
     at javax.sound.sampled.AudioSystem.write(AudioSystem.java:1297)
     at com.bell.cts.vsaudioprocessor.AudioProcessor.convertAudio(AudioProcessor.java:164)
     at TestMe.main(TestMe.java:67)
I use the AudioSystem.write(...) method to stream my audio. And because the original audio format is an MP3 I cannot know the length (in frames) of the result file.
Do you know another way to stream my audio? Or a way to get the length of the file without reading it completly.
Thanks.
Guillaume Girard

Similar Messages

  • TEXT_IO.FOPEN how to pick file without specifying the full directory path

    Hi,
    I am using Oracle application server 10gR2 on Linux with forms 10g application. I am building the DEV/TEST/UAT environment on same Linux machine with one OAS.
    I am using TEXT_IO.FOPEN ('/home/oracle/check.txt','r') to read a server side file and it is working fine.
    Now I want to pick this file dynamically i.e. without specifying the full path. I am using TEXT_IO.FOPEN ('check.txt','r') and I copied file in forms_path directory in linux and even in $path directory in linux but none of them are working.
    Pls help me sort out this problem.
    Thanks in advance

    Hi,
    I have to read files in my app directory using TEXT_IO how is that possible?? I cannot set workingDirectory as my Oracle home is in a different location and as has been mentioned by others when I run the form on web it cannot seem to find the file in the default forms directory where all the .fmx file
    Is there any other file setting that needs to be done??
    Please help
    Thanks & Regards
    Mangesh Deshpande

  • How to call or open without specifying the full path?

    hi all,
    how to call or open without specifying the full path?
    for example the following code of a when_button_pressed trigger.
    call_form('c:\test\student.fmx',hide,do_replace);
    open_form('c:\test\student.fmx');
    i want to specify only the form name.
    call_form('student.fmx');
    open_form('student.fmx');
    i m using developer 2000.
    regard
    Muhammad Nadeem
    [email protected]

    HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\FORMS60_PATH=c:\test\;c:\orant\bin;...

  • How can i run external application without specifying the full path?

    for example, ms word executable file is winword.exe, but in java i am using the following command:
    Runtime.getRuntime().exec("\"C:\\Program Files\\Microsoft Office\\Office10\\winword.exe\");
    the thing is, i dont know where ms word is installed on every machine, so rather than making an assumption, do you know how i can run ms word without specifying the full path?
    thanks

    1) You could ask the user to tell you where it's at (and remember for next time)
    2) You could do a file search for it (and remember it for next time)

  • Access other schema's table without specify the schema name

    Hi, need ur help again,
    I would like to access other schema's table without specify the schema name. for example,
    select * from hr.jobs;
    What priviledges i need if i want to select the data in this way:
    select * from jobs;
    Thanks!

    Public synonyms have their place, but are not generally a good idea as they will cause conflicts with other schemas and applications. Another think that you can do is issue the
    ALTER SESSION set CURRENT_SCHEMA = schema;
    The CURRENT_SCHEMA (8i and above) parameter changes the current schema of the session to the specified schema. Subsequent nqualified references to schema objects during the session will resolve to objects in the specified schema. The setting persists for the duration of the session or until you issue another ALTER SESSION SET CURRENT_SCHEMA statement. CURRENT_SCHEMA is a session parameter only, not an initialization parameter.
    This setting offers a convenient way to perform operations on objects in a schema other than that of the current user without having to qualify the objects with the schema name. This setting changes the current schema, but it does not change the session user or the current user, nor does it give you any additional system or object privileges for the session.

  • Create a tablespace without specifying the datafile path and name

    HI,
    Is it possible to create a tablespace without specifying the datafile path and name.
    For eg : if we just specify the tablespace name and the size of the datafile, the datafile should be created in a default location with default name? Is it possible?

    user13364377 wrote:
    HI,
    Is it possible to create a tablespace without specifying the datafile path and name.
    For eg : if we just specify the tablespace name and the size of the datafile, the datafile should be created in a default location with default name? Is it possible?Using Oracle-Managed Files
    Oracle internally uses standard file system interfaces to create and delete files as needed for the following database structures:
    * Tablespaces
    * Online redo log files
    * Control files
    Through initialization parameters, you specify the file system directory to be used for a particular type of file.
    EXAMPLE:
    The following parameter settings are included in the initialization parameter file:
    DB_CREATE_FILE_DEST = '/u01/oradata/sample'
    DB_CREATE_ONLINE_LOG_DEST_1 = '/u02/oradata/sample'
    DB_CREATE_ONLINE_LOG_DEST_2 = '/u03/oradata/sample'
    The following statement is issued at the SQL prompt:
    SQL> CREATE DATABASE sample;
    SQL> CREATE TABLESPACE tbs_2 DATAFILE SIZE 400M ;
    SQL> CREATE UNDO TABLESPACE undotbs_1;
    refer the link for more information:
    http://download.oracle.com/docs/cd/B10500_01/server.920/a96521/omf.htm

  • Select from table without specifying the column list.

    I want to reference the columns in select list without specifing the column name of a table.
    For example i am having a table called emp(id number,name varchar2(30)).
    I want to write a query which will display the name of the employees.
    But i don't want to specify the column name in the select list.
    Can anybody help me in this regard.
    Thanks in advance.

    I want to write a query which will display the name
    of the employees.
    But i don't want to specify the column name in the
    select list.So what do you want to specify in the select list?
    One way to display the names of the employees without specifying that you want the names of the employees would be
    select * from emp

  • Reading text files without specifying the encoding?

    I have looked everywhere for a solution, but I can't find one. The problem is that I'm using codes that everybody is using, but for some reason, my codes aren't working.
    I want to be able to open up text files in Java without having to specify the encoding for the files that I'm going read, because I have no idea which encoding they will use.
    But even when specifying UTF-8 to be encoding of the file to read, it doesn't work correctly:
    FileInputStream fileIS= new FileInputStream("somefile.txt");
    Reader reader = new BufferedReader(new InputStreamReader(fileIS, Charset.forName("UTF-8")));
    EVERYWHERE I look, ppl are using these codes! But it doesn't work, some characters (such as the Euro sign) are displayed as squares.
    However, I want to be able to read not only UTF-8 files but anything that Java supports. Any ideas?
    Edited by: Stalfos on Oct 22, 2007 12:22 PM

    Stalfos wrote:
    I want to be able to open up text files in Java without having to specify the encoding for the files that I'm going read, because I have no idea which encoding they will use.
    This is your problem. If you don't know what encoding the text is stored in, then the chances that the default encoding used to read it will be correct are slim.
    But even when specifying UTF-8 to be encoding of the file to read, it doesn't work correctly:There are many different character encodings, and most of them don't overlap. Anything above 127 usually causes problems.
    FileInputStream fileIS= new FileInputStream("somefile.txt");
    Reader reader = new BufferedReader(new InputStreamReader(fileIS, Charset.forName("UTF-8")));
    EVERYWHERE I look, ppl are using these codes! But it doesn't work, some characters (such as the Euro sign) are displayed as squares.The problem isn't with the code, it's that the file you're reading isn't using an encoding that's compatible with UTF-8. Assuming that using UTF-8 should work for all encodings is like assuming that someone who can read Chinese should be able to read a book written in Spanish or Greek. It doesn't work that way.
    However, I want to be able to read not only UTF-8 files but anything that Java supports. Any ideas?You need to know what encoding your files are stored in, period. There are a few ways to guess what the encoding is, but they're only reliable for a small set of encodings.
    You don't seem to truly understand what character encodings are, or how to use them, so read this:
    The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)
    http://www.joelonsoftware.com/articles/Unicode.html

  • How can I start an executable without specifying the directory?

    I have downloaded the tor browser bundle and I would like to be able to start it with a command like "torbrowser" and not by specifying the full directory?

    I don't think it is a good idea to put it in /usr/bin at all but if you must, isn't it safer to move it there, as Trilby suggested? And change the permissions appropriately? That doesn't strike me as especially wise but it seems better than symlinking to an executable in your home directory from /usr/bin.
    One way to mitigate security threats is to limit the PATH root uses. So for an ordinary user, you might include /usr/local/bin or ~/bin. But for root, you wouldn't include these. This makes it a little bit harder to run something malicious as root inadvertently. If you start symlinking to executables in your home directory from /usr/bin, you defeat this. For example, I use this PATH for root:
    /usr/bin:/usr/sbin:/bin:/sbin:/usr/bin/vendor_perl:/usr/bin/core_perl
    So root can't even run stuff under /usr/local on my machine without explicitly giving the path. But if I symlinked from /usr/bin to stuff under ~/, there would be no point in the restriction.
    EDIT: but I just realised sudo can... damn!
    Last edited by cfr (2012-06-24 00:39:59)

  • How come I get all account information without specifying the username pass

    I intsalled the sun directory server and try a couple of sample programs available on the net to see how can i get the infromation form the server.
    The following is the actually code but how come i don't have to specify the user name and passoword??
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
    env.put(Context.PROVIDER_URL, "ldap://192.168.1.196:13769/o=JNDITutorial,dc=opendataldap,dc=com");
    DirContext ctx = new InitialDirContext(env);
    //To read the attributes of an object from the directory, use DirContext.getAttributes()
    Attributes answer = ctx.getAttributes("cn=Ted Geisel, ou=People");
    for (NamingEnumeration ae = answer.getAll(); ae.hasMore();) {
    Attribute attr = (Attribute)ae.next();
    System.out.println("attribute: " + attr.getID());
    /* Print each value */
    for (NamingEnumeration e = attr.getAll(); e.hasMore();
         System.out.println("value: " + e.next()))
    }

    Were u able to connect and retrieve the values??
    If not, you should add these into env variable
    env.put(Context.SECURITY_PRINCIPAL, "cn=Directory Manager");
         env.put(Context.SECURITY_CREDENTIALS, "adminpwd");

  • How can I save a PDF without specifying the directory?

    When I try to save changes I made to a PDF (highlighting and/or commenting), I'm prompted to specify which directory I'd like to save to, and I have to verify that "yes, I want to overwrite the existing file that has the same name". I just want to save the changes I made to the file I made the changes in. Is there a setting I can change to skip all the hassle?
    I'm using Adobe Reader XI and windows 8.1.
    Thank you,
    Ted

    I don't think it is a good idea to put it in /usr/bin at all but if you must, isn't it safer to move it there, as Trilby suggested? And change the permissions appropriately? That doesn't strike me as especially wise but it seems better than symlinking to an executable in your home directory from /usr/bin.
    One way to mitigate security threats is to limit the PATH root uses. So for an ordinary user, you might include /usr/local/bin or ~/bin. But for root, you wouldn't include these. This makes it a little bit harder to run something malicious as root inadvertently. If you start symlinking to executables in your home directory from /usr/bin, you defeat this. For example, I use this PATH for root:
    /usr/bin:/usr/sbin:/bin:/sbin:/usr/bin/vendor_perl:/usr/bin/core_perl
    So root can't even run stuff under /usr/local on my machine without explicitly giving the path. But if I symlinked from /usr/bin to stuff under ~/, there would be no point in the restriction.
    EDIT: but I just realised sudo can... damn!
    Last edited by cfr (2012-06-24 00:39:59)

  • How to get the name of a field without specifying it as a string (somehow v

    Is it possible to get the name of a field (or method) somehow via the class in which it is declared?
    The reason why I ask is, that quite often the name of a field is important, because the name is the anchor for further processing, like for example when using reflection (e.g. Class.getfield(“NameOfTheField”)).
    Assume you have class FooSimple with the field “String firstName”.
    Now you would do something like this:
    Class<FooSimple> cls = FooSimple.class;
    Field f = cls.getField("firstName");
    The problem is, that the string “firstName” is kind of “hard coded”. When the name of the field in class FooSimple changes (e.g. to “theFirstName”), the invocation will not work anymore when you forget to change the string too.
    I think it would be very helpful to have access to the name of the field directly via the class by doing something like this.
    Class<FooSimple> cls = FooSimple.class;
    Field f = cls.getField(FooSimple.firstName.fieldName);
    The Java Compiler would then resolve “FooSimple.firstName.fieldName” to the string “firstName”. When later the name of the field is changed, the IDE would change the name everywhere where it is used. So if the name of the field would be changed to “theFirstName” the IDE would also change the statement to
    Class<FooSimple> cls = FooSimple.class;
    Field f = cls.getField(FooSimple.theFirstName.fieldName);
    A technique like this would be in my opinion much more safety and more generic.
    Any ideas?
    Best Regards.

    Well, I think the discussion is going in a wrong direction because the original issue was not to discuss if it is worth coding some helper classes or a framework or that like. Let me bring it back to my original point.
    Basically you can reduce my original question to this:
    Currently it is possible to use the reflection API on a class level without specifying the name of the class with a string constant.
    My issue is, that I think it would be a nice extension for Java, if the same would be possible for field variables of a Java class. Currently the only way you can do this is by specifying the field variable with a string constant.
    Let me bring some motivations which brought me to this issue.
    Assume you have an entity bean which represents a DB table and you use Java Persistence (either JPA or something like Hibernate). Then you would have a class looking like this (very simple sample to make this reply shorter).
    @Entity
    @Table(name = "PERSON")
    public class Person implements Serializable {
         @Column(name = "NAME")
         private String name;
    // … constructor, getter, setter, etc. not listed here
    }The whole issue of the design of JPA is, that such entity beans represent the mapping between the object model and the DB model, the mapping is expressed with annotations.
    Okay, now let’s assume you write a query in Query Language, e.g.
    String sql = “select p from Person p where name = :name”;“name” is the name of the field variable, “:name” is the parameter you later set with “Query.setParameter” method.
    What is not so nice is the fact, that you use the name of the class and the name of the field variables “hardcoded” to construct the query. Now you could think that basically this information is part of your entity class. First you start with the name of the class (i.e. the table name) to decouple this “hardcoding”.
    You could write instead:
    String sql = “select p from “ + Person.class.getSimpleName() + “ p where name = :name”;This is really nice, because whenever you change the name of your Person class, this change happens automatically for the sql statement as well.
    I think the next thoughts are obvious, now, since you have decoupled the “hardcoded” part of the name of the class, you would like to do the same for the names of the field variables. But now you are stuck, there is no way to do this using a similar technique like for the name of the class. Either you stay with the query as it is now, or, to make it a little bit better, you code string constants for the field variables and use them. This issue brought me to the point that I think it would be nice to have the possibility to get the name of a field variable in a similar way as you can get it for the name of the class.
    Conceptually it is just to go one level deeper, i.e.
    first level is to get the name of a class
    second level is to get the name of the field variable of a class.
    Another sample would be, if you want to code something by using reflection. You have perfectly access to the reflection API starting at the class level like Person.class.allTheNiceReflectionMethods. There is no need to specify the class first with a string constant first, you directly start with the class, you can even be generic and just work on the Class.class level and still have access to all these nice methods to get out the information you need.
    But if you need to start with a very specific field variable (like in the sample above), you must go by using a string constant like Person.class.getDeclaredField(“name”).
    So basically I think that there exist already millions of lines of Java code where a field variable is specified for further processing, especially in combination with the reflection functionality and everywhere the field variables are specified by these string constants in double quotes. I would assume, that everyone has the same problem, once changing the name of the field variable means to take care that also the content of the string which specifies the name of the field variable is changed.
    I am wondering why one of the replies commented, why the name of a field variable is changed, it sounds to me that this is something which basically never happens. I don’t know, I think that this happens actually quite often and thanks to all these nice IDEs and their “rename” feature this is usually no problem. From time to time names of classes change, name of field change, yes, they are often even completely rewritten, new field variables come in some are deleted, whatever it is. The way I currently can access the name of a class makes the code safer, because when I consequently go with Class.class.getSimpleName I always know, that when I rename the class all these statements are changed too If I delete such a class, I at least get a compile error.
    My very simple issues is, that I think it would be nice to have the same comfort not only on a class level but also on the level of field variables, nothing more, nothing less.
    To be honest, I have not browsed the forum yet if such an issue was already raised by other people (I will do this now), but somehow it is hard to imagine, that I am the first one.
    Best regards.

  • How to write a Web service Handler without modifying the Web service code

    Hi,
    How can I write a SOAPHandler without modifying the Web service code. I want to add a generic handler which will take care of SOAPHeader for all the webmethods. To add a handler is it necessary to modify the web service code?

    You will find answer in [implementing_handlers_using_jaxws_2|http://blogs.sun.com/sdimilla/entry/implementing_handlers_using_jaxws_2]

  • How  do I change image resolution to 72 ppi the length pixels going lower than 1920 pixels

    Hello,
    I have an image that is 2550px x 3300px with a resolution of 300.  I would like to change this to a web jpeg with a resolution of 72ppi without  changed the length resolution to less than 1920. Everytime I try changing the resolution to 72 ppi it changes the size to less than the 1920 px size needed.
    Thank you,Jan

    An image has some pixels real information these make up the bulk of any image format file size.   DPI is a resolution setting that defines what the size of a pixel is. Pixels have no size till there is a resolution specified. your  2550px x 3300px resolution can be set to 72 not a single pixel will change only the size of the image will.  A device that honors resolution will now render the image 35.4" x 45.8" instead of the old 300 setting which would render the image 8.5" x 11"  This is how Image size works when resample is not checked.  If you check Resampel the number of pixels an image has will change. You will wind up with a new  image with a different number of pixels interpolated the the old image that will no longer exist not a single pixel remains of the old image.  So if you open image size on your image you will see 8.5"x11" at 300DPI.
    Check resample change to pixels and change 3300 to 1920  you will see Photoshop set the width to 1484 px. and the resolution be 300DPI.
    Open the image dialog again. Un-check resample and you will see Photoshop change the width and height to  4.947"x6.4" now change the 300 DPI to 72 DPI you will see Photoshop change the width and height to 20.611" x 26.667" the pixesl will remain 1484px x 1920px. This is how image size works.

  • ORA-12546 When connecting without specifying sid in connect string

    I am currently having a difficult time connecting to an Oracle 9.2.0.4 database running on Red Hat Linux.
    I can successfully connect to this database with sqlplus as oracle whether a sid name is included in the connect string or not. I can also successfully connect to the instance through jdbc with jsp pages. However when I try to connect as root without specifying the sid I get an ORA-12546 TNS: Permission denied. I also receive this error when attempting to connect to the instance through php scripts. Note that root can connect through sqlplus with no problem as long as the sid is included in the connect string. Also note that the oracle user can connect either way.
    I turned on tracing and found that this error is occurring before it even gets to the listener as no log or trace entries are generated when the error occurs.
    Does anyone have any ideas?

    did you set the parameter TWO_TASK ?

Maybe you are looking for