Package de.maramuse.soundcomp.process

Examples of de.maramuse.soundcomp.process.Event$EventMixer


  }

  // create one note instance for the pad instrument
  private Event createPadNote(String note, double ts, double durationGate, double durationTotal,
                double volume) {
  Event event=new Event();
  event.setAbstractName("pad");
  event.setInstanceName("pad"+nameCount++);
  event.setStarttime(ts);
  event.setDuration(durationGate);
  event.setLivetime(durationTotal);
  event.setFrequency(scale.getValueFor(note));
  event.setPitch(scale.getPitch(note));
  SawTooth st=new SawTooth();
  st.setAbstractName("pad-st");
  st.setInstanceName("pad-st"+nameCount++);
  Envelope filterEnv=new Envelope();
  Sine lfo=new Sine();
  Envelope volumeEnv=new Envelope();
  StateVariableFilter svf=new StateVariableFilter();
  StateVariableFilter hp=new StateVariableFilter();
  mul mfilfreq=new mul(), mfilfreq2=new mul();
  plus pfilfreq=new plus();
  mul mout=new mul();
  mul lfof=new mul();
  mul mvol=new mul();
  mul dmul=new mul();
  mul dmul2=new mul();
  plus dpl=new plus();
  plus dpl2=new plus();
  try{
    lfof.setSource(IN_IMAG.i, event, FREQUENCY.i);
    lfof.setSource(IN.i, ConstStream.c(0.005), OUT.i);
    lfo.setSource(FREQUENCY.i, lfof, OUT.i);
    hp.setSource(FREQUENCY.i, ConstStream.c(20), OUT.i);
    hp.setSource(IN.i, st, OUT.i);
    filterEnv.setSource(SYNC.i, event, GATE.i);
    filterEnv.setSource(A.i, ConstStream.c(0.4), OUT.i);
    filterEnv.setSource(D.i, ConstStream.c(0.7), OUT.i);
    filterEnv.setSource(R.i, ConstStream.c(0.7), OUT.i);
    filterEnv.setSource(S.i, ConstStream.c(0), OUT.i);
    volumeEnv.setSource(SYNC.i, event, GATE.i);
    volumeEnv.setSource(A.i, ConstStream.c(0.4), OUT.i);
    volumeEnv.setSource(D.i, ConstStream.c(3.1), OUT.i);
    volumeEnv.setSource(R.i, ConstStream.c(5.1), OUT.i);
    volumeEnv.setSource(S.i, ConstStream.c(0.8), OUT.i);
    st.setSource(FREQUENCY.i, event, FREQUENCY.i);
    dmul.setSource(IN_IMAG.i, filterEnv, OUT.i);
    dmul.setSource(IN.i, ConstStream.c(0.15), OUT.i);
    dpl.setSource(IN_IMAG.i, dmul, OUT.i);
    dpl.setSource(IN.i, ConstStream.c(0.8), OUT.i);
    st.setSource(DUTYCYCLE.i, dpl2, OUT.i);
    dpl2.setSource(IN.i, dpl, OUT.i);
    dpl2.setSource(IN_IMAG.i, dmul2, OUT.i);
    dmul2.setSource(IN_IMAG.i, lfo, OUT.i);
    dmul2.setSource(IN.i, ConstStream.c(0.2), OUT.i);
    svf.setSource(IN.i, hp, HP.i);
    mfilfreq.setSource(IN.i, filterEnv, OUT.i);
    mfilfreq.setSource(IN_IMAG.i, ConstStream.c(4), OUT.i);
    mfilfreq2.setSource(IN.i, mfilfreq, OUT.i);
    mfilfreq2.setSource(IN_IMAG.i, event, FREQUENCY.i);
    pfilfreq.setSource(IN_IMAG.i, mfilfreq2, OUT.i);
    pfilfreq.setSource(IN.i, event, FREQUENCY.i);
    svf.setSource(FREQUENCY.i, pfilfreq, OUT.i);
    svf.setSource(Q.i, ConstStream.c(0.9), OUT.i);
    mout.setSource(IN_IMAG.i, volumeEnv, OUT.i);
    mout.setSource(IN.i, mvol, OUT.i);
    mvol.setSource(IN_IMAG.i, svf, LP.i);
    mvol.setSource(IN.i, ConstStream.c(volume*totalVolume), OUT.i);
  }catch(UnknownConnectionException e){
    e.printStackTrace();
  }catch(TypeMismatchException e){
    e.printStackTrace();
  }
  event.addElement(st);
  event.addElement(filterEnv);
  event.addElement(volumeEnv);
  event.addElement(mout);
  event.addElement(mvol);
  event.addElement(svf);
  event.addElement(hp);
  event.addElement(pfilfreq);
  event.addElement(mfilfreq);
  event.addElement(mfilfreq2);
  event.addElement(dmul);
  event.addElement(dmul2);
  event.addElement(dpl);
  event.addElement(lfo);
  event.addElement(lfof);
  event.addElement(dpl2);
  NoteGateOffEvent nge=new NoteGateOffEvent(event, ts+event.getDuration(), advancerRegistry);
  NoteBirthEvent nbe=new NoteBirthEvent(event, ts, advancerRegistry);
  NoteGateOnEvent ng1e=new NoteGateOnEvent(event, ts+1.01/globalParameters.getSampleRate(),
    advancerRegistry);
  NoteDeathEvent nde=new NoteDeathEvent(event, ts+event.getLivetime(), advancerRegistry);
  event.addMixerConnection(pad_L, mout, OUT.i);
  event.addMixerConnection(pad_R, mout, OUT.i);
  advancerRegistry.addEvent(nbe.getTimestamp(), nbe, event);
  advancerRegistry.addEvent(nge.getTimestamp(), nge, event);
  advancerRegistry.addEvent(ng1e.getTimestamp(), ng1e, event);
  advancerRegistry.addEvent(nde.getTimestamp(), nde, event);
  return event;
View Full Code Here


  advancerRegistry.addEvent(nde.getTimestamp(), nde, event);
  return event;
  }

  private Event createDrumNote(Drumnote note, double ts, double volume) {
  Event event;
  // boolean hihat_=false;
  double lvolume=volume*totalVolume;
  switch(note){
    case BASS_1:
    event=getBassDrum(lvolume, lvolume);
    event.setFrequency(70);
    break;
    case BASS_2:
    event=getBassDrum(lvolume, lvolume);
    event.setFrequency(77);
    break;
    case CRASH:
    event=getCrash(0.2*lvolume, 0.7*lvolume);
    break;
    case HIHAT_CLOSED:
    // if a hihat is hit in closed state, it is not permissible for
    // the hihat to still sound on as open. of course, this is an
    // extremely basic simulation - the process of closing the sounding
    // hihat is completely ignored.
    event=getHHClosed(0.5*lvolume, 0.5*lvolume);
    // hihat_=true;
    break;
    case HIHAT_OPEN:
    event=getHHOpen(0.5*lvolume, 0.5*lvolume);
    // hihat_=true;
    break;
    case RIDE:
    event=getRide(0.8*lvolume, 0.2*lvolume);
    break;
    default: // which case should that be?
    case SNARE:
    event=getSnare(0.45*lvolume, 0.55*lvolume);
    break;
    case TOM_HI:
    event=getTom(0.4*lvolume, 0.6*lvolume);
    event.setFrequency(130);
    break;
    case TOM_HIMID:
    event=getTom(0.5*lvolume, 0.5*lvolume);
    event.setFrequency(120);
    break;
    case TOM_LOMID:
    event=getTom(0.6*lvolume, 0.4*lvolume);
    event.setFrequency(110);
    break;
    case TOM_LO:
    event=getTom(0.7*lvolume, 0.3*lvolume);
    event.setFrequency(90);
    break;
  }
  event.setStarttime(ts);
  event.setPitch(Double.NaN);
  NoteGateOffEvent nge=new NoteGateOffEvent(event, ts+event.getDuration(), advancerRegistry);
  NoteBirthEvent nbe=new NoteBirthEvent(event, ts, advancerRegistry);
  NoteGateOnEvent ng1e=new NoteGateOnEvent(event, ts+1.01/globalParameters.getSampleRate(),
    advancerRegistry);
  NoteDeathEvent nde=new NoteDeathEvent(event, ts+event.getLivetime(), advancerRegistry);
  advancerRegistry.addEvent(nbe, event);
  advancerRegistry.addEvent(nge, event);
  advancerRegistry.addEvent(ng1e, event);
  advancerRegistry.addEvent(nde, event);
  return event;
View Full Code Here

TOP

Related Classes of de.maramuse.soundcomp.process.Event$EventMixer

Copyright © 2018 www.massapicom. 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.