Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java and JDK > BOOK: Beginning Java 2
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning Java 2
This is the forum to discuss the Wrox book Beginning Java 2, SDK 1.4 Edition by Ivor Horton; ISBN: 9780764543654
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Java 2 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old September 18th, 2003, 03:42 AM
Registered User
 
Join Date: Sep 2003
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Java Sound Help

Hi,
When i try to run code in the page 943 in java 2 book, it gives following o/p.

Mixer 1 :
    Name: Java Sound Audio Engine Vender: Sun MicrosystemsVersion: 1.0
    Description: Software mixer and synthesizer
    Source line: 1 : interface SourceDataLine supporting 8 audio formats
        PCM_SIGNED, -1.0 Hz, 8 bit, mono, audio data
        PCM_UNSIGNED, -1.0 Hz, 8 bit, mono, audio data
        PCM_SIGNED, -1.0 Hz, 8 bit, stereo, audio data
        PCM_UNSIGNED, -1.0 Hz, 8 bit, stereo, audio data
        PCM_SIGNED, -1.0 Hz, 16 bit, mono, big-endian, audio data
        PCM_SIGNED, -1.0 Hz, 16 bit, mono, little-endian, audio data
        PCM_SIGNED, -1.0 Hz, 16 bit, stereo, big-endian, audio data
        PCM_SIGNED, -1.0 Hz, 16 bit, stereo, little-endian, audio data
    Source line: 2 : interface Clip supporting 8 audio formats, and buffers of 0 to 4194304 bytes
        PCM_SIGNED, -1.0 Hz, 8 bit, mono, audio data
        PCM_UNSIGNED, -1.0 Hz, 8 bit, mono, audio data
        PCM_SIGNED, -1.0 Hz, 8 bit, stereo, audio data
        PCM_UNSIGNED, -1.0 Hz, 8 bit, stereo, audio data
        PCM_SIGNED, -1.0 Hz, 16 bit, mono, big-endian, audio data
        PCM_SIGNED, -1.0 Hz, 16 bit, mono, little-endian, audio data
        PCM_SIGNED, -1.0 Hz, 16 bit, stereo, big-endian, audio data
        PCM_SIGNED, -1.0 Hz, 16 bit, stereo, little-endian, audio data

