Comments

Nested
No sound
User: Sergey
Date: 4/29/2008 8:43 am
Views: 26125
Rating: 23

I have got a studio quality USB microphone "Snowball" but when I try to record my voice using the applet it records silence. I tested the microphone in Audacity - it works (though I need to adjust the sample rate) and my java seems to be good: java version "1.6.0_03".

What might be wrong?

 

P.S. I am using Russian version of the aplet http://www.voxforge.org/ru/read

and my computer is Ubuntu 7.10, kernel 2.6.22.14-generic, GNOME 2.20.1, Memory 2GB, CPU AMD X2 Dual Core BE-2400 

Thanks a lot,

--Sergey

 

Re: No sound
User: Sergey
Date: 4/29/2008 8:56 am
Views: 741
Rating: 26

I have tried the JavaSoundDemo - same thing. I guess it lacks the option to select the input. Probably it tries to capture from the analog microphone of my onboard sound card which does not work.

Re: No sound
User: kmaclean
Date: 4/29/2008 9:09 am
Views: 839
Rating: 29

Hi Sergey,

What does your Java console output say (you may need to install it as an add-on if you are using FireFox)?

Some other things to try:

If you are using GNOME, you *might* be able to set your default sound capture device using the Audio Conferencing settings (usually used for VoIP):

    System>Preferences>Sounds

click the Devices tab, and look at the defaults under "Audio Conferencing" and try changing and testing them.

Or go to your Volume Control utility and make sure the volume has been set for your USB microphone:

System>Preferences>Volume Control

click the Capture Tab, and look to see if the volume slider for your USB microphone appears, and that it is turned on.

Ken 

Re: No sound
User: Sergey
Date: 4/29/2008 10:46 am
Views: 886
Rating: 21

Hi Ken,

I have installed the Java Console add-on, then when I open "Tools>Error Consol" (is "Error Consol" is the Java Console?) and run the applet it shows:

Warning: Unknown property 'test-align'. Declaration dropped.

Source File: http://www.voxforge.org/ru/read

Line: 39

 

I could not fine "System>Preferences>Volume Control" but I have "Sound & Video> GNOME ALSA Mixer" and there I set the volume of the USB Mixer>Mic to maximum. (If I don't, then recording in Audacity would not work.)

 

I set System>Preferences>Sounds >Devices>Audio Conferencing>Sound Capture to "USB Audio" then if I click "Test" button, I get the following message.

Failed to construct test pipeline for 'gconfaudiosrc ! audioconvert ! audioresample ! gconfaudiosink profile=chat'

 

But the applet and JavaSoundDemo.jar still record silence.

 

Might it be related to selecting an incorrect TargetDataLine in java program ?

 

Thanks,

--Sergey

 

Re: No sound
User: kmaclean
Date: 4/29/2008 12:04 pm
Views: 719
Rating: 27

Hi Sergey,

>is "Error Consol" is the Java Console?

Sorry, I should have been more specific - you need to install something like:

Open Java Console 1.6

>Might it be related to selecting an incorrect TargetDataLine in java program ?

I don't know ... I thought it just selected the default (the same as JavaSoundDemo.jar)

I just tested it and I can record my voice on the Russian page (though I am using a sound card, not USB).  The Java applet uses the same code for all languages.  I think Robin uses a USB mic for recording prompts (see this thread).  I think the logs might help.

Did you turn off all other audio applications (Audacity, MP3 player, VoIP, Flash ...) while trying to record?  These posts detail some conflicts that might occur:

Ken
Re: No sound
User: Sergey
Date: 4/30/2008 9:58 am
Views: 742
Rating: 29

Hi Ken,

In addition to "Java Console 6.0.01" I have installed the "Open Java Console 1.6" which created "Tools>Java Console" menu. Here is the content:

CapturePlayback Language:RU: 

PromptList Character Encoding:UTF8

CapturePlayback's WAV file for recording uploadWavFile0is:/tmp/VF-dir36499.tmp/ru_0014.wav

CapturePlayback's WAV file for recording uploadWavFile1is:/tmp/VF-dir36499.tmp/ru_0015.wav

CapturePlayback's WAV file for recording uploadWavFile2is:/tmp/VF-dir36499.tmp/ru_0016.wav

CapturePlayback's WAV file for recording uploadWavFile3is:/tmp/VF-dir36499.tmp/ru_0017.wav

CapturePlayback's WAV file for recording uploadWavFile4is:/tmp/VF-dir36499.tmp/ru_0018.wav

CapturePlayback's WAV file for recording uploadWavFile5is:/tmp/VF-dir36499.tmp/ru_0022.wav

CapturePlayback's WAV file for recording uploadWavFile6is:/tmp/VF-dir36499.tmp/ru_0024.wav

CapturePlayback's WAV file for recording uploadWavFile7is:/tmp/VF-dir36499.tmp/ru_0025.wav

CapturePlayback's WAV file for recording uploadWavFile8is:/tmp/VF-dir36499.tmp/ru_0027.wav

CapturePlayback's WAV file for recording uploadWavFile9is:/tmp/VF-dir36499.tmp/ru_0030.wav

=== Record 1 ===

Capture uploadWavFile is:/tmp/VF-dir36499.tmp/ru_0014.wav

AudioFormat: PCM_SIGNED 48000.0 Hz, 16 bit, mono, 2 bytes/frame, little-endian

duration1:2.816

capture duration:2.816

numPeakValues: 0

proportionPeakValues: 0.0

=== Play 1 ===

duration:2.816

numPeakValues: 0

proportionPeakValues: 0.0

reached end of file

 

I think the applet works fine, it just uses the wrong TargetDataLine. One way to solve this problem is to add a combo-box to allow user to choose the capture device. But this might be tricky.

For now I am going to order a USB speakers and disable the onboard sound card. That way I will have only one input and only one output (1 SourceDataLine and 1 TargetDataLine).

 

Did Robin use only Audacity or also the applet?

 

Definitely I turned off all other audio applications. Though as an experiment I might try running something that grabs the analog microphone and leaves the applet only one remaining TargetDataLine - the USB mic.

 

--Sergey

 

Re: No sound
User: kmaclean
Date: 4/30/2008 1:21 pm
Views: 719
Rating: 26

Hi Sergey,

>One way to solve this problem is to add a combo-box to allow user to choose

>the capture device. But this might be tricky.

I kept the Java Applet as simple as possible, well ... because I was learning Java as I went along ... :)  I'll add this as a feature request.  I am not sure if I'll get it in the next release of the java applet (depends if I can figure it out easily enough). 

