ch_wave_main.cc (speech_tools-2.4-release) | : | ch_wave_main.cc (speech_tools-2.5.0-release) | ||
---|---|---|---|---|
skipping to change at line 49 | skipping to change at line 49 | |||
#include <cstdlib> | #include <cstdlib> | |||
#include <iostream> | #include <iostream> | |||
#include <cmath> | #include <cmath> | |||
#include "EST_Wave.h" | #include "EST_Wave.h" | |||
#include "EST_cmd_line.h" | #include "EST_cmd_line.h" | |||
#include "EST_cmd_line_options.h" | #include "EST_cmd_line_options.h" | |||
#include "EST_sigpr.h" | #include "EST_sigpr.h" | |||
#include "EST_wave_aux.h" | #include "EST_wave_aux.h" | |||
#include "EST.h" | #include "EST.h" | |||
#define sgn(x) (x>0?1:x?-1:0) | ||||
void wave_extract_channel(EST_Wave &single, const EST_Wave &multi, EST_IList &c h_list); | void wave_extract_channel(EST_Wave &single, const EST_Wave &multi, EST_IList &c h_list); | |||
void extract_channels(EST_Wave &single, const EST_Wave &multi, EST_IList &ch_li st); | void extract_channels(EST_Wave &single, const EST_Wave &multi, EST_IList &ch_li st); | |||
/** @name <command>ch_wave</command> <emphasis>Audio file manipulation</emphasis > | /** @name <command>ch_wave</command> <emphasis>Audio file manipulation</emphasis > | |||
@id ch_wave_manual | @id ch_wave_manual | |||
* @toc | * @toc | |||
*/ | */ | |||
//@{ | //@{ | |||
skipping to change at line 172 | skipping to change at line 174 | |||
"-divide Divide a single input waveform into multiple output \n" | "-divide Divide a single input waveform into multiple output \n" | |||
" waveforms. Each output waveform is extracted from the \n" | " waveforms. Each output waveform is extracted from the \n" | |||
" input waveform by using the KEYLAB file, which \n" | " input waveform by using the KEYLAB file, which \n" | |||
" specifies the start and stop times for each chunk. \n" | " specifies the start and stop times for each chunk. \n" | |||
" The output files are named according to the filename \n" | " The output files are named according to the filename \n" | |||
" in the KEYLAB file, with extension given by -ext. See \n" | " in the KEYLAB file, with extension given by -ext. See \n" | |||
" section on wave extraction\n\n" | " section on wave extraction\n\n" | |||
"-ext <string> File extension for divided waveforms\n\n" | "-ext <string> File extension for divided waveforms\n\n" | |||
"-compress <float> Apply Dynamic Range Compression by factor specified | ||||
\n" | ||||
"-extract <string> Used in conjunction with -key to extract a \n" | "-extract <string> Used in conjunction with -key to extract a \n" | |||
" single section of waveform from the input \n" | " single section of waveform from the input \n" | |||
" waveform. The argument is the name of a file given \n" | " waveform. The argument is the name of a file given \n" | |||
" in the file column of the KEYLAB file.\n", | " in the file column of the KEYLAB file.\n", | |||
files, al); | files, al); | |||
out_file = al.present("-o") ? al.val("-o") : (EST_String)"-"; | out_file = al.present("-o") ? al.val("-o") : (EST_String)"-"; | |||
// There will always be at least one (or stdin) | // There will always be at least one (or stdin) | |||
// The first is dealt specially in case its *way* big | // The first is dealt specially in case its *way* big | |||
skipping to change at line 240 | skipping to change at line 244 | |||
EST_Wave nsig; | EST_Wave nsig; | |||
StringtoStrList(al.val("-c"), s, " ,"); // separator can be space or comm a | StringtoStrList(al.val("-c"), s, " ,"); // separator can be space or comm a | |||
StrListtoIList(s, il); | StrListtoIList(s, il); | |||
extract_channels(nsig, sig, il); | extract_channels(nsig, sig, il); | |||
sig = nsig; | sig = nsig; | |||
} | } | |||
if (al.present("-F")) // resample | if (al.present("-F")) // resample | |||
sig.resample(al.ival("-F")); | sig.resample(al.ival("-F")); | |||
if (al.present("-compress")) // Dynamic Range Compression | ||||
{ | ||||
float mu = al.fval("-compress" , 0); | ||||
float lim = 30000.0; | ||||
sig.compress(mu, lim); | ||||
} | ||||
if (al.present("-scale")) // rescale | if (al.present("-scale")) // rescale | |||
{ | { | |||
float scale = al.fval("-scale", 0); | float scale = al.fval("-scale", 0); | |||
sig.rescale(scale); | sig.rescale(scale); | |||
} | } | |||
else if (al.present("-scaleN")) // rescale | if (al.present("-scaleN")) // rescale | |||
{ | { | |||
float scale = al.fval("-scaleN", 0); | float scale = al.fval("-scaleN", 0); | |||
if ((scale < 0) || (scale > 1.0)) | if ((scale < 0) || (scale > 1.0)) | |||
{ | { | |||
cerr << "ch_wave: -scaleN must be in range 0 to 1" << endl; | cerr << "ch_wave: -scaleN must be in range 0 to 1" << endl; | |||
exit(-1); | exit(-1); | |||
} | } | |||
sig.rescale(scale,1); | sig.rescale(scale,1); | |||
} | } | |||
End of changes. 4 change blocks. | ||||
1 lines changed or deleted | 14 lines changed or added |