Mixer 2 :
    Name: Microsoft Sound Mapper Vender: Unknown VendorVersion: Unknown Version
    Description: No details available
    Target Line: 1 : interface TargetDataLine supporting 64 audio formats
        PCM_SIGNED, 8000.0 Hz, 8 bit, mono, audio data
        PCM_UNSIGNED, 8000.0 Hz, 8 bit, mono, audio data
        PCM_SIGNED, 8000.0 Hz, 16 bit, mono, big-endian, audio data
        PCM_SIGNED, 8000.0 Hz, 16 bit, mono, little-endian, audio data
        PCM_SIGNED, 8000.0 Hz, 8 bit, stereo, audio data
        PCM_UNSIGNED, 8000.0 Hz, 8 bit, stereo, audio data
        PCM_SIGNED, 8000.0 Hz, 16 bit, stereo, big-endian, audio data
        PCM_SIGNED, 8000.0 Hz, 16 bit, stereo, little-endian, audio data
        PCM_SIGNED, 11025.0 Hz, 8 bit, mono, audio data
        PCM_UNSIGNED, 11025.0 Hz, 8 bit, mono, audio data
        PCM_SIGNED, 11025.0 Hz, 16 bit, mono, big-endian, audio data
        PCM_SIGNED, 11025.0 Hz, 16 bit, mono, little-endian, audio data
        PCM_SIGNED, 11025.0 Hz, 8 bit, stereo, audio data
        PCM_UNSIGNED, 11025.0 Hz, 8 bit, stereo, audio data
        PCM_SIGNED, 11025.0 Hz, 16 bit, stereo, big-endian, audio data
        PCM_SIGNED, 11025.0 Hz, 16 bit, stereo, little-endian, audio data
        PCM_SIGNED, 16000.0 Hz, 8 bit, mono, audio data
        PCM_UNSIGNED, 16000.0 Hz, 8 bit, mono, audio data
        PCM_SIGNED, 16000.0 Hz, 16 bit, mono, big-endian, audio data
        PCM_SIGNED, 16000.0 Hz, 16 bit, mono, little-endian, audio data
        PCM_SIGNED, 16000.0 Hz, 8 bit, stereo, audio data
        PCM_UNSIGNED, 16000.0 Hz, 8 bit, stereo, audio data
        PCM_SIGNED, 16000.0 Hz, 16 bit, stereo, big-endian, audio data
        PCM_SIGNED, 16000.0 Hz, 16 bit, stereo, little-endian, audio data
        PCM_SIGNED, 22050.0 Hz, 8 bit, mono, audio data
        PCM_UNSIGNED, 22050.0 Hz, 8 bit, mono, audio data
        PCM_SIGNED, 22050.0 Hz, 16 bit, mono, big-endian, audio data
        PCM_SIGNED, 22050.0 Hz, 16 bit, mono, little-endian, audio data
        PCM_SIGNED, 22050.0 Hz, 8 bit, stereo, audio data
        PCM_UNSIGNED, 22050.0 Hz, 8 bit, stereo, audio data
        PCM_SIGNED, 22050.0 Hz, 16 bit, stereo, big-endian, audio data
        PCM_SIGNED, 22050.0 Hz, 16 bit, stereo, little-endian, audio data
        PCM_SIGNED, 32000.0 Hz, 8 bit, mono, audio data
        PCM_UNSIGNED, 32000.0 Hz, 8 bit, mono, audio data
        PCM_SIGNED, 32000.0 Hz, 16 bit, mono, big-endian, audio data
        PCM_SIGNED, 32000.0 Hz, 16 bit, mono, little-endian, audio data
        PCM_SIGNED, 32000.0 Hz, 8 bit, stereo, audio data
        PCM_UNSIGNED, 32000.0 Hz, 8 bit, stereo, audio data
        PCM_SIGNED, 32000.0 Hz, 16 bit, stereo, big-endian, audio data
        PCM_SIGNED, 32000.0 Hz, 16 bit, stereo, little-endian, audio data
        PCM_SIGNED, 44100.0 Hz, 8 bit, mono, audio data
        PCM_UNSIGNED, 44100.0 Hz, 8 bit, mono, audio data
        PCM_SIGNED, 44100.0 Hz, 16 bit, mono, big-endian, audio data
        PCM_SIGNED, 44100.0 Hz, 16 bit, mono, little-endian, audio data
        PCM_SIGNED, 44100.0 Hz, 8 bit, stereo, audio data
        PCM_UNSIGNED, 44100.0 Hz, 8 bit, stereo, audio data
        PCM_SIGNED, 44100.0 Hz, 16 bit, stereo, big-endian, audio data
        PCM_SIGNED, 44100.0 Hz, 16 bit, stereo, little-endian, audio data
        PCM_SIGNED, 48000.0 Hz, 8 bit, mono, audio data
        PCM_UNSIGNED, 48000.0 Hz, 8 bit, mono, audio data
        PCM_SIGNED, 48000.0 Hz, 16 bit, mono, big-endian, audio data
        PCM_SIGNED, 48000.0 Hz, 16 bit, mono, little-endian, audio data
        PCM_SIGNED, 48000.0 Hz, 8 bit, stereo, audio data
        PCM_UNSIGNED, 48000.0 Hz, 8 bit, stereo, audio data
        PCM_SIGNED, 48000.0 Hz, 16 bit, stereo, big-endian, audio data
        PCM_SIGNED, 48000.0 Hz, 16 bit, stereo, little-endian, audio data
        PCM_SIGNED, 96000.0 Hz, 8 bit, mono, audio data
        PCM_UNSIGNED, 96000.0 Hz, 8 bit, mono, audio data
        PCM_SIGNED, 96000.0 Hz, 16 bit, mono, big-endian, audio data
        PCM_SIGNED, 96000.0 Hz, 16 bit, mono, little-endian, audio data
        PCM_SIGNED, 96000.0 Hz, 8 bit, stereo, audio data
        PCM_UNSIGNED, 96000.0 Hz, 8 bit, stereo, audio data
        PCM_SIGNED, 96000.0 Hz, 16 bit, stereo, big-endian, audio data
        PCM_SIGNED, 96000.0 Hz, 16 bit, stereo, little-endian, audio data

