Package de.maramuse.soundcomp.process

Examples of de.maramuse.soundcomp.process.Time


    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);
    advancerRegistry.registerAdvancer(of);
    advancerRegistry.registerAdvancer(mixR);
    advancerRegistry.registerAdvancer(mixL);
    time.reset();
    System.out.println(""+(System.currentTimeMillis()-calcTime)/1000+": total song time: "+getTimestamp(104));
    double lastTime=0;
    for(; time.getValue(StandardParameters.OUT.i)<getTimestamp(103);){
    advancerRegistry.advanceAll();
    if(time.getValue(OUT.i)>lastTime+1){
      lastTime=Math.floor(time.getValue(OUT.i));
      System.out.println(""+(System.currentTimeMillis()-calcTime)/1000+": prepared song time: "+time.getValue(OUT.i)+"s");
    }
    }
    try{
    File f=new File("demo.wav");
    BufferedOutputStream fos=new BufferedOutputStream(new FileOutputStream(f), fileBufferSize);
View Full Code Here


  try{
    advancerRegistry.clear();
    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);
View Full Code Here

    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);
    advancerRegistry.registerAdvancer(of);
    advancerRegistry.registerAdvancer(mixR);
    advancerRegistry.registerAdvancer(mixL);
    time.reset();
    int totalbeats=103;
    System.out.println(""+(System.currentTimeMillis()-calcTime)/1000+": total song time: "
      +getTimestamp(totalbeats+1));
    double lastTime=0;
    for(; time.getValue(StandardParameters.OUT.i)<getTimestamp(totalbeats);){
    advancerRegistry.advanceAll();
    if(time.getValue(OUT.i)>lastTime+1){
      lastTime=Math.floor(time.getValue(OUT.i));
      System.out.println(""+(System.currentTimeMillis()-calcTime)/1000+": prepared song time: "
        +time.getValue(OUT.i)+"s");
    }
    }
    try{
    File f=new File("demo2.wav");
    BufferedOutputStream fos=new BufferedOutputStream(new FileOutputStream(f), fileBufferSize);
View Full Code Here

TOP

Related Classes of de.maramuse.soundcomp.process.Time

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.