Code example for SourceDataLine

Methods: getFormatopen

0
        SourceDataLine loudspeakers = null;
        try { 
            DataLine.Info info = new DataLine.Info(SourceDataLine.class,
                    audioFormat);
            loudspeakers = (SourceDataLine) AudioSystem.getLine(info);
            loudspeakers.open(audioFormat);
            System.out.println("Loudspeaker format: "+loudspeakers.getFormat());
        } catch (LineUnavailableException e) {
            e.printStackTrace();
        } 
         
        // Choose an audio effect 
        InlineDataProcessor effect = new Robotiser.PhaseRemover(4096);
        //InlineDataProcessor effect = new LPCWhisperiser(20); 
 
        // Create the output thread and make it run in the background: 
        int bufferSize = SignalProcUtils.getDFTSize(fs);
        OnlineAudioEffects online = new OnlineAudioEffects(effect, microphone, loudspeakers, bufferSize);
        online.start();
         
Experience pair programming with AI  Get Codota for Java