void Synth_Init(void) { vol = env = 1; sound = MORPH_SAW; autoFilterON = false; autoSound = 0; chorusON = false; delayON = false; phaserON = false; Delay_init(); drifter_init(); //pitchGen_init(); sequencer_init(); ADSR_init(&adsr); Chorus_init(); PhaserInit(); SVF_init(); filterFreq = 0.25f; filterFreq2 = 0.25f; osc_init(&op1, 0.8f, 587.f); osc_init(&op2, 0.8f, 587.f); osc_init(&op3, 0.8f, 587.f); osc_init(&op4, 0.8f, 587.f); osc_init(&vibr_lfo, 0, VIBRATO_FREQ); osc_init(&filt_lfo, 0, 0); osc_init(&filt2_lfo, 0, 0); osc_init(&_lfo, 0, 0); AdditiveGen_newWaveform(); VCO_blepsaw_Init(&mbSawOsc); VCO_bleprect_Init(&mbRectOsc); VCO_bleptri_Init(&mbTriOsc); }
void *munger_new(double maxdelay, long channels) { int i, j; t_munger *x = (t_munger *)object_alloc(munger_class); //zero out the struct, to be careful (takk to jkclayton) if (x) { for(i=sizeof(t_pxobject);i<sizeof(t_munger);i++) ((char *)x)[i]=0; } if (maxdelay < 100.) maxdelay = 3000.; //set maxdelay to 3000ms by default post("munger: maxdelay = %f milliseconds", maxdelay); if (channels < 2) x->num_channels = 2; else x->num_channels = channels; if (x->num_channels > MAXCHANNELS) x->num_channels = MAXCHANNELS; post ("munger: number channels = %d", x->num_channels); dsp_setup((t_pxobject *)x,8); for (i=0;i<x->num_channels;i++) { outlet_new((t_object *)x, "signal"); } x->srate = sys_getsr(); x->one_over_srate = 1./x->srate; x->srate_ms = x->srate/1000.; x->one_over_srate_ms = 1./x->srate_ms; //x->buflen = (float)BUFLENGTH; if (x->recordBuf) sysmem_freeptr(x->recordBuf); x->initbuflen = (float)(maxdelay + 50.) * 44.1; //adding a little extra to avoid boundary bugs. x->buflen = x->initbuflen; x->maxsize = x->buflen / 3.; x->twothirdBufsize = x->maxsize * 2.; x->onethirdBufsize = x->maxsize; x->minsize = MINSIZE; x->voices = 10; x->gain = 1.; x->randgain = 0.; munger_alloc(x); x->twelfth = 1./12.; x->semitone = pow(2., 1./12.); x->smoothPitch = 1; x->scale_len = PITCHTABLESIZE; x->grate = 1.; x->grate_var = 0.; x->glen = 1.; x->glen_var = 0.; x->gpitch = 1.; x->gpitch_var = 0.; x->gpan_spread = 0.; x->time = 0; x->position = -1.; //-1 default == random positioning x->gimme = 0.; x->power = 1; x->ambi = 0; x->maxvoices = 20; x->oneshot = 0; x->newnote = 0; for(i=0; i<NUMVOICES; i++) { x->gvoiceSize[i] = 1000; x->gvoiceSpeed[i] = 1.; x->gvoiceCurrent[i] = 0.; x->gvoiceDirection[i] = 1; x->gvoiceOn[i] = 0; x->gvoiceDone[i] = 0; x->gvoiceRPan[i] = .5; x->gvoiceLPan[i] = .5; x->gvoiceGain[i] = 1.; ADSR_init(&x->gvoiceADSR[i]); x->gvoiceADSRon[i] = 0; for(j=0;j<MAXCHANNELS;j++) { x->gvoiceSpat[i][j] = 0.; } //note and oneshot inits x->noteTransp[i] = 0.; x->noteSize[i] = 100.; x->notePan[i] = 0.5; x->noteGain[i] = 1.; x->noteAttack[i] = 20.; x->noteDecay[i] = 50.; x->noteSustain[i] = 0.3; x->noteRelease[i] = 200.; } for(i=0;i<MAXCHANNELS;i++) { x->channelGain[i] = 0.; x->channelGainSpread[i] = 0.; } //init hanning window x->doHanning = 0; for(i=0; i<WINLENGTH; i++) x->winTable[i] = 0.5 + 0.5*cos(TWOPI * i/WINLENGTH + .5*TWOPI); for(i=0; i<PITCHTABLESIZE; i++) { x->pitchTable[i] = 0.; } x->rampLength = 256.; //sample buffer //for(i=0; i<BUFLENGTH; i++) x->recordBuf[i] = 0.; for(i=0; i<x->initbuflen; i++) x->recordBuf[i] = 0.; x->recordOn = 1; //boolean x->recordCurrent = 0; x->recordRampVal = 0; x->rec_ramping = 0; x->externalBuffer = 0; //use internal buffer by default srand(0.54); //post("mungery away"); return (x); }