Esempio n. 1
0
int main(int argc, char **argv) {
    srand(time(0));
    init_synth(argc-1, argv+1);

    double totalcsd = 0.0, totalbits = 0.0, 
	   totalopt = 0.0;

    for(int n = 0; n < NTESTS; ++n) {
	create_random_problem(1);
	if(PRINT_TARGETS) {
	    cout << "  /* ";
	    print_set("targets:", TARGETS, 0, cout); 
	    cout << " */ " << endl;
	}
	totalcsd += csdcost(TARGETS);
	totalbits += bitscost(TARGETS);
	if(USE_TABLE) totalopt += optcost(TARGETS);
    }

    if_verbose(1) cerr << endl;
    double mean_csd = totalcsd / NTESTS;
    double mean_bits = totalbits / NTESTS;
    double mean_opt = 0;
    if(USE_TABLE) mean_opt = totalopt / NTESTS;

    printf("%.2d  %6.2f %6.2f %4.2f%%", MAX_SHIFT-1,
	mean_bits, mean_csd, (mean_bits-mean_csd)/mean_bits*100);
    if(USE_TABLE)
        printf(" %6.2f %4.2f%%",
	   mean_opt, (mean_bits-mean_opt)/mean_bits*100);
    printf("\n");
    return 0;
}
Esempio n. 2
0
int main(int argc, char **argv) {
    srand(time(0));
    acm_init();
    init_synth(argc-1, argv+1);

    vector<coeff_t> targets;
    vector<reg_t> dests;
    int i=0;
    targets = SPEC_ALL_TARGETS;
    dests.resize(targets.size());
    if(targets.size() >= TMP_REG_NUM)
      TMP_REG_NUM = targets.size() + 1;

    FORALL_V(targets, t) {
        dests[i] = destreg();
        ++i;
    }
Esempio n. 3
0
void main(void)
{
  int16_t x;
  // all generator inits
LPCAnalyzer_init();
init_synth(); // which one? --> klatt rsynth !!!! RENAME!
sp0256_init();
lpc_init();
simpleklatt_init();
sam_init();
sam_newsay(); // TEST!
tms5200_init();
tms5200_newsay();
 channelv_init();
 tube_init();
// tube_newsay();
 BANDS_Init_();
 Vocoder_Init(32000.0f);
 digitalk_init();
 digitalk_newsay(0);
 nvp_init();
 sample_rate_init();
 initbraidworm(); // re_name
  initvoicform();
  formy=malloc(sizeof(Formlet));
  formanty=malloc(sizeof(Formant));
  blipper=malloc(sizeof(Blip));
  RLPFer=malloc(sizeof(RLPF));
  Formlet_init(formy);
  Formant_init(formanty);
  Blip_init(blipper);
  RLPF_init(RLPFer);
  NTube_init(&tuber);
  //  wavetable_init(&wavtable, crowtable_slower, 283); // now last arg as length of table=less than 512
    wavetable_init(&wavtable, plaguetable_simplesir, 328); // now last arg as length of table=less than 512
  //  wavetable_init(&wavtable, table_kahrs000, 160); // now last arg as length of table=less than 512
    //  addwormsans(&myworm, 10.0f,10.0f,200.0f, 200.0f, wanderworm);
  //  RavenTube_init();
    //  newBB=BiQuad_new(LPF, 1.0, 1500, 32000, 0.68); // TEST?

 ////////
  ADC1_Init((uint16_t *)adc_buffer);
  Codec_Init(32000); 
  I2S_Block_Init();
  I2S_Block_PlayRec((uint32_t)&tx_buffer, (uint32_t)&rx_buffer, BUFF_LEN);
  //  Audio_Init(); not needed


  //  tube_init();
    //    tube_newsay();

    //    initializeSynthesizer();
      //   synthesize();

  //  lpc_newsay(1);
  //  SAMINIT();
  // test audio fill
    /*          for (x=0;x<32768;x++){
	  audio_buffer[x]=tube_get_sample();
	  }*/
  //   int writepos=run_holmes(writepos); 

  /*  for (x=0;x<32767;x++){
	    audio_buffer[x]=tube_get_sample();
	    }
  */

  while(1)
    {
  
            
  // testing changing test_elm
      //      u8 axis=adc_buffer[SELX]>>8; // 16*3=48
      // change element, change length? leave stress as is 0
      //      test_elm[axis*3]=phoneme_prob_remap[adc_buffer[SELY]>>6]; // how many phonemes?=64
      //      test_elm[(axis*3)+1]=(adc_buffer[SELZ]>>7)+1; // length say max 32
    

      //      oldmode=mode;    
      //      mode=adc_buffer[MODE]>>7; // 12 bits to say 32 modes (5 bits)
      //           mode=10; // TESTING

      //       if(lpc_busy() == 0) lpc_newsay(adc_buffer[SELX]>>6);   

      //    if(lpc_busy() != 0)    lpc_running(); // so just writes once otherwise gets messy...


  // if there is a change in mode do something?
  //  if (oldmode!=mode){
  //    maintrigger=1;
  //  }

	   /*  if (maintrigger==1) {writepos=0;trigger=1;} // STRIP_OUT

  switch(mode){
  case 0:// rsynth/klatt-single phoneme
           if (trigger==1){
	     trigger=0;
	     u8 phonemm=phoneme_prob_remap[(adc_buffer[SELX]>>6)]; // 7bits=128 %69//6=64
	     pair xx=klatt_phoneme(writepos,phonemm); 
	     generated=xx.generated;
	     writepos=xx.writepos;
	   }
	   break;
  case 1: // rsynth/klatt-chain of phonemes
    writepos=run_holmes(writepos); 
    break;
  case 2: // vosim free running
    writepos=runVOSIM_SC(writepos);
    break;
  case 3: // VOSIMondemand
    if (trigger==1){
      trigger=0;
      float freqwency = (float)((adc_buffer[SELX])+100);//1500.0f; 
      float cycles = (float)((adc_buffer[SELY]>>4)+2);
      float decay = ((float)(adc_buffer[SELZ])/4096.0f); // TODO as SELZ!
      pair xx=demandVOSIM_SC(writepos,freqwency,cycles,decay); 
      generated=xx.generated;
      writepos=xx.writepos;
    }
    break;
  case 9: // SAM full. no writepos though and just a simple proof here
        if (trigger==0){
    	SAMMain();
	trigger=1;
	     }     
    break;
  case 10:
    if(lpc_busy() == 0) lpc_newsay(adc_buffer[SELX]>>6);   

    if(lpc_busy() != 0)    lpc_running(); // so just writes once otherwise gets messy...
    break;
  case 19: // parwave/simpleklatt
    dosimpleklatt();
    break;

  } // cases

    // now readpos is back to one now that we have written something 
  if (maintrigger==1) {
      readpos=0;
      maintrigger=0;
  }
	   */
    }
}