[speex-dev] q about jspeex

Ulrich B. Staudinger us at die-horde.de
Fri Oct 31 03:41:08 PST 2003



Ulrich B. Staudinger wrote:

> Hi,
>
> i have:
>
>    public void run(){
>              try{
>                System.out.println("Opening 
> mic");                                    //                AudioInput 
> ai=new AudioInput(t);
> //                ai.start();
>                if(t.input==null){
>                    AudioFormat    format = new 
> AudioFormat(AudioFormat.Encoding.PCM_SIGNED, 44100, 16, 2, 4, 44100, 
> false);
>                    DataLine.Info    targetInfo = new 
> DataLine.Info(TargetDataLine.class, format, 44100);
>                                  t.input = (TargetDataLine) 
> AudioSystem.getLine(targetInfo);
>                                                      
> t.input.open(format,44100);
>                    System.out.println(" Mic opened");
>
>                    t.input.start();
>                    System.out.println("Constructing speex encoder.");
>                    pcm2speex=new Pcm2SpeexAudioInputStream(new 
> AudioInputStream(t.input), format, AudioSystem.NOT_SPECIFIED);       
>                    System.out.println("Speex encoder constructed.");
>                    System.out.println("*** Speex info: ");
>                    System.out.println("Bitrate: 
> "+pcm2speex.getEncoder().getBitRate());
>                    System.out.println("Frame size: 
> "+pcm2speex.getEncoder().getFrameSize());
>                    System.out.println("Complexity: 
> "+pcm2speex.getEncoder().getComplexity());
>                    System.out.println("Mode: 
> "+pcm2speex.getEncoder().getMode());
>                    System.out.println("Sampling rate: 
> "+pcm2speex.getEncoder().getSamplingRate());                         
> System.out.println("relative quality: 
> "+pcm2speex.getEncoder().getRelativeQuality());
>                    System.out.println("*** end of speex info");      
>                    System.out.println("everything ok in writer");
>                }                             byte[] frame=new 
> byte[t.framelength];                   while(true){
>                        int n=pcm2speex.read(frame, 0, frame.length);
>                        System.out.println(""+n+" bytes read.");
>                        
> t.recordBuffer.addElement(frame);                
>                                                  }
>            }
>            catch(Exception e){
>                e.printStackTrace();
>            }
>                    }
>
> now all this code does, is sitting and doing nothing after 'everything 
> ok in writer' - it simply doesn't read any data, at least that's what 
> it looks like, or am i using the class in a wrong context? 
> t.framelength is 160 at the moment.

not specific enough - i mean Pcm2SpeexAudioInputStream with 'the class'

<p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'speex-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the Speex-dev mailing list