• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#objective-cqt誰得windowscocoapythonphprubygameguibathyscaphec翻訳omegat計画中(planning stage)frameworktwittertestdomvb.netdirectxbtronarduinopreviewerゲームエンジン

oga's tools


コミットメタ情報

リビジョンbc86193640f178cfb95b2749b60c51e97deb7b2a (tree)
日時2021-05-03 09:11:08
作者oga <hyperoga@gmai...>
コミッターoga

ログメッセージ

2021/05/03 V0.30 support -cs cut silent part

変更サマリ

差分

--- a/wavcut.c
+++ b/wavcut.c
@@ -13,6 +13,7 @@
1313 * 07/12/02 V0.27 support -m (merge wavs)
1414 * 11/01/29 V0.28 fix display bug
1515 * 12/03/19 V0.29 fix -ex degrade (調査中 ex. -ex 00:05-21:50)
16+ * 21/05/02 V0.30 support -cs cut silent part
1617 *
1718 *
1819 * お勧め: wavcut -s -lv 20 -ln 15
@@ -48,7 +49,7 @@
4849 #define strncasecmp strnicmp
4950 #endif /* _WIN32 */
5051
51-#define VER "0.28"
52+#define VER "0.30"
5253 #define dprintf if (vf) printf
5354 #define dprintf2 if (vf >= 2) printf
5455 #define sgn(x) (x==0)?0:((x>0)?1:-1)
@@ -66,6 +67,7 @@ int nf = 0; /* -no normalize */
6667 int volf = 0; /* -vol volume V0.25-A */
6768 int rvf = 0; /* -rv reduce voice V0.24-A */
6869 int mf = 0; /* -m merge wavfiles V0.27-A */
70+int csf = 0; /* -cs cut silent part V0.30-A */
6971 int peak_level = 0; /* peak level for -no */
7072 int max_level = 0; /* max level for -no */
7173 long pre_datlen = 0; /* heders total length to wav data */
@@ -444,7 +446,7 @@ int WavAnalyze(FILE *fp)
444446 }
445447 }
446448
447- if (sf || (ntment && outf)) {
449+ if (sf || csf || (ntment && outf)) { /* V0.30-A */
448450 /* ### Open Output File */
449451 sprintf(fname, "%s_%03d.wav", in_fname, file_cnt++);
450452 printf("## Writing %s ...\n", fname);
@@ -470,8 +472,12 @@ int WavAnalyze(FILE *fp)
470472 buf16 = (short *)buf; /* V0.21-A */
471473
472474 if (wfp) {
473- fwrite(buf, 1, gUnit, wfp);
474- data_size += len; /* data chunk size for write */
475+ if (csf && contf) { /* V0.30-A */
476+ /* -cs指定でblank中は書き込みスキップ */
477+ } else {
478+ fwrite(buf, 1, gUnit, wfp);
479+ data_size += len; /* data chunk size for write */
480+ }
475481 }
476482
477483 if (df) {
@@ -554,7 +560,9 @@ int WavAnalyze(FILE *fp)
554560 *ckfmt->dwAvgBytesPerSec*60)
555561 /ckfmt->dwAvgBytesPerSec));
556562
557- data_size = 0; /* reset data chunk size */
563+ if (csf == 0) { /* V0.30-A */
564+ data_size = 0; /* reset data chunk size */
565+ }
558566 if (sf) {
559567 sprintf(fname, "%s_%03d.wav", in_fname, file_cnt++);
560568 printf("## Writing %s ...\n", fname);
@@ -1365,13 +1373,14 @@ void usage()
13651373 {
13661374 printf("wavcut Ver %s\n", VER);
13671375 printf("usage: wavcut [-d]\n");
1368- printf(" { [-s] [-lv <cut_level(%d)>] [-ln <blank_len>(%d)>]\n", th_val, bl_sec);
1376+ printf(" { [{-s|-cs}] [-lv <cut_level(%d)>] [-ln <blank_len>(%d)>]\n", th_val, bl_sec);
13691377 printf(" | -ex mm:ss-mm:ss[,mm:ss-ss,...]\n");
13701378 printf(" | {-no | -vol <%%>}\n");
13711379 printf(" | -rv }\n");
13721380 printf(" [<wav_file>]\n");
13731381 printf(" -d : display data\n");
13741382 printf(" -s : split wav data\n");
1383+ printf(" -cs : cut silent part\n");
13751384 printf(" -lv : blank level. default:%d (x0.1%%)\n", th_val);
13761385 printf(" -ln : time to recognize blank. default:%d (x0.1sec)\n", bl_sec);
13771386 printf(" -ex : extract wav part\n");
@@ -1379,7 +1388,7 @@ void usage()
13791388 printf(" -vol: set volume\n");
13801389 printf(" -rv : reduce voice part\n");
13811390 printf("usage: wavcut -m <wav_file> <wav_file> ...\n"); /* V0.27-A */
1382- printf(" -m : merge wav files\n"); /* V0.27-A */
1391+ printf(" -m : merge wav files (not available)\n"); /* V0.27-A */
13831392 exit(1);
13841393 }
13851394
@@ -1409,12 +1418,23 @@ int main(int a, char *b[])
14091418 continue;
14101419 }
14111420 if (!strncmp(b[i],"-s",2)) {
1412- if (ntment) {
1421+ if (ntment || csf) { /* V0.30-C */
14131422 usage();
14141423 }
14151424 sf = 1; /* Split Wav Data */
14161425 continue;
14171426 }
1427+
1428+ /* V0.30-A start */
1429+ if (!strncmp(b[i],"-cs",2)) {
1430+ if (ntment || sf) {
1431+ usage();
1432+ }
1433+ csf = 1; /* Cut Silent Part */
1434+ continue;
1435+ }
1436+ /* V0.30-A end */
1437+
14181438 if (!strcmp(b[i],"-m")) {
14191439 mf = 1; /* Merge Wav Files */
14201440 continue;
@@ -1441,7 +1461,7 @@ int main(int a, char *b[])
14411461 /* V0.25-A end */
14421462
14431463 if (i+1 < a && !strncmp(b[i],"-ex",3)) {
1444- if (sf) {
1464+ if (sf || csf) { /* V0.30-C */
14451465 usage();
14461466 }
14471467 ntment = GetTimes(b[++i], &start_dsec, &end_dsec); /* Extract wav */
@@ -1463,7 +1483,7 @@ int main(int a, char *b[])
14631483 }
14641484
14651485 /* V0.27-A start */
1466- if (mf && (volf || nf || sf || ntment || rvf)) {
1486+ if (mf && (volf || nf || sf || csf || ntment || rvf)) { /* V0.30-C */
14671487 usage();
14681488 }
14691489