Package de.maramuse.soundcomp.files

Examples of de.maramuse.soundcomp.files.OutputFile


    tdhs2.setSource(StandardParameters.IN.i, cos, StandardParameters.OUT.i);
    tdhs2.setSource(StandardParameters.FACTOR.i, cs2, 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.125), OUT.i);
    m2.setSource(IN_IMAG.i, ConstStream.c(0.125), OUT.i);
    m1.setSource(IN.i, tdhs1, OUT.i);
    m2.setSource(IN.i, cos, OUT.i);
    advancerRegistry.registerAdvancer(ws1);
    OutputFile ws2=new OutputFile(2);
    mul m3=new mul();
    mul m4=new mul();
    ws2.setSource(0, m3, OUT.i);
    ws2.setSource(-1, m4, OUT.i);
    m3.setSource(IN_IMAG.i, ConstStream.c(0.125), OUT.i);
    m4.setSource(IN_IMAG.i, ConstStream.c(0.125), OUT.i);
    m3.setSource(IN.i, tdhs2, OUT.i);
    m4.setSource(IN.i, cos, OUT.i);
    advancerRegistry.registerAdvancer(ws2);
    for(double t=0; t<3; t+=1/globalParameters.getSampleRate()){
    advancerRegistry.advanceAll();
    }
    try{
    File f=new File("tdhssweep1.wav");
    BufferedOutputStream fos=new BufferedOutputStream(new FileOutputStream(f), fileBufferSize);
    ws1.setFormat(FileFormats.FMT_WAVE_S16);
    ws1.write(fos);
    fos.close();
    }catch(IOException ex){
    fail(ex.getMessage());
    }
    try{
    File f=new File("tdhssweep2.wav");
    BufferedOutputStream fos=new BufferedOutputStream(new FileOutputStream(f), fileBufferSize);
    ws2.setFormat(FileFormats.FMT_WAVE_S16);
    ws2.write(fos);
    fos.close();
    }catch(IOException ex){
    fail(ex.getMessage());
    }
    advancerRegistry.unregisterAdvancer(cos);
View Full Code Here


    env1.setSource(StandardParameters.R.i, R, StandardParameters.OUT.i);
    env1.setSource(StandardParameters.SYNC.i, gate, 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;
    for(double t=0; t<10.5; t+=1/globalParameters.getSampleRate()){
    advancerRegistry.advanceAll();
    // 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){
      cos.setSource(StandardParameters.FREQUENCY.i, notes[lastIndex], StandardParameters.OUT.i);
      lastIndex=(lastIndex+1)%notes.length;
    }
    lastVal=gate.getValue(StandardParameters.OUT.i);
    }
    try{
    File f=new File("env1test.wav");
    BufferedOutputStream fos=new BufferedOutputStream(new FileOutputStream(f), fileBufferSize);
    ws1.setFormat(FileFormats.FMT_WAVE_S16);
    ws1.write(fos);
    fos.close();
    }catch(IOException ex){
    fail(ex.getMessage());
    }
    s=new CustomScale();
    s.put("note1", 320, 1, 2, null);
    s.put("note2", 400, 2, 3, 1);
    s.put("note3", 480, 3, null, 2);
    note_A=new ConstStream(s.getValueFor("note1"));
    note_e=new ConstStream(s.getValueFor("note2"));
    note_csharp=new ConstStream(s.getValueFor("note3"));
    notes=new ConstStream[]{note_A, note_e, note_csharp};
    beats=new ConstStream(1.5); // 60 bpm in beats per second
    A=new ConstStream(0.13);
    D=new ConstStream(1.25);
    S=new ConstStream(0.25);
    R=new ConstStream(2.55);
    try{
    mix.setSource(-1, cos, 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);
    cos.setSource(StandardParameters.FREQUENCY.i, note_A, StandardParameters.OUT.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);
    }catch(Exception te){
    fail(te.getMessage());
    }
    NativeObjects.unregisterNativeObject(ws1);
    ws1=new OutputFile(2);
    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);
    lastVal=0;
    lastIndex=0;
    for(double t=0; t<10.5; t+=1/globalParameters.getSampleRate()){
    advancerRegistry.advanceAll();
    // 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){
      cos.setSource(StandardParameters.FREQUENCY.i, notes[lastIndex], StandardParameters.OUT.i);
      lastIndex=(lastIndex+1)%notes.length;
    }
    lastVal=gate.getValue(StandardParameters.OUT.i);
    }
    try{
    File f=new File("scale1test.wav");
    BufferedOutputStream fos=new BufferedOutputStream(new FileOutputStream(f), fileBufferSize);
    ws1.setFormat(FileFormats.FMT_WAVE_S16);
    ws1.write(fos);
    fos.close();
    }catch(IOException ex){
    fail(ex.getMessage());
    }
    advancerRegistry.unregisterAdvancer(cos);