Mixer 3 :
    Name: Avance Sound Vender: Unknown VendorVersion: Unknown Version
    Description: No details available
    Target Line: 1 : interface TargetDataLine supporting 64 audio formats
        PCM_SIGNED, 8000.0 Hz, 8 bit, mono, audio data
        PCM_UNSIGNED, 8000.0 Hz, 8 bit, mono, audio data
        PCM_SIGNED, 8000.0 Hz, 16 bit, mono, big-endian, audio data
        PCM_SIGNED, 8000.0 Hz, 16 bit, mono, little-endian, audio data
        PCM_SIGNED, 8000.0 Hz, 8 bit, stereo, audio data
        PCM_UNSIGNED, 8000.0 Hz, 8 bit, stereo, audio data
        PCM_SIGNED, 8000.0 Hz, 16 bit, stereo, big-endian, audio data
        PCM_SIGNED, 8000.0 Hz, 16 bit, stereo, little-endian, audio data
        PCM_SIGNED, 11025.0 Hz, 8 bit, mono, audio data
        PCM_UNSIGNED, 11025.0 Hz, 8 bit, mono, audio data
        PCM_SIGNED, 11025.0 Hz, 16 bit, mono, big-endian, audio data
        PCM_SIGNED, 11025.0 Hz, 16 bit, mono, little-endian, audio data
        PCM_SIGNED, 11025.0 Hz, 8 bit, stereo, audio data
        PCM_UNSIGNED, 11025.0 Hz, 8 bit, stereo, audio data
        PCM_SIGNED, 11025.0 Hz, 16 bit, stereo, big-endian, audio data
        PCM_SIGNED, 11025.0 Hz, 16 bit, stereo, little-endian, audio data
        PCM_SIGNED, 16000.0 Hz, 8 bit, mono, audio data
        PCM_UNSIGNED, 16000.0 Hz, 8 bit, mono, audio data
        PCM_SIGNED, 16000.0 Hz, 16 bit, mono, big-endian, audio data
        PCM_SIGNED, 16000.0 Hz, 16 bit, mono, little-endian, audio data
        PCM_SIGNED, 16000.0 Hz, 8 bit, stereo, audio data
        PCM_UNSIGNED, 16000.0 Hz, 8 bit, stereo, audio data
        PCM_SIGNED, 16000.0 Hz, 16 bit, stereo, big-endian, audio data
        PCM_SIGNED, 16000.0 Hz, 16 bit, stereo, little-endian, audio data
        PCM_SIGNED, 22050.0 Hz, 8 bit, mono, audio data
        PCM_UNSIGNED, 22050.0 Hz, 8 bit, mono, audio data
        PCM_SIGNED, 22050.0 Hz, 16 bit, mono, big-endian, audio data
        PCM_SIGNED, 22050.0 Hz, 16 bit, mono, little-endian, audio data
        PCM_SIGNED, 22050.0 Hz, 8 bit, stereo, audio data
        PCM_UNSIGNED, 22050.0 Hz, 8 bit, stereo, audio data
        PCM_SIGNED, 22050.0 Hz, 16 bit, stereo, big-endian, audio data
        PCM_SIGNED, 22050.0 Hz, 16 bit, stereo, little-endian, audio data
        PCM_SIGNED, 32000.0 Hz, 8 bit, mono, audio data
        PCM_UNSIGNED, 32000.0 Hz, 8 bit, mono, audio data
        PCM_SIGNED, 32000.0 Hz, 16 bit, mono, big-endian, audio data
        PCM_SIGNED, 32000.0 Hz, 16 bit, mono, little-endian, audio data
        PCM_SIGNED, 32000.0 Hz, 8 bit, stereo, audio data
        PCM_UNSIGNED, 32000.0 Hz, 8 bit, stereo, audio data
        PCM_SIGNED, 32000.0 Hz, 16 bit, stereo, big-endian, audio data
        PCM_SIGNED, 32000.0 Hz, 16 bit, stereo, little-endian, audio data
        PCM_SIGNED, 44100.0 Hz, 8 bit, mono, audio data
        PCM_UNSIGNED, 44100.0 Hz, 8 bit, mono, audio data
        PCM_SIGNED, 44100.0 Hz, 16 bit, mono, big-endian, audio data
        PCM_SIGNED, 44100.0 Hz, 16 bit, mono, little-endian, audio data
        PCM_SIGNED, 44100.0 Hz, 8 bit, stereo, audio data
        PCM_UNSIGNED, 44100.0 Hz, 8 bit, stereo, audio data
        PCM_SIGNED, 44100.0 Hz, 16 bit, stereo, big-endian, audio data
        PCM_SIGNED, 44100.0 Hz, 16 bit, stereo, little-endian, audio data
        PCM_SIGNED, 48000.0 Hz, 8 bit, mono, audio data
        PCM_UNSIGNED, 48000.0 Hz, 8 bit, mono, audio data
        PCM_SIGNED, 48000.0 Hz, 16 bit, mono, big-endian, audio data
        PCM_SIGNED, 48000.0 Hz, 16 bit, mono, little-endian, audio data
        PCM_SIGNED, 48000.0 Hz, 8 bit, stereo, audio data
        PCM_UNSIGNED, 48000.0 Hz, 8 bit, stereo, audio data
        PCM_SIGNED, 48000.0 Hz, 16 bit, stereo, big-endian, audio data
        PCM_SIGNED, 48000.0 Hz, 16 bit, stereo, little-endian, audio data
        PCM_SIGNED, 96000.0 Hz, 8 bit, mono, audio data
        PCM_UNSIGNED, 96000.0 Hz, 8 bit, mono, audio data
        PCM_SIGNED, 96000.0 Hz, 16 bit, mono, big-endian, audio data
        PCM_SIGNED, 96000.0 Hz, 16 bit, mono, little-endian, audio data
        PCM_SIGNED, 96000.0 Hz, 8 bit, stereo, audio data
        PCM_UNSIGNED, 96000.0 Hz, 8 bit, stereo, audio data
        PCM_SIGNED, 96000.0 Hz, 16 bit, stereo, big-endian, audio data
        PCM_SIGNED, 96000.0 Hz, 16 bit, stereo, little-endian, audio data

Mixer 4 :
    Name: Avance Sound Vender: Unknown VendorVersion: 5.0
    Description: Unknown Description
    Source line: 1 : Wave source port
java.lang.ClassCastException
    at PlumbSoundSystem.main(PlumbSoundSystem.java:27)

Line 27 is:
formats=((DataLine.Info)lines[j]).getFormats();

1) What is the reason to this Exception?

2) This gives PCM_SIGNED and PCM_UNSIGNED linear encording formats only. What it means? Is it mean my system support only linear encording only?

3) I try to run a code which is in page 971 by changing AudioFormat as :
private AudioFormat format = new AudioFormat(AudioFormat.Encoding.ALAW,8000,8,1,1,8 000,false);
and FileTypeFormat to:
private AudioFileFormat.Type fileType = AudioFileFormat.Type.AU;

In here what i want is get a .au file with a format as :
Encoring – Alaw, Sampling rate – 8000 Hz, Sample size – 8 bits, Channel – Mono.

Is it posible to get such kind of .au file eith above format?
But when i try to compile the above code it gave following message.

Line not supported interface TargetDataLine supporting format ALAW, 8000.0 Hz, 8 bit, mono, audio data

What is the error?
Can somebody help me.
Thanks in advanced for any help.

Regards,
Anjithalb


 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
playing sound files (java 2 jdk1.3 edition) naresh Java Basics 1 April 11th, 2009 02:04 AM
Adding sound to a java application john111 Java Basics 2 February 15th, 2006 06:31 PM
sound goldenpiranha Pro VB.NET 2002/2003 1 December 7th, 2005 04:54 PM
[JAVA] PRINT - SOUND gianni17 J2EE 0 February 20th, 2005 01:11 PM
Sound on/off Adam H-W Flash (all versions) 1 June 27th, 2003 04:21 PM



All times are GMT -4. The time now is 09:39 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.