Ticket #381 (new defect)

Opened 11 years ago

Last modified 11 years ago

If 48kHz is not supported, automatically select lower sample rate

Reported by: kmaclean Owned by: kmaclean
Priority: major Milestone: SpeechSubmission 0.1.7
Component: SpeechSubmission Version: SpeechSubmission0.1.4
Keywords: Cc:

Description

See this post:

user getting this error:

ERROR Line matching interface TargetDataLine supporting format PCM_SIGNED, 48000.0 Hz, 16 bit, mono, little-endian not supported.

It may be that his hardware does not support 48kHz sampling rate

Change History

comment:1 Changed 11 years ago by kmaclean

something link this in the run method of the Capture class?:

       	// !!!!!!
          	// try to find highest supported sampling rate
            if (!AudioSystem.isLineSupported(info)) {
                int samplingRate = 44100;
                AudioFormat format = new AudioFormat(samplingRate, samplingRateFormat, numberChannels, true, false);
                info = new DataLine.Info(TargetDataLine.class,format);
                if (!AudioSystem.isLineSupported(info)) {
                    samplingRate = 32000;
                    format = new AudioFormat(samplingRate, samplingRateFormat, numberChannels, true, false);
                    info = new DataLine.Info(TargetDataLine.class,format);
                    if (!AudioSystem.isLineSupported(info)) {
                        samplingRate = 16000;
                        format = new AudioFormat(samplingRate, samplingRateFormat, numberChannels, true, false);
                        info = new DataLine.Info(TargetDataLine.class,format);
                        if (!AudioSystem.isLineSupported(info)) {     
	                        shutDown("Line matching " + info + " not supported.");
	                        return;
                    }
                }
                // shutDown("Line matching " + info + " not supported.");
                //return;
            }
            // !!!!!!
Note: See TracTickets for help on using tickets.