Added intonation in Currah microspeech

This commit is contained in:
fabio.olimpieri 2014-05-11 18:07:00 +00:00
parent b2bf5c53d4
commit ab9e1fce3d
5 changed files with 20 additions and 24 deletions

View File

@ -1928,15 +1928,21 @@ void Z80free_Wr (register word Addr, register byte Value) {
// Currah microspeech ouput // Currah microspeech ouput
if((ordenador.currah_active)&&(ordenador.currah_paged)) if((ordenador.currah_active)&&(ordenador.currah_paged))
{ {
if (Addr==0x3000) {
//printf("write to 3000h\n");
ordenador.intonation_allophone = 0;
}
//if (Addr==0x3000) {printf("write to 3000h\n");ordenador.intonation_allophone = 0;} if (Addr==0x3001) {
//if (Addr==0x3001) {printf("write to 3001h\n");ordenador.intonation_allophone = 1;} //printf("write to 3001h\n");
ordenador.intonation_allophone = 1;
}
if ((Addr==0x1000)&&(!ordenador.currah_status)) //do not accept a new allophone if the previous is not finished if ((Addr==0x1000)&&(!ordenador.currah_status)) //do not accept a new allophone if the previous is not finished
{ {
//if (Value) printf("Currah output=%0xh\n",Value); //if (Value) printf("Currah output=%0xh\n",Value);
ordenador.current_allophone = (Value&0x3F); ordenador.current_allophone = (Value&0x3F);
//ordenador.intonation_allophone = (Value&0x40); //to be implemented ordenador.intonation_allophone = (Value&0x40); //to be implemented
ordenador.currah_status = 1; //Currah busy ordenador.currah_status = 1; //Currah busy
ordenador.allophone_sound_cuantity = 0; ordenador.allophone_sound_cuantity = 0;
return; return;

View File

@ -229,8 +229,6 @@ struct computer {
unsigned char currah_status; // 0: free; 1: busy unsigned char currah_status; // 0: free; 1: busy
unsigned char current_allophone; // allophone to be played unsigned char current_allophone; // allophone to be played
unsigned char intonation_allophone; unsigned char intonation_allophone;
//int currah_env_counter;
//int max_envelop;
int allophone_sound_cuantity; //pointer to allophone sample to be played int allophone_sound_cuantity; //pointer to allophone sample to be played
// OSD global variables // OSD global variables

View File

@ -41,13 +41,10 @@ void currah_microspeech_init() {
ordenador.current_allophone = 0; ordenador.current_allophone = 0;
ordenador.allophone_sound_cuantity = 0; ordenador.allophone_sound_cuantity = 0;
ordenador.intonation_allophone = 0; ordenador.intonation_allophone = 0;
//ordenador.currah_env_counter = 0;
//ordenador.max_envelop = MAX_ENVELOP;
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.wav",allophone_list[i]);
//sprintf(allophone_name, "fbzx/allophones/%.3d.wav",i);
fichero=myfopen(allophone_name,"rb"); fichero=myfopen(allophone_name,"rb");
if(fichero==NULL) { if(fichero==NULL) {
@ -89,8 +86,6 @@ void currah_microspeech_reset() {
ordenador.current_allophone = 0; ordenador.current_allophone = 0;
ordenador.allophone_sound_cuantity = 0; ordenador.allophone_sound_cuantity = 0;
ordenador.intonation_allophone = 0; ordenador.intonation_allophone = 0;
//ordenador.currah_env_counter = 0;
//ordenador.max_envelop = MAX_ENVELOP;
} }

View File

@ -20,13 +20,10 @@
#ifndef H_CURRAH_MICROSPEECH #ifndef H_CURRAH_MICROSPEECH
#define H_CURRAH_MICROSPEECH #define H_CURRAH_MICROSPEECH
#ifndef MAX_ENVELOP #ifndef INTONATION_INCREASE
#define MAX_ENVELOP 80 //Is this value rigth? #define INTONATION_INCREASE 32 //Is this value rigth?
#endif #endif
#ifndef ENVELOP_STEP
#define ENVELOP_STEP 1 //Is this value rigth?
#endif
#define ALLOPHONES 64 #define ALLOPHONES 64

View File

@ -368,14 +368,14 @@ 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])*64)<<16 *ordenador.current_buffer = (rvalue_sum/N_SAMPLES+((unsigned int)allophone_buffer[ordenador.current_allophone][ordenador.allophone_sound_cuantity/INTONATION_INCREASE])*64)<<16
|(lvalue_sum/N_SAMPLES+((unsigned int)allophone_buffer[ordenador.current_allophone][ordenador.allophone_sound_cuantity])*64); |(lvalue_sum/N_SAMPLES+((unsigned int)allophone_buffer[ordenador.current_allophone][ordenador.allophone_sound_cuantity/INTONATION_INCREASE])*64);
ordenador.allophone_sound_cuantity++; 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.allophone_sound_cuantity >= allophone_lenght[ordenador.current_allophone]) //allophone completed if (ordenador.allophone_sound_cuantity/INTONATION_INCREASE >= allophone_lenght[ordenador.current_allophone]) //allophone completed
{ {
ordenador.allophone_sound_cuantity = allophone_lenght[ordenador.current_allophone]*7/8; //repeat the last part ordenador.allophone_sound_cuantity = allophone_lenght[ordenador.current_allophone]*7/8*INTONATION_INCREASE; //repeat the last part
ordenador.currah_status = 0; //Ready for a new allophone ordenador.currah_status = 0; //Ready for a new allophone
} }