At one time, I was looking at adding volume control to the app (which I did not do).  But the long list of TargetDataLines (even though I only have 1 audio card) made it seem too complicated for the average user.  I think I will need to create a separate preferences tab (or a button linked to a window) that would allow advanced users to change the default TargetDataLines, so the average user will not have to worry about it. 

>For now I am going to order a USB speakers and disable the onboard

>sound card. 

I was hoping you would not have to resort to this - there should be a way to assign your USB headset as your default audio I/O.

>Did Robin use only Audacity or also the applet?

Good question ... he has a submission using the speech submission app, and it shows that he is using a USB headset microphone.  I am not sure if he disabled any on-board audio or audio cards.

>Though as an experiment I might try running something that grabs the

>analog microphone and leaves the applet only one remaining

>TargetDataLine - the USB mic.

Now that is thinking "outside the box" ... let me know how you make out - this could be a simple work-around for others who might be having similar problems.

thanks,

Ken 

Re: No sound
User: Sergey
Date: 5/1/2008 9:13 am
Views: 827
Rating: 25

Hi Ken,

> there should be a way to assign your USB headset as your default audio I/O.

It looks like Java does not care about GNOME or KDE or ALSA or OSS defaults. Even worse, I don't think Java has a mechanism to assign the defaults at all. It leaves it up to the program.

 

> he has a submission using the speech submission app, and it shows that he is using a USB headset microphone.

> I am not sure if he disabled any on-board audio or audio cards.

To record in Audacity using a USB microphone I don't need to use any tricks, because I can select the capture device from Audacity's preferences. I was wondering how did he use it with the applet, but apparently he didn't.

 

> Now that is thinking "outside the box" ...

I have tried it in different ways - doesn't seems to work. Either I have to many hardware capture devices, or something else I don't know. I am giving it up for now.

 

The USB speakers I have ordered will arrive today. If that does not work I will look into adding the switch to the applet.

 

Thanks,

--Sergey

 

Re: No sound
User: kmaclean
Date: 5/1/2008 1:04 pm
Views: 767
Rating: 27

Hi Sergey,

>it looks like Java does not care about GNOME or KDE or ALSA or OSS

>defaults. Even worse, I don't think Java has a mechanism to assign the

>defaults at all. It leaves it up to the program.

The relevant code in the Speech Submission app is as follows: 

Declarations: 

public static final String fileType = "wav";    
public static final int samplingRate = 48000;// jre 1.4.2 only supports max of 44100
public static final int samplingRateFormat = 16;     
public static final int numberChannels = 1;     
   
AudioFormat format = new AudioFormat(samplingRate, samplingRateFormat, numberChannels, true, false);

From the Capture class:

public void run() {

... 

DataLine.Info info = new DataLine.Info(TargetDataLine.class,format); 

... 

line = (TargetDataLine) AudioSystem.getLine(info); 

line.open(format, line.getBufferSize()); 

... 

while (thread != null) {
    if((numBytesRead = line.read(data, 0, bufferLengthInBytes)) == -1) {
       break;
    }
    totalBytesWritten += numBytesRead;
    out.write(data, 0, numBytesRead);
    outbaos.write(data, 0, numBytesRead);
}

The getLine method from the AudioSystem class has this in its documentation:

Obtains a line that matches the description in the specified Line.Info object.  If a DataLine is requested, and info is an instance of DataLine.Info specifying at least one fully qualified audio format, the last one will be used as the default format of the returned DataLine. If system properties javax.sound.sampled.Clip, javax.sound.sampled.Port, javax.sound.sampled.SourceDataLine and javax.sound.sampled.TargetDataLine are defined or they are defined in the file "sound.properties", they are used to retrieve default lines. For details, refer to the class description. If the respective property is not set, or the mixer requested in the property is not installed or does not provide the requested line, all installed mixers are queried for the requested line type. A Line will be returned from the first mixer providing the requested line type. 

My sound.properties file is located in "/usr/java/jre1.6.0_03/lib" (Fedora FC6). 

To determine the device number for your USB card, execute the following (more info in this FAQ):

$ arecord --list-devices

You should get a listing similar to this:

[...]

card 1: default [Samson C01U ], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0

This says that the USB microphone is is on card 1, device 0.   Based on this post (and this one)you might need to update your sound.properties file to something like this:

javax.sound.sampled.TargetDataLine=#AudioPCI [plughw:1,0] 

 

Other information: 

The sound.properties configuration file allows choice of default devices (RFE 4776511). For details, see MidiSystem and AudioSystem for details;

 

Another Approach:

From this document on Sun's web site (6.  Troubleshooting Java Sound): 

6.1 System Sound Configuration

Make sure that your audio system is correctly configured (sound card driver/DirectSound for Windows, ALSA or OSS for Linux, OSS or Audio Mixer for Solaris OS). In addition, ensure that your speakers are connected and that your sound card volume and mute state are adjusted to the appropriate value. To test your sound configuration, run any native sound application and play some sound through it.

On Solaris OS and Linux, you might be unable to play sounds because an application (or sound daemon, such as esd or artsd) opens the audio device exclusively, thereby denying Java Sound access to the device.

So killing your sound daemon before going to the SpeecSubmission app might help too.

Ken

Re: No sound
User: Sergey
Date: 5/2/2008 8:04 am
Views: 800
Rating: 27

Hi Ken,

Thanks for the research and the detailed explanation.

What I meant was: "There is no user interface to do that". I didn't know about the config file.

 

Here is the output of my arecord:

~$ arecord --list-devices

**** List of CAPTURE Hardware Devices ****

card 0: NVidia [HDA NVidia], device 0: ALC883 Analog [ALC883 Analog]

Subdevices: 2/2

Subdevice #0: subdevice #0

Subdevice #1: subdevice #1

card 0: NVidia [HDA NVidia], device 1: ALC883 Digital [ALC883 Digital]

Subdevices: 1/1

Subdevice #0: subdevice #0

card 0: NVidia [HDA NVidia], device 2: ALC883 Analog [ALC883 Analog]

Subdevices: 2/2

Subdevice #0: subdevice #0

Subdevice #1: subdevice #1

card 1: default [AK5370 ], device 0: USB Audio [USB Audio]

Subdevices: 1/1

Subdevice #0: subdevice #0

 (AK5370 is another USB mic I have got to test this problem.)

 

I have added the line

javax.sound.sampled.TargetDataLine=#AudioPCI [plughw:1,0]

to /etc/java-6-sun/sound.properties but seems to have no effect.

The Java documentation http://java.sun.com/j2se/1.5.0/docs/guide/sound/programmer_guide/appendix2.html

 is very brief on this subject. And I couldn't find anything useful on Google either.

 

I will try the speakers now.

 

--Sergey

 

PreviousNext