Examples of PWM


Examples of de.maramuse.soundcomp.generator.PWM

  event.setStarttime(ts);
  event.setDuration(durationGate);
  event.setLivetime(durationTotal);
  event.setFrequency(scale.getValueFor(note));
  event.setPitch(scale.getPitch(note));
  PWM pwm=new PWM();
  pwm.setAbstractName("pad-pw");
  pwm.setInstanceName("pad-pw"+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, pwm, 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(1.1), OUT.i);
    volumeEnv.setSource(R.i, ConstStream.c(1.1), OUT.i);
    volumeEnv.setSource(S.i, ConstStream.c(0.8), OUT.i);
    pwm.setSource(FREQUENCY.i, event, FREQUENCY.i);
    dmul.setSource(IN_IMAG.i, filterEnv, OUT.i);
    dmul.setSource(IN.i, ConstStream.c(0.4), OUT.i);
    dpl.setSource(IN_IMAG.i, dmul, OUT.i);
    dpl.setSource(IN.i, ConstStream.c(0.5), OUT.i);
    pwm.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);
View Full Code Here

Examples of de.maramuse.soundcomp.generator.PWM

    globalParameters.setSampleRate(44100);
    ProcessElement env1=new Envelope();
    advancerRegistry.registerAdvancer(env1);
    Time time=new Time();
    Mixer mix=new Mixer();
    PWM gate=new PWM();
    advancerRegistry.registerAdvancer(mix);
    advancerRegistry.registerAdvancer(time);
    advancerRegistry.registerAdvancer(env1);
    advancerRegistry.registerAdvancer(gate);
    Scale s=new WellTemperedScale();
    ConstStream[] notes=new ConstStream[]{
    new ConstStream(s.getValueFor("c#")),
    new ConstStream(s.getValueFor("e")),
    new ConstStream(s.getValueFor("A")),
    };
    ConstStream beats=new ConstStream(1); // 60 bpm in beats per second
    ConstStream A=new ConstStream(0.13);
    ConstStream D=new ConstStream(1.25);
    ConstStream S=ConstStream.c(0.25);
    ConstStream R=new ConstStream(2.55);
    ConstStream A2=new ConstStream(0.05);
    ConstStream D2=new ConstStream(2.25);
    ConstStream S2=ConstStream.c(0.25);
    ConstStream R2=new ConstStream(1.55);
    ComplexTable<Double> ct=new ComplexTable<Double>();
    ct.put(0.0, 0);
    ct.put(0.25, 1);
    ct.put(1.0, 0);
    ct.put(1.25, -1);
    ct.put(2.0, 0);
    // ct.finish();
    ProcessElement si=new Sine();
    Mixer fmix=new Mixer();
    mul fmul=new mul();
    mul fmul2=new mul();
    Mixer fmix2=new Mixer();
    Envelope fmenv=new Envelope();
    CustomWaveform ts=new CustomWaveform();

    ts.setTable(ct);
    ProcessElement cw=new CustomWave();
    advancerRegistry.registerAdvancer(cw);
    advancerRegistry.registerAdvancer(si);
    advancerRegistry.registerAdvancer(mix);
    advancerRegistry.registerAdvancer(fmix);
    advancerRegistry.registerAdvancer(fmix2);
    advancerRegistry.registerAdvancer(fmul2);
    advancerRegistry.registerAdvancer(fmenv);
    advancerRegistry.registerAdvancer(fmul);
    advancerRegistry.registerAdvancer(env1);
    try{
    mix.setSource(-1, cw, StandardParameters.OUT.i);
    mix.setSource(-1, env1, StandardParameters.OUT.i);
    gate.setSource(StandardParameters.FREQUENCY.i, beats, StandardParameters.OUT.i);
    gate.setSource(StandardParameters.DUTYCYCLE.i, ConstStream.c(0.5), StandardParameters.OUT.i);
    cw.setSource(StandardParameters.FREQUENCY.i, fmix2, StandardParameters.OUT.i);
    cw.setSource(StandardParameters.TABLE.i, ts, StandardParameters.TABLE.i);
    env1.setSource(StandardParameters.A.i, A, StandardParameters.OUT.i);
    env1.setSource(StandardParameters.D.i, D, StandardParameters.OUT.i);
    env1.setSource(StandardParameters.S.i, S, StandardParameters.OUT.i);
    env1.setSource(StandardParameters.R.i, R, StandardParameters.OUT.i);
    env1.setSource(StandardParameters.SYNC.i, gate, StandardParameters.OUT.i);
    fmenv.setSource(StandardParameters.A.i, A2, StandardParameters.OUT.i);
    fmenv.setSource(StandardParameters.D.i, D2, StandardParameters.OUT.i);
    fmenv.setSource(StandardParameters.S.i, S2, StandardParameters.OUT.i);
    fmenv.setSource(StandardParameters.R.i, R2, StandardParameters.OUT.i);
    fmenv.setSource(StandardParameters.SYNC.i, gate, StandardParameters.OUT.i);
    si.setSource(StandardParameters.FREQUENCY.i, fmix, StandardParameters.OUT.i);
    fmix.setSource(-1, fmenv, StandardParameters.OUT.i);
    fmix.setSource(-1, new ConstStream(-10), StandardParameters.OUT.i);
    fmix.setSource(-2, new ConstStream(10), StandardParameters.OUT.i);
    fmix2.setSource(-1, si, StandardParameters.OUT.i);
    fmix2.setSource(-1, fmenv, StandardParameters.OUT.i);
    fmix2.setSource(-1, new ConstStream(12), StandardParameters.OUT.i);
    fmul.setSource(StandardParameters.IN.i, new ConstStream(s.getValueFor("A")),
      StandardParameters.OUT.i);
    fmul.setSource(StandardParameters.IN_IMAG.i, new ConstStream(1), StandardParameters.OUT.i);
    fmix2.setSource(-2, fmul, StandardParameters.OUT.i);
    }catch(Exception te){
    fail(te.getMessage());
    }
    OutputFile ws1=new OutputFile(2);
    mul m1=new mul();
    mul m2=new mul();
    ws1.setSource(0, m1, OUT.i);
    ws1.setSource(-1, m2, OUT.i);
    m1.setSource(IN_IMAG.i, ConstStream.c(0.5), OUT.i);
    m2.setSource(IN_IMAG.i, ConstStream.c(0.5), OUT.i);
    m1.setSource(IN.i, mix, OUT.i);
    m2.setSource(IN.i, gate, OUT.i);
    advancerRegistry.registerAdvancer(ws1);
    double lastVal=0;
    int lastIndex=0;
    int sampleCounter=0;
    long starttime=System.currentTimeMillis();
    //for(; time.getValue(StandardParameters.OUT.i)<10.5;){ // as long as we're testing the file buffering in emulation, we must take the time
    for(; time.getValue(StandardParameters.OUT.i)<1.0;){ // as long as we're testing coding in emulation, we don't need full buffers
    advancerRegistry.advanceAll();
    sampleCounter++;
    // ws1.getChannel(0).add(0.5*mix.getValue(StandardParameters.OUT.i));
    // ws1.getChannel(1).add(0.5*gate.getValue(StandardParameters.OUT.i));
    double newVal=gate.getValue(StandardParameters.OUT.i);
    if(lastVal<1&&newVal>0){
      fmul.setSource(StandardParameters.IN.i, notes[lastIndex], StandardParameters.OUT.i);
      lastIndex=(lastIndex+1)%notes.length;
    }
    lastVal=gate.getValue(StandardParameters.OUT.i);
    if((sampleCounter%1000)==0)
      System.out.println("calculated "+sampleCounter+" samples in "+(System.currentTimeMillis()-starttime)/1000+" seconds");
    }
    try{
    File f=new File("monkeytest.wav");
View Full Code Here

Examples of edu.wpi.first.wpilibj.PWM

     * Creates a new LED in the desired channel at the desired brightness
     * @param channel The channel
     * @param brightness Should be a value from 0 to 255
     */
    public GRTLED(int channel, int brightness) {
        led = new PWM(channel);
        brightness = this.brightness;
    }
View Full Code Here

Examples of edu.wpi.first.wpilibj.PWM

     * Creates a new LED in the desired channel at the desired brightness
     * @param channel The channel
     * @param brightness Should be a value from 0 to 255
     */
    public GRTLED(int channel, int brightness) {
        led = new PWM(channel);
        brightness = this.brightness;
    }
View Full Code Here

Examples of edu.wpi.first.wpilibj.PWM

        Scheduler.getInstance().run();
    }
   
   
    public void testInit() {
        LiveWindow.addActuator("DRIVE", "leftMotorUno", new PWM(RobotMap.leftMotorUno));
        LiveWindow.addActuator("DRIVE", "leftMotorDue", new PWM(RobotMap.leftMotorDue));
       
        LiveWindow.addActuator("DRIVE", "rightMotorUno", new PWM(RobotMap.rightMotorUno));
        LiveWindow.addActuator("DRIVE", "rightMotorDue", new PWM(RobotMap.rightMotorDue));
       
       
       
        LiveWindow.addActuator("COLLECTOR", "leftCollector", new PWM(RobotMap.leftCollector));
        LiveWindow.addActuator("COLLECTOR", "rightCollector", new PWM(RobotMap.rightCollector));
       
        LiveWindow.addActuator("CATAPULT", "winchMotor", new PWM(RobotMap.winchMotor));
        LiveWindow.addActuator("CATAPULT", "latchServo", new PWM(RobotMap.latchServo));
       
       
        //sensors
        LiveWindow.addSensor("CATAPULT", "winchEncoder", new Encoder(RobotMap.winchEncoderA, RobotMap.winchEncoderB, false));
        LiveWindow.addSensor("CATAPULT", "limitSwitch", new DigitalInput(RobotMap.limitSwitch));
View Full Code Here

Examples of fork.lib.bio.seq.align.PWM

                tab.appendEmptyColumn(col);
            }
            tab.setValueAt(v, row, col);
        }
    }
    PWM mot=new PWM(tab);
    return new PWMEntry(tit, mot);
}
View Full Code Here

Examples of fork.lib.bio.seq.align.PWM

    PWMEntry en;
   
   
    while( (en=zz.nextEntry())!=null ){
        String nm= en.tit;
        PWM mot= en.pwm;
       
        FastaReader fr= new FastaReader(new File(dir+"/anno/genomes/sacCer1/sacCer1.fa"));
        MotifToLandscape ml= new MotifToLandscape(fr, mot);
       
        System.out.println(nm+"  ");
View Full Code Here

Examples of fork.lib.bio.seq.align.PWM

    ZhuToLandscape zz= new ZhuToLandscape(tf);
    PWMEntry en;
    int ind=0;
    while((en=zz.nextEntry())!=null){
        String tit= en.tit;
        PWM mot= en.pwm;
        System.out.println("add: "+ tit);
       
        zg.addTF(tit, mot);
        ind++;
        //if(ind>5){break;}
View Full Code Here

Examples of fork.lib.bio.seq.align.PWM

                }
                tab.setValueAt(v, row, col);
            }
        }
        FastaReader fr= new FastaReader(new File(dir+"/anno/genomes/sacCer1/sacCer1.fa"));
        PWM mot= new PWM(tab);
        MotifToLandscape ml= new MotifToLandscape(fr, mot);

        System.out.println(nm+"  ");
       
        File of= new File(od+"/"+nm+".wig");
View Full Code Here

Examples of ru.autosome.commons.motifModel.mono.PWM

    return new WordwiseBackground();
  }

  @Override
  protected PWM createMotif(double[][] matrix, String name) {
    return new PWM(matrix, name);
  }
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.