#include "..//..//get//header.h" #include "..//..//sequenze//sequenze.h" #include "..//..//wav//wav.h" #include "..//..//effetti//effetti.h" #include int main() { // Parametri per il cambio di tonalità per la simulazione dello snare, il tom, ecc.. // ____________________________________________ double L = 800; double b = 0.5; // ___________________________________________ vector x(10000,0.0), y(10000,0.0); int i,n; for(i = 0; i < (int)ceil(L); i++) x[i] = (2*(double)rand()/RAND_MAX - 1)/2; // Linea di ritardo frazionaria variabile con interpolazione di lagrange EFFETTI E(x); double d = L; vector w((int)d,0.0); double res1 = 0, res2 = 0; int p = 0; for(n=0;n< x.size(); n++) { if ((double)rand()/RAND_MAX > b) y[n] = x[n] + 0.5 * ( res1 + res2)*0.995; else y[n] = x[n] - 0.5 * ( res1 + res2 ) *0.995; if (n > 0) { res1 = E.lagrange_delayline(w, d, p, y[n]); res2 = E.lagrange_delayline(w, d, p, y[n-1]);} else { res1 = E.lagrange_delayline(w, d, p, y[n]); res2 = 0;} } string strName = "x.txt"; DSP_File out_file_X(strName); out_file_X.write(y); out_file_X.close(); //system("..\\..\\gnuplot\\wgnuplot.exe"); // Salvataggio file wav double sampleRate = 44100; unsigned int bitsPerSample = 16; unsigned int channels = 1; // Oggetto WAV di output WAV_OUT outfile(sampleRate, bitsPerSample, channels); char str_write_char[10]; printf("Inserisci il nome del file sonoro di output (.wav): "); scanf("%s", str_write_char); for(i=0; i < y.size(); i++) {outfile.write_current_output(((65536.0 / 2.0) - 1.0)*y[i]);} outfile.save_wave_file(str_write_char); //PlaySound(str_write_char, NULL, SND_FILENAME|SND_LOOP); return 0; }