#include "..//..//get//header.h" #include "..//..//sequenze//sequenze.h" #include "..//..//wav//wav.h" #include "..//..//effetti//effetti.h" #include int main() { int Fs = 44100, T = 500, mods = 10, i,n; double m = 0.1, l = 0.1, L = l * Fs / (sqrt(T/(m/l))), mod = 0.01; vector x(44100*3,0.0), y(44100*3,0.0), a(44100*3,0.0); 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 corda_lagrange E((int)L*(1+mod) +1); double d = L; double res =0; for(n=0;n< x.size(); n++) { a[n] = x[n] + res*0.995; if(n==0) y[n] = a[n]/2; else y[n] = 0.5 * (a[n] + a[n-1]); res = E.var_lagrange(y[n], d); d = L * ( 1 + mod * sin(n/(mods*L))); } 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; }