Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: JMF CrossPlattform - JavaSound problem



Sandor Sz?cs wrote:

>I get this message:
>format: LINEAR, 44100.0 Hz, 16-bit, Stereo
>DEBUG: available locator: javasound://44100
>DEBUG: used format: javasound://44100
>Exception in thread "JavaSound PushThread"
>java.lang.IllegalArgumentException: Illegal request to write non-
>integral number of frames (22050 bytes )
>	at com.sun.media.sound.SimpleInputDevice$InputDeviceDataLine.read
>(SimpleInputDevice.java:514)
>	at com.sun.media.protocol.javasound.PushThread.process
>(JavaSoundSourceStream.java:790)
>	at com.sun.media.util.LoopThread.run(LoopThread.java:135)

My guess is that the problem is just what the message of the
IllegalArgumentException says it is.  You are asking the audio-device to
transfer a number of bytes that isn't an integral number of sampled-audio
frames, for the format in use.

Your format is 44100 Hz, 16-bit, stereo.  That means each sample-frame is
two 16-bit samples, or 4 bytes.  Apparently, the transfer-size you're using
is 22050 bytes in length.  Divide 22050 bytes by 4 and you get 5512.5,
which is non-integral: i.e. not an integer number.  In effect, you're
asking to transfer only half of the last sample-frame.

Pick a transfer size (or buffer size) that is an exact integer multiple of
4 bytes, and the IllegalArgumentException should disappear.

Or use mono format, which has 2 bytes per sample-frame and does divide
integrally into 22050.  I don't see much reason to sample in stereo for
transmission as VOIP, but I may be missing something.

  -- GG


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.