Examples of Mixer


Examples of de.maramuse.soundcomp.process.Mixer

              new note(3,14, "b1", 2, true),
              new note(4, 0, "a1", 1),
              new note("g1"),
              new note(4, 2, "a1", 12, true),
            };
  solo_L=new Mixer();
  solo_L.setAbstractName("solo_L");
  solo_L.setInstanceName("solo_L");
  solo_R=new Mixer();
  solo_R.setAbstractName("solo_R");
  solo_R.setInstanceName("solo_R");
  advancerRegistry.registerAdvancer(solo_L);
  advancerRegistry.registerAdvancer(solo_R);
  for(note n:notes){
View Full Code Here

Examples of de.maramuse.soundcomp.process.Mixer

  }
  }

  // create the frame structure for the pad instrument
  private void createPad() {
  pad_L=new Mixer();
  pad_L.setAbstractName("pad_L");
  pad_L.setInstanceName("pad_L");
  pad_R=new Mixer();
  pad_R.setAbstractName("pad_R");
  pad_R.setInstanceName("pad_R");
  advancerRegistry.registerAdvancer(pad_L);
  advancerRegistry.registerAdvancer(pad_R);
  for(int t=0; t<400; t++){
View Full Code Here

Examples of de.maramuse.soundcomp.process.Mixer

  }

  // create the frame structure for the drums instrument, and all the monophonous singleton instruments
  private void createDrumset() throws UnknownConnectionException, TypeMismatchException {
  // noise generation is handled globally. maybe not optimal, but good enough for this demo
  drums_R=new Mixer();
  drums_R.setAbstractName("drums_R");
  drums_R.setInstanceName("drums_R");
  advancerRegistry.registerAdvancer(drums_R);
  drums_L=new Mixer();
  drums_L.setAbstractName("drums_L");
  drums_L.setInstanceName("drums_L");
  advancerRegistry.registerAdvancer(drums_L);

  for(int t=0; t<400; t++){
View Full Code Here

Examples of de.maramuse.soundcomp.process.Mixer

  public void testComplexSong() {
  try{
    double calcTime=System.currentTimeMillis();
    advancerRegistry.clear();
    globalParameters.setSampleRate(44100);
    Mixer mixL=new Mixer();
    mixL.setAbstractName("mixL");
    mixL.setInstanceName("mixL");
    Mixer mixR=new Mixer();
    mixR.setAbstractName("mixR");
    mixR.setInstanceName("mixR");
    createBass();
    createPad();
    createSolo();
    createDrumset();
    System.out.println(""+(System.currentTimeMillis()-calcTime)/1000+": events created");
    mixL.setSource(-1, bass_L, OUT.i);
    mixL.setSource(-4, drums_L, OUT.i);
    mixL.setSource(-2, pad_L, OUT.i);
    mixL.setSource(-3, solo_L, OUT.i);
    mixR.setSource(-1, bass_R, OUT.i);
    mixR.setSource(-4, drums_R, OUT.i);
    mixR.setSource(-2, pad_R, OUT.i);
    mixR.setSource(-3, solo_R, OUT.i);
    OutputFile of=new OutputFile(2);
    Time time=new Time();
    of.setSource(0, mixL, OUT.i);
    of.setSource(-1, mixR, OUT.i);
    advancerRegistry.registerAdvancer(time);
View Full Code Here

Examples of javax.sound.sampled.Mixer

     
      int mixerIndex = getMixerIndex();
     
      // get the requested TargetDataLine from the mixer and open it
      Mixer.Info[] mixerInfo = AudioSystem.getMixerInfo();
      Mixer mixer = AudioSystem.getMixer(mixerInfo[mixerIndex]);
      targetDataLine = (TargetDataLine)mixer.getLine(new DataLine.Info(TargetDataLine.class, null));
            if (TRACE) logger.fine("targetDataLine=" + targetDataLine);
     
      // calculate buffer size
      buflen = (int)((javaSoundAudioFormat.getFrameSize() * javaSoundAudioFormat.getSampleRate() * buflenMS) / 1000);
      targetDataLine.open(javaSoundAudioFormat, buflen);
View Full Code Here

Examples of javax.sound.sampled.Mixer

    {
      return null;
    }
   
    // Fetch the mixer
    Mixer mixer = AudioSystem.getMixer(mixerInfo[mixerIndex]);

    Line.Info[] infos = mixer.getTargetLineInfo();
    for (int i=0; i<infos.length; i++)
    {
      if ( infos[i] instanceof DataLine.Info )
      {
        javax.sound.sampled.AudioFormat[] af = ((DataLine.Info)infos[i]).getFormats();
View Full Code Here

Examples of javax.sound.sampled.Mixer

    final Properties prop = new Properties();
    loadSoundProperties(prop);

    final Map<String, AudioFormat> formatMap = new TreeMap<String, AudioFormat>();
    final Map<String, String> fileFormatMap = new TreeMap<String, String>();
    final Mixer defaultMixer = TESTPLAY_SAMPLES? AudioSystem.getMixer(null): null;

    // get sound library filepath
    final String soundBase = prop.getProperty("soundbase", "data/sounds");

    // read all load-permitted sounds listed in properties
    // from soundfile into cache map
    for (final Entry<String, String> entry : ((Map<String, String>) (Map<?,?>) prop).entrySet()) {
      if (isValidEntry(entry.getKey(), entry.getValue())) {
        final String name = entry.getKey().substring(4);
        String filename = entry.getValue();
        final int pos = filename.indexOf(',');
        if (pos > -1) {
          filename = filename.substring(0, pos);
        }

        try {
          final InputStream is = CheckSounds.class.getClassLoader().getResourceAsStream(
              soundBase + "/" + filename);
          final AudioInputStream ais = AudioSystem.getAudioInputStream(is);
          final AudioFormat format = ais.getFormat();
          final String formatString = format.toString();

          if (TESTPLAY_SAMPLES) {
            // testplay the sound
            final DataLine.Info info = new DataLine.Info(Clip.class, format);
            if (defaultMixer.isLineSupported(info)) {
              AudioInputStream playStream = ais;
              final AudioFormat defaultFormat = new AudioFormat(
                  format.getSampleRate(), 16, 1, false, true);
              if (AudioSystem.isConversionSupported(
                  defaultFormat, format)) {
                playStream = AudioSystem.getAudioInputStream(
                    defaultFormat, ais);
              } else {
                System.out.println("conversion not supported (to "
                    + defaultFormat + ")");
              }

              System.out.println("testplaying " + name + " "
                  + playStream.getFormat());

              final Clip line = (Clip) defaultMixer.getLine(info);
              line.open(playStream);
              line.loop(2);
              final TestLineListener testListener = new TestLineListener();
              line.addLineListener(testListener);
              while (testListener.active) {
                Thread.yield();
              }
              line.close();
            }
          }

          fileFormatMap.put(name, formatString);
          if (!formatMap.containsKey(formatString)) {
            formatMap.put(formatString, format);
          }
        } catch (final UnsupportedAudioFileException e) {
          System.out.println(name
              + " cannot be read, the file format is not supported");
        }
      }
    }

    final Mixer.Info[] mixerList = AudioSystem.getMixerInfo();
    final int[] width = new int[mixerList.length];

    System.out.println("\n\n--- Result ---\n");
    System.out.println("installed mixer: ");
    for (int i = 0; i < mixerList.length; i++) {
      final Mixer.Info mixer = mixerList[i];
      width[i] = Math.max(mixer.getName().length(),
          "unsupported".length());
      System.out.println(mixer.getName() + " - " + mixer.getDescription());
    }
    System.out.println("Default: "
        + AudioSystem.getMixer(null).getMixerInfo().getName());
    System.out.println("\n");

    System.out.println(formatMap.size()
        + " audio formats\nThe maximum available lines for the format is in brackets.");
    for (int i = 0; i < mixerList.length; i++) {
      System.out.print(getString(mixerList[i].getName(), width[i], ' ')
          + " | ");
    }
    System.out.println("Format");
    for (int i = 0; i < mixerList.length; i++) {
      System.out.print(getString("", width[i], '-') + "-+-");
    }
    System.out.println("---------------------");

    for (final Map.Entry<String, AudioFormat> it_FM : formatMap.entrySet()) {
      String key = it_FM.getKey();
      final DataLine.Info info = new DataLine.Info(Clip.class, it_FM.getValue());
      for (int i = 0; i < mixerList.length; i++) {
        final Mixer mixer = AudioSystem.getMixer(mixerList[i]);
        final boolean supported = mixer.isLineSupported(info);
        StringBuilder stringBuilder = new StringBuilder();
        if (supported) {
          stringBuilder.append("  ");
        } else {
          stringBuilder.append("un");
        }
        stringBuilder.append("supported (");
        stringBuilder.append(mixer.getMaxLines(info));
        stringBuilder.append(")");
        System.out.print(getString(stringBuilder.toString(),
            width[i], ' ') + " | ");
      }
View Full Code Here

Examples of javax.sound.sampled.Mixer

      }
      audioFormat = getAudioFormat();

      DataLine.Info dataLineInfo = new DataLine.Info(TargetDataLine.class, audioFormat);

      Mixer mixer = AudioSystem.getMixer(mixerInfo[5]);

      targetDataLine = (TargetDataLine) mixer.getLine(dataLineInfo);

      targetDataLine.open(audioFormat);
      targetDataLine.start();

      Thread captureThread = new CaptureThread();
View Full Code Here

Examples of javax.sound.sampled.Mixer

      DataLine.Info dataLineInfo = new DataLine.Info(TargetDataLine.class, audioFormat);

      int choice = 4;

      System.out.println("chose mixer: " + mixerInfo[choice].getName());
      Mixer mixer = AudioSystem.getMixer(mixerInfo[choice]);

      targetDataLine = (TargetDataLine) mixer.getLine(dataLineInfo);

      targetDataLine.open(audioFormat);

      targetDataLine.start();
View Full Code Here

Examples of javax.sound.sampled.Mixer

        this.volume = volume;
    }

    private Clip getClip(DataLine.Info info) throws LineUnavailableException {
        for (Mixer.Info mi : AudioSystem.getMixerInfo()) {
            Mixer mixer = AudioSystem.getMixer(mi);
            try {
                return (Clip) mixer.getLine(info);
            } catch (LineUnavailableException ex) {
                resourceLogger.warning("Matching line not available: " + ex.getLocalizedMessage());
            } catch (IllegalArgumentException ex) {
                resourceLogger.warning("Mixer does not support this format. " + ex.getLocalizedMessage());
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.