Code for integer signed allophones

This commit is contained in:
fabio.olimpieri 2014-05-16 11:15:43 +00:00
parent da87da69dc
commit b859058985
3 changed files with 8 additions and 9 deletions

View File

@ -23,7 +23,7 @@
#include "emulator.h" #include "emulator.h"
int allophone_lenght[ALLOPHONES]; int allophone_lenght[ALLOPHONES];
unsigned char *allophone_buffer[ALLOPHONES]; signed char *allophone_buffer[ALLOPHONES];
char *allophone_list[] = {"pa1","pa2","pa3","pa4","pa5","oy","ay","eh","kk3","pp","jh","nn1","ih","tt2","rr1", char *allophone_list[] = {"pa1","pa2","pa3","pa4","pa5","oy","ay","eh","kk3","pp","jh","nn1","ih","tt2","rr1",
"ax","mm","tt1","dh1","iy","ey","dd1","uw1","ao","aa","yy2","ae","hh1","bb1","th","uh","uw2","aw","dd2","gg3","vv", "ax","mm","tt1","dh1","iy","ey","dd1","uw1","ao","aa","yy2","ae","hh1","bb1","th","uh","uw2","aw","dd2","gg3","vv",
@ -32,7 +32,7 @@ char *allophone_list[] = {"pa1","pa2","pa3","pa4","pa5","oy","ay","eh","kk3","pp
void currah_microspeech_init() { void currah_microspeech_init() {
int i,b; int i;
FILE *fichero; FILE *fichero;
char allophone_name[16]; char allophone_name[16];
@ -44,7 +44,7 @@ void currah_microspeech_init() {
for (i=0; i<ALLOPHONES; i++) for (i=0; i<ALLOPHONES; i++)
{ {
sprintf(allophone_name, "fbzx/allophones/%s.wav",allophone_list[i]); sprintf(allophone_name, "fbzx/allophones/%s.raw",allophone_list[i]);
fichero=myfopen(allophone_name,"rb"); fichero=myfopen(allophone_name,"rb");
if(fichero==NULL) { if(fichero==NULL) {
@ -56,7 +56,7 @@ void currah_microspeech_init() {
allophone_lenght[i]=ftell (fichero); allophone_lenght[i]=ftell (fichero);
fseek (fichero, 0, SEEK_SET); fseek (fichero, 0, SEEK_SET);
allophone_buffer[i]= (unsigned char *) malloc(allophone_lenght[i]); allophone_buffer[i]= (signed char *) malloc(allophone_lenght[i]);
if (allophone_buffer[i]==NULL) { if (allophone_buffer[i]==NULL) {
printf("Can't allocate allophone: %d\n",i); printf("Can't allocate allophone: %d\n",i);
@ -69,8 +69,7 @@ void currah_microspeech_init() {
} }
for (i=0; i<5; i++) for (i=0; i<5; i++)
for (b=0; b<allophone_lenght[i]; b++) memset(allophone_buffer[i], 0x00, allophone_lenght[i]);
allophone_buffer[i][b]=0x80;
} }
void currah_microspeech_fini() { void currah_microspeech_fini() {

View File

@ -28,7 +28,7 @@
#define ALLOPHONES 64 #define ALLOPHONES 64
extern int allophone_lenght[ALLOPHONES]; extern int allophone_lenght[ALLOPHONES];
extern unsigned char *allophone_buffer[ALLOPHONES]; extern signed char *allophone_buffer[ALLOPHONES];
void currah_microspeech_init(); void currah_microspeech_init();
void currah_microspeech_reset(); void currah_microspeech_reset();

View File

@ -368,8 +368,8 @@ inline void play_sound (unsigned int tstados) {
{ {
if ((ordenador.currah_active)&&(!ordenador.turbo_state)) if ((ordenador.currah_active)&&(!ordenador.turbo_state))
{ {
*ordenador.current_buffer = (rvalue_sum/N_SAMPLES+((unsigned int)allophone_buffer[ordenador.current_allophone][ordenador.allophone_sound_cuantity/INTONATION_INCREASE])*ordenador.volume*4)<<16 *ordenador.current_buffer = ((((int)(rvalue_sum/N_SAMPLES)+((int)allophone_buffer[ordenador.current_allophone][ordenador.allophone_sound_cuantity/INTONATION_INCREASE])*(int)ordenador.volume*4)<<16)&0XFFFF0000)
|(lvalue_sum/N_SAMPLES+((unsigned int)allophone_buffer[ordenador.current_allophone][ordenador.allophone_sound_cuantity/INTONATION_INCREASE])*ordenador.volume*4); |(((int)(lvalue_sum/N_SAMPLES)+((int)allophone_buffer[ordenador.current_allophone][ordenador.allophone_sound_cuantity/INTONATION_INCREASE])*(int)ordenador.volume*4)&0X0000FFFF);
if(!ordenador.intonation_allophone) ordenador.allophone_sound_cuantity+=INTONATION_INCREASE; else ordenador.allophone_sound_cuantity+=INTONATION_INCREASE+1; //The freq increase should be gradual if(!ordenador.intonation_allophone) ordenador.allophone_sound_cuantity+=INTONATION_INCREASE; else ordenador.allophone_sound_cuantity+=INTONATION_INCREASE+1; //The freq increase should be gradual