42 #if defined(WIN32) || defined(__CYGWIN__) 48 #if defined(WIN32) || defined(__CYGWIN__) 54 int main (
int argc,
char *argv[])
64 "Summary; record waveform from audio device\n"+
65 "use \"-\" to make output files stdout\n"+
67 "-f <int> Input sample rate\n"+
68 "-audiodevice <string> use specified audiodevice if appropriate\n" 70 "-time <float> Wave length in seconds\n"+
73 "-p <string> audio device protocol. Ths supported types are\n"+
80 al.
add_item(
"-sample_rate",
"16000");
85 out_file = al.
val(
"-o");
86 #if defined(WIN32) || defined(__CYGWIN__) 87 if (win_record_wave(wave,al) != 0)
99 #if defined(WIN32) || defined(__CYGWIN__) 102 char command_buffer[100];
103 MCIERROR audio_error;
109 cerr <<
"na_record: for Win32 version, must specify an output file with the -o flag" << endl;
112 out_file = al.
val(
"-o");
118 audio_error = mciSendString(
"open new type waveaudio alias mysound buffer 6",
NULL,0,
NULL);
120 sprintf(command_buffer,
"set mysound time format ms bitspersample 16 samplespersec %d",44100);
121 audio_error = mciSendString(command_buffer,
NULL, 0 ,
NULL);
132 sprintf(command_buffer,
"record mysound from 0 to %d wait",(
int)(2*1000*al.
fval(
"-time")*44100)/11025);
133 audio_error = mciSendString(command_buffer,
NULL,0,
NULL);
134 sprintf(command_buffer,
"save mysound %s",(
char *)al.
val(
"-o"));
135 audio_error = mciSendString(command_buffer,
NULL,0,
NULL);
137 audio_error = mciSendString(
"close mysound",
NULL,0,
NULL);
A class for storing digital waveforms. The waveform is stored as an array of 16 bit shorts...
int main(int argc, char *argv[])
int ival(const EST_String &rkey, int m=1) const
int record_wave(EST_Wave &wave, EST_Option &al)
float fval(const EST_String &rkey, int m=1) const
const V & val(const K &rkey, bool m=0) const
return value according to key (const)
int add_item(const K &rkey, const V &rval, int no_search=0)
add key-val pair to list
EST_write_status write_wave(EST_Wave &sig, const EST_String &in_file, EST_Option &al)
EST_read_status read_wave(EST_Wave &sig, const EST_String &in_file, EST_Option &al)
EST_String options_wave_output(void)
int present(const K &rkey) const
Returns true if key is present.
EST_String options_supported_audio(void)
void resample(int rate)
Resample waveform to rate
int parse_command_line(int argc, char *argv[], const EST_String &usage, EST_StrList &files, EST_Option &al, int make_stdio=1)
int record_voxware_wave(EST_Wave &inwave, EST_Option &al)