shithub: flite

Download patch

ref: fecc1652cb5196838ea5382264e471fea8db887e
parent: 82ccfd17ad7ad52e64651a9d63092a3e8f282567
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Fri Jun 4 04:26:53 EDT 2021

enable two more voices (awb and rms)

--- /dev/null
+++ b/lang/cmu_us_awb/mkfile
@@ -1,0 +1,25 @@
+<../../mkfile.common
+
+CFLAGS=$CFLAGS -I../usenglish -I../cmulex
+
+HFILES=\
+	cmu_us_awb_cg_durmodel.h\
+	cmu_us_awb_cg_f0_trees.h\
+	cmu_us_awb_cg_single_mcep_trees.h\
+	cmu_us_awb_spamf0_accent.h\
+	cmu_us_awb_spamf0_phrase.h\
+	voxdefs.h\
+
+OFILES=\
+	cmu_us_awb.$O\
+	cmu_us_awb_cg.$O\
+	cmu_us_awb_cg_durmodel.$O\
+	cmu_us_awb_cg_f0_trees.$O\
+	cmu_us_awb_cg_phonestate.$O\
+	cmu_us_awb_cg_single_mcep_trees.$O\
+	cmu_us_awb_cg_single_params.$O\
+	cmu_us_awb_spamf0_accent.$O\
+	cmu_us_awb_spamf0_accent_params.$O\
+	cmu_us_awb_spamf0_phrase.$O\
+
+</sys/src/cmd/mklib
--- /dev/null
+++ b/lang/cmu_us_rms/mkfile
@@ -1,0 +1,26 @@
+<../../mkfile.common
+
+CFLAGS=$CFLAGS -I../usenglish -I../cmulex
+
+HFILES=\
+	cmu_us_rms_cg_durmodel.h\
+	cmu_us_rms_cg_f0_trees.h\
+	cmu_us_rms_cg_single_mcep_trees.h\
+	cmu_us_rms_spamf0_accent.h\
+	cmu_us_rms_spamf0_phrase.h\
+	stdafx.h\
+	voxdefs.h\
+
+OFILES=\
+	cmu_us_rms.$O\
+	cmu_us_rms_cg.$O\
+	cmu_us_rms_cg_durmodel.$O\
+	cmu_us_rms_cg_f0_trees.$O\
+	cmu_us_rms_cg_phonestate.$O\
+	cmu_us_rms_cg_single_mcep_trees.$O\
+	cmu_us_rms_cg_single_params.$O\
+	cmu_us_rms_spamf0_accent.$O\
+	cmu_us_rms_spamf0_accent_params.$O\
+	cmu_us_rms_spamf0_phrase.$O\
+
+</sys/src/cmd/mklib
--- a/main/flite_plan9.c
+++ b/main/flite_plan9.c
@@ -42,6 +42,8 @@
 #include <bio.h>
 #include "flite_version.h"
 
+#pragma lib "../lang/cmu_us_awb/libcmu_us_awb.$M.a"
+#pragma lib "../lang/cmu_us_rms/libcmu_us_rms.$M.a"
 #pragma lib "../lang/cmu_us_slt/libcmu_us_slt.$M.a"
 #pragma lib "../lang/cmulex/libcmulex.$M.a"
 #pragma lib "../lang/usenglish/libusenglish.$M.a"
@@ -62,12 +64,16 @@
 	return nil;
 }
 
+cst_voice *register_cmu_us_awb(const char *voxdir);
+cst_voice *register_cmu_us_rms(const char *voxdir);
 cst_voice *register_cmu_us_slt(const char *voxdir);
 
 cst_val *
 flite_set_voice_list(const char *voxdir)
 {
-	flite_voice_list = cons_val(voice_val(register_cmu_us_slt(voxdir)),flite_voice_list);
+	flite_voice_list = cons_val(voice_val(register_cmu_us_slt(voxdir)), flite_voice_list);
+	flite_voice_list = cons_val(voice_val(register_cmu_us_awb(voxdir)), flite_voice_list);
+	flite_voice_list = cons_val(voice_val(register_cmu_us_rms(voxdir)), flite_voice_list);
 	flite_voice_list = val_reverse(flite_voice_list);
 
 	return flite_voice_list;
@@ -99,17 +105,18 @@
 }
 
 static int
-runconv(void)
+runconv(cst_wave *w)
 {
 	char fmt[16];
 	int p[2];
 
+	sprintf(fmt, "s%dr%dc%d", 16, cst_wave_sample_rate(w), cst_wave_num_channels(w));
+
 	pipe(p);
 	if(rfork(RFPROC|RFNOTEG|RFFDG|RFCENVG) == 0){
 		dup(p[1], 0);
 		close(p[0]);
 		close(p[1]);
-		sprintf(fmt, "s%dr%dc%d", 16, 16000, 1);
 		execl("/bin/audio/pcmconv", "pcmconv", "-i", fmt, nil);
 		fprint(2, "%r\n");
 		exits("pcmconv");
@@ -127,7 +134,7 @@
 	USED(last, a);
 
 	if(fd < 0)
-		fd = runconv();
+		fd = runconv(w);
 
 	write(fd, cst_wave_samples(w)+start, 2*size);