Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 18th, 2003, 02:42 AM
Registered User
 
Join Date: Sep 2003
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







Similar Threads
Thread Thread Starter Forum Replies Last Post
playing sound files (java 2 jdk1.3 edition) naresh Java Basics 1 April 11th, 2009 01: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 03:21 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.