View Full Code Here

    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;
    for(; time.getValue(StandardParameters.OUT.i)<10.5;){
    advancerRegistry.advanceAll();
    // 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);
    }
    try{
    File f=new File("cwtest.wav");
    BufferedOutputStream fos=new BufferedOutputStream(new FileOutputStream(f), fileBufferSize);
    ws1.setFormat(FileFormats.FMT_WAVE_S16);
    ws1.write(fos);
    fos.close();
    }catch(IOException ex){
    fail(ex.getMessage());
    }
    advancerRegistry.unregisterAdvancer(cw);
View Full Code Here

    AdvancerRegistry advancerRegistry=new AdvancerRegistry();
    advancerRegistry.clear();
    globalParameters.setSampleRate(44100);
    ProcessElement pe=new InputFile("javasrc/de/maramuse/soundcomp/test/testfiles/hh-o.wav");
    advancerRegistry.registerAdvancer(pe);
    OutputFile ws=new OutputFile(1);
    advancerRegistry.registerAdvancer(ws);
    ws.setSource(0, pe, OUT.i);
    for(double time=0; time<1.5; time+=1/globalParameters.getSampleRate()){
    advancerRegistry.advanceAll();
    }
    File f=new File("hh-o.wav");
    BufferedOutputStream fos=new BufferedOutputStream(new FileOutputStream(f), fileBufferSize);
    ws.setFormat(FileFormats.FMT_WAVE_S16);
    ws.write(fos);
    fos.close();
    advancerRegistry.unregisterAdvancer(pe);
    advancerRegistry.unregisterAdvancer(ws);
    NativeObjects.unregisterNativeObject(pe);
    NativeObjects.unregisterNativeObject(ws);
View Full Code Here

    mul _mul1=new mul(), _mul2=new mul();
    _mul1.setSource(IN.i, fl, OUT.i);
    _mul1.setSource(IN_IMAG.i, ConstStream.c(0.5), OUT.i);
    _mul2.setSource(IN.i, fl, OUT_IMAG.i);
    _mul2.setSource(IN_IMAG.i, ConstStream.c(0.5), OUT.i);
    OutputFile of=new OutputFile(2);
    advancerRegistry.registerAdvancer(of);
    advancerRegistry.registerAdvancer(fl);
    advancerRegistry.registerAdvancer(in);
    advancerRegistry.registerAdvancer(_mul1);
    advancerRegistry.registerAdvancer(_mul2);
    of.setSource(0, _mul1, OUT.i);
    of.setSource(-1, _mul2, OUT.i);
    fl.setSource(IN.i, in, OUT.i);
    fl.setSource(FREQUENCY.i, ConstStream.c(0.366), OUT.i);
    fl.setSource(DEPTH.i, ConstStream.c(0.0025), OUT.i);
    fl.setSource(MAXDELAY.i, ConstStream.c(0.0075), OUT.i);
    fl.setSource(DELAY.i, ConstStream.c(0.0033), OUT.i);
    for(double time=0; time==0||in.getValue(GATE.i)>0; time+=1/globalParameters.getSampleRate()){
    advancerRegistry.advanceAll();
    }
    File f=new File("flanger-out.wav");
    BufferedOutputStream fos=new BufferedOutputStream(new FileOutputStream(f), fileBufferSize);
    of.setFormat(FileFormats.FMT_WAVE_S16);
    of.write(fos);
    fos.close();
    advancerRegistry.unregisterAdvancer(in);
    advancerRegistry.unregisterAdvancer(of);
    advancerRegistry.unregisterAdvancer(_mul1);
    advancerRegistry.unregisterAdvancer(_mul2);
View Full Code Here

TOP

Related Classes of de.maramuse.soundcomp.files.OutputFile

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.