#include "..//..//get//header.h" #include "..//..//sequenze//sequenze.h" #include "..//..//wav//wav.h" int main() { try { int sec = 0, samples = 0, i = 0; double f_c = 44100; getInput( "Inserisci la frequenza di campionamento", f_c, 100, 44100); getInput( "Inserisci il numero di secondi che vuoi creare", sec, 1, 5); samples = sec*f_c; int freqs = 0; getInput( "Inserisci il numero di frequenze", freqs, 1, 20 ); vector vecFreqs( freqs ); for ( i = 0; i < freqs; i++ ) { char format[80] = { 0 }; sprintf( format, "Frequenza #%d", i ); float Nyquist = f_c/2; getInput(format, vecFreqs[i], 0.0f, Nyquist); } makeWave nota(samples, f_c, vecFreqs); string strName; do getInput( "Inserisci il nome del file del segnale audio di output (.txt): ", strName ); while ( strName.empty() ); DSP_File out_file(strName); out_file.write(nota.get_t(),nota.get_x()); out_file.close(); WAV_OUT outfile(f_c,16, 1); // Memorizzazione della sequenza filtrata in formato WAV char str_write_char[10]; printf("Inserisci il nome del file del segnale audio di output (.wav): "); scanf("%s", str_write_char); vector x_n = nota.get_x(); i = 0; while(i < nota.length()) { outfile.write_current_output(((65536.0 / 2.0) - 1.0) * x_n[i]); i++; } outfile.save_wave_file(str_write_char); // Esecuzione di gnuplot per la visualizzazione system("..\\..\\gnuplot\\wgnuplot.exe"); } catch ( DSPException& e ) { // Display exception cerr << e; return 1; } return 0; }