tux_imagine.c

joris Abadiejoris Abadie

/*************bascule**4fronts*courts*4front*long********descente*et*amplitude*et*durer*reglable****************/

/* Imaginer et creer par Abadie joris*/
/* en utilisant un concept de Andre pierre jocelyn*/
/*Cette oeuvre est protégée et n'est divulguée que pour utilisation sous linux dans les conditions Creative common ci-dessous*/
/* Cette oeuvre est mise à disposition selon les termes de la Licence Creative Commons Paternité - Pas d'Utilisation Commerciale - Partage des Conditions Initiales à l'Identique 2.0 France. */
/*Aucune garantie n'est donner sur les effets de cet executable*/
/* pour compiler :compiler gcc tux_imagine.c -lm -o ImagineVoix***/

/***ici seulement 10 octets pour créer un son, la porteuse indique le ton, le temps la durée du son joué, et ensuite 8 variations**/

/**soit ici 12,7 Kio de son écrit avec 10 octets, c'est la force du concept du siècle des lumières en opposition à l'algèbre ***/


/***pour compiler***gcc tux_imagine.c -lm -o ImagineVoix***/
/**pour compiler gcc tux_imagine.c -lm -o ImagineVoix ***/

#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <math.h>



#define ceccicorsica "montage.joa"
#define efface "joris.wav"
#define a25joris "entetebase.wav"
#define cecci "montage.joa"


/**j'indique ici mes Fonctions***/
int fonctionImagineVoix4 ();
int FonctionPasserelle ();
int FonctionEntete ();

/*******gcc -o calcul_entete calcul_entete.c ****pour*compiler******************************************************************/

/**attention*en*cas*de*problème*rencontré*sur*la*durée*du*fichier*audio*créé
en présence de processeur 64
il*faut*ajouter*
#include <stdint.h>
et ensuite remplacer
long int longueurentete, nbdepointsentete, amplitudeentete;
par
int32_t durerentete, longueurentete, nbdepointsentete, amplitudeentete;
et remplacer ensuite les termes
%ld
par
%d
*/


#define ceccitexte "entete.txt"

long int longueurentete, nbdepointsentete, amplitudeentete, durerentete;

int FonctionEntete(int argc, char *argv[])
{

durerentete = 0;
longueurentete = 0;

/*j ouvre mon fichier de donner*/
FILE* fichierjoa1 = NULL;
FILE* fichierjo1 = NULL;
fichierjoa1 = fopen(ceccicorsica, "r");
fichierjo1 = fopen(ceccitexte, "wb");

if (fichierjoa1 != NULL)
{

if (fichierjo1 != NULL)
{


while ( fscanf(fichierjoa1,"%ld %ld", &amplitudeentete, &nbdepointsentete) !=EOF )
{

durerentete = durerentete + nbdepointsentete;


}

fprintf(fichierjo1, "%ld", durerentete);

/*ici*je*commence*le*traitement*comme*jécris*chaque*base*de*temps*sur*deux*octets*je*multiplis*par*2*/

durerentete = durerentete*2;



longueurentete = durerentete + 56 - 8;

fclose(fichierjo1), fichierjo1 = NULL;;
fclose(fichierjoa1), fichierjoa1 = NULL;;
}

}







FILE* debutwav = NULL;
debutwav = fopen(a25joris, "wb+");
if (debutwav != NULL)
   {

/****declaration**type**audio*4octets**/


unsigned char riff[4] = {0x52,0x49,0x46,0x46};

fwrite(riff,1,sizeof(riff),debutwav);

/****longueurentete*du*fichier*audio*ici*21200**/


/*

unsigned char durerentetea[4] = {0x32,0x65,0x0B,0x01};

fwrite(durerentetea,1,sizeof(durerentetea),debutwav);

*/

fwrite( &longueurentete , sizeof(longueurentete) , 1 , debutwav);


/****declaration**type**wave*4octets**/

unsigned char wave[4] = {0x57,0x41,0x56,0x45};

fwrite(wave,1,sizeof(wave),debutwav);


/****declaration**type**fmt suivit d'un espace qui s'écrit 0x20 soit 4octets**/

unsigned char fmt[4] = {0x66,0x6D,0x74,0x20};

fwrite(fmt,1,sizeof(fmt),debutwav);

/****declaration**de*la*maniere d'écrire*sous forme*d'un*entier long (long int) soit 4octets**/
/**comme c'est du 16 octets en exadécimal cela donne 0x10****/

unsigned char poids[4] = {0x10,0x00,0x00,0x00};

fwrite(poids,1,sizeof(poids),debutwav);


/****codage pour indiquer le PCM c'est : 1 soit 2octets**/

unsigned char pourpcm[2] = {0x01,0x00};

fwrite(pourpcm,1,sizeof(pourpcm),debutwav);

/****nombre de piste sur 2octets*ici c'est du mono, donc 1*/

unsigned char piste[2] = {0x01,0x00};

fwrite(piste,1,sizeof(piste),debutwav);



/**nombre d'échantillons par seconde**sur 4 octets**/

unsigned char tempsunitaire[4] = {0x44,0xAC,0x00,0x00};

fwrite(tempsunitaire,1,sizeof(tempsunitaire),debutwav);

/**nombre d'octets par secondes**sur 4 octets***le*double*du*précédent*dans*ce*cas*/

unsigned char octetpars[4] = {0x88,0x58,0x01,0x00};

fwrite(octetpars,1,sizeof(octetpars),debutwav);


/*taille en octet d'1 échantillon***sur*2octets**/

unsigned char tailleechant[2] = {0x02,0x00};

fwrite(tailleechant,1,sizeof(tailleechant),debutwav);

/*contient le nombre de bits par échantillon*2x8=16*soit*10*en*exa**sur*2octets**/

unsigned char bitparechan[2] = {0x10,0x00};

fwrite(bitparechan,1,sizeof(bitparechan),debutwav);


/**On ecrit ici data pour dire que le fichier commence**sur 4cotets**/

unsigned char mono[4] =
{0x64,0x61,0x74,0x61};


fwrite(mono,1,sizeof(mono),debutwav);

/****longueurentete*du*fichier*audio**/

/*
unsigned char durerenteteb[4] = {0x0E,0x65,0x0B,0x01};

fwrite(durerenteteb,1,sizeof(durerenteteb),debutwav);
*/

fwrite( &durerentete , sizeof(durerentete) , 1 , debutwav);




fclose(debutwav), debutwav = NULL;;

   }
return 0;
}

/************fin*du createur**entete********************************************************************************/


/****fonction*de*reponse1***fonction***/


int fonctionImagineVoixreponsefonction1 (int vari1)

{

double repond1;
double repond1amplitude;
int pond1amplitude;
repond1 = (double)vari1;


repond1amplitude = ((-repond1)/200);


repond1amplitude = exp(repond1amplitude);


repond1amplitude = 1 - (repond1amplitude);

/******
repond1amplitude = 32768*(repond1amplitude);
*****/

repond1amplitude = 32000*(repond1amplitude);

repond1amplitude = 32768+(repond1amplitude);


pond1amplitude = (int)(repond1amplitude);




return pond1amplitude;
}

/******fin*de*reponse1****fonction1****/
/****fonction*de*reponse2***fonction***/


int fonctionImagineVoixreponsefonction2 (int vari2)

{

double repond2;
double repond2amplitude;
int pond2amplitude;
repond2 = (double)vari2;


repond2amplitude = ((-repond2)/200);


repond2amplitude = exp(repond2amplitude);


repond2amplitude = 1 - (repond2amplitude);


/**repond2amplitude = 32768*(repond2amplitude);**/
repond2amplitude = 32000*(repond2amplitude);



repond2amplitude = 32768-(repond2amplitude);


pond2amplitude = (int)(repond2amplitude);




return pond2amplitude;
}

/******fin*de*reponse2****fonction****/


int fonctionImagineVoix4 (int argc, char *argv[])

{
int durer1monte, durer2monte, durer3monte, durer4monte, durer5monte, durer6monte, durer7monte, durer8monte;
int volume1monte, volume2monte, volume3monte, volume4monte, volume5monte, volume6monte, volume7monte, volume8monte;
int boucle, boucle1, temps, tempsinv, tempsinv1;
int modif1d, modif2d, modif3d, modif4d, modif5d, modif6d, modif7d, modif8d;
int modif1rd, modif2rd, modif3rd, modif4rd, modif5rd, modif6rd, modif7rd, modif8rd;
int modif1v, modif2v, modif3v, modif4v, modif5v, modif6v, modif7v, modif8v;
int modif1rv, modif2rv, modif3rv, modif4rv, modif5rv, modif6rv, modif7rv, modif8rv;
int forme1, forme2, forme3, forme4, forme5, forme6, forme7, forme8;
int melangeCetCpp, melangeCetCpp1, melangeCetCpp2, melangeCetCpp3, melangeCetCpp4, melangeCetCpp5, melangeCetCpp6, melangeCetCpp7;


/***variation1 = durée premier front montant****/
/***variation2 = durée premier front descendant****/
/***variation3 = durée deuxieme front montant****/
/***variation4 = durée deuxieme front descendant****/
/***temps = le nombre de fois ou on repete les deux ondes****/


/***on va cherché les données****/

FILE* abadiebase = NULL;
FILE* joris = NULL;
abadiebase = fopen("1.txt", "r");

	if (abadiebase != NULL)
	{

melangeCetCpp = fscanf(abadiebase,"%d %d %d %d %d %d %d %d", &durer1monte, &durer2monte, &durer3monte, &durer4monte, &durer5monte, &durer6monte, &durer7monte, &durer8monte);
if (melangeCetCpp == EOF)



fclose(abadiebase), abadiebase = NULL;;
}

FILE* abadiebase1 = NULL;
abadiebase1 = fopen("2.txt", "r");

	if (abadiebase1 != NULL)
	{

melangeCetCpp1 = fscanf(abadiebase1,"%d %d %d %d %d %d %d %d", &volume1monte, &volume2monte, &volume3monte, &volume4monte, &volume5monte, &volume6monte, &volume7monte, &volume8monte);
if (melangeCetCpp1 == EOF)


fclose(abadiebase1), abadiebase1 = NULL;;
}


FILE* abadiebase2 = NULL;
abadiebase2 = fopen("4.txt", "r");

	if (abadiebase2 != NULL)
	{

melangeCetCpp2 = fscanf(abadiebase2,"%d %d %d %d %d %d %d %d", &modif1d, &modif2d, &modif3d, &modif4d, &modif5d, &modif6d, &modif7d, &modif8d);
if (melangeCetCpp2 == EOF)



fclose(abadiebase2), abadiebase2 = NULL;;
}


FILE* abadiebase3 = NULL;
abadiebase3 = fopen("5.txt", "r");

	if (abadiebase3 != NULL)
	{

melangeCetCpp3 = fscanf(abadiebase3,"%d %d %d %d %d %d %d %d", &modif1rd, &modif2rd, &modif3rd, &modif4rd, &modif5rd, &modif6rd, &modif7rd, &modif8rd);
if (melangeCetCpp3 == EOF)


fclose(abadiebase3), abadiebase3 = NULL;;
}


FILE* abadiebase4 = NULL;
abadiebase4 = fopen("6.txt", "r");

	if (abadiebase4 != NULL)
	{

melangeCetCpp4 = fscanf(abadiebase4,"%d %d %d %d %d %d %d %d", &modif1v, &modif2v, &modif3v, &modif4v, &modif5v, &modif6v, &modif7v, &modif8v);
if (melangeCetCpp4 == EOF)


fclose(abadiebase4), abadiebase4 = NULL;;
}


FILE* abadiebase5 = NULL;
abadiebase5 = fopen("7.txt", "r");

	if (abadiebase5 != NULL)
	{

melangeCetCpp5 = fscanf(abadiebase5,"%d %d %d %d %d %d %d %d", &modif1rv, &modif2rv, &modif3rv, &modif4rv, &modif5rv, &modif6rv, &modif7rv, &modif8rv);
if (melangeCetCpp5 == EOF)

fclose(abadiebase5), abadiebase5 = NULL;;
}

FILE* abadiebase6 = NULL;
abadiebase6 = fopen("3.txt", "r");

	if (abadiebase6 != NULL)
	{
melangeCetCpp6 = fscanf(abadiebase6,"%d %d %d", &temps, &tempsinv, &tempsinv1);
if (melangeCetCpp6 == EOF)

fclose(abadiebase6), abadiebase6 = NULL;;
}

FILE* abadiebase7 = NULL;
abadiebase7 = fopen("8.txt", "r");

	if (abadiebase7 != NULL)
	{

melangeCetCpp7 = fscanf(abadiebase7,"%d %d %d %d %d %d %d %d", &forme1, &forme2, &forme3, &forme4, &forme5, &forme6, &forme7, &forme8);
if (melangeCetCpp7 == EOF)

fclose(abadiebase7), abadiebase7 = NULL;;
}


boucle = 1;



int amplitude = 32768;


joris = fopen(ceccicorsica, "w");
if (joris != NULL)
{
/**mise de la membrane au repos***/
fprintf(joris, "%d 1 63\n", amplitude);

int ditlui1d, ditlui2d, ditlui3d, ditlui4d, ditlui5d, ditlui6d, ditlui7d, ditlui8d;
int ditlui1v, ditlui2v, ditlui3v, ditlui4v, ditlui5v, ditlui6v, ditlui7v, ditlui8v;



ditlui1d = durer1monte;
ditlui2d = durer2monte;
ditlui3d = durer3monte;
ditlui4d = durer4monte;
ditlui5d = durer5monte;
ditlui6d = durer6monte;
ditlui7d = durer7monte;
ditlui8d = durer8monte;

ditlui1v = volume1monte;
ditlui2v = volume2monte;
ditlui3v = volume3monte;
ditlui4v = volume4monte;
ditlui5v = volume5monte;
ditlui6v = volume6monte;
ditlui7v = volume7monte;
ditlui8v = volume8monte;

int pond1amplitude, pond2amplitude, pond3amplitude, pond4amplitude, pond5amplitude, pond6amplitude, pond7amplitude, pond8amplitude;



ditlui1d = ditlui1d;
ditlui2d = ditlui2d;
ditlui3d = ditlui3d;
ditlui4d = ditlui4d;
ditlui5d = ditlui5d;
ditlui6d = ditlui6d;
ditlui7d = ditlui7d;
ditlui8d = ditlui8d;

ditlui1v = ditlui1v;
ditlui2v = ditlui2v;
ditlui3v = ditlui3v;
ditlui4v = ditlui4v;
ditlui5v = ditlui5v;
ditlui6v = ditlui6v;
ditlui7v = ditlui7v;
ditlui8v = ditlui8v;


pond1amplitude = fonctionImagineVoixreponsefonction1(ditlui1v);
pond2amplitude = fonctionImagineVoixreponsefonction2(ditlui2v);
pond3amplitude = fonctionImagineVoixreponsefonction1(ditlui3v);
pond4amplitude = fonctionImagineVoixreponsefonction2(ditlui4v);
pond5amplitude = fonctionImagineVoixreponsefonction1(ditlui5v);
pond6amplitude = fonctionImagineVoixreponsefonction2(ditlui6v);
pond7amplitude = fonctionImagineVoixreponsefonction1(ditlui7v);
pond8amplitude = fonctionImagineVoixreponsefonction2(ditlui8v);


fprintf(joris, "%d %d %d\n", (int)pond1amplitude, ditlui1d, forme1);
fprintf(joris, "%d %d %d\n", (int)pond2amplitude, ditlui2d, forme2);
fprintf(joris, "%d %d %d\n", (int)pond3amplitude, ditlui3d, forme3);
fprintf(joris, "%d %d %d\n", (int)pond4amplitude, ditlui4d, forme4);
fprintf(joris, "%d %d %d\n", (int)pond5amplitude, ditlui5d, forme5);
fprintf(joris, "%d %d %d\n", (int)pond6amplitude, ditlui6d, forme6);
fprintf(joris, "%d %d %d\n", (int)pond7amplitude, ditlui7d, forme7);
fprintf(joris, "%d %d %d\n", (int)pond8amplitude, ditlui8d, forme8);




boucle=1;
for (boucle=1; boucle < temps; boucle++) {


boucle1=1;
for (boucle1=1; boucle1 < tempsinv; boucle1++) {

 
ditlui1d = ditlui1d + modif1d;
ditlui1d = ((ditlui1d > 400) ? 400 : ditlui1d ); 
ditlui2d = ditlui2d + modif2d;
ditlui2d = ((ditlui2d > 400) ? 400 : ditlui2d);
ditlui3d = ditlui3d + modif3d;
ditlui3d = ((ditlui3d > 400) ? 400 : ditlui3d);
ditlui4d = ditlui4d + modif4d;
ditlui4d = ((ditlui4d > 400) ? 400 : ditlui4d);
ditlui5d = ditlui5d + modif5d;
ditlui5d = ((ditlui5d > 400) ? 400 : ditlui5d);
ditlui6d = ditlui6d + modif6d;
ditlui6d = ((ditlui6d > 400) ? 400 : ditlui6d);
ditlui7d = ditlui7d + modif7d;
ditlui7d = ((ditlui7d > 400) ? 400 : ditlui7d);
ditlui8d = ditlui8d + modif8d;
ditlui8d = ((ditlui8d > 400) ? 400 : ditlui8d);

ditlui1v = ditlui1v + modif1v;
ditlui1v = ((ditlui1v > 65000) ? 65000 : ditlui1v);
ditlui2v = ditlui2v + modif2v;
ditlui2v = ((ditlui2v > 65000) ? 65000 : ditlui2v);
ditlui3v = ditlui3v + modif3v;
ditlui3v = ((ditlui3v > 65000) ? 65000 : ditlui3v);
ditlui4v = ditlui4v + modif4v;
ditlui4v = ((ditlui4v > 65000) ? 65000 : ditlui4v);
ditlui5v = ditlui5v + modif5v;
ditlui5v = ((ditlui5v > 65000) ? 65000 : ditlui5v);
ditlui6v = ditlui6v + modif6v;
ditlui6v = ((ditlui6v > 65000) ? 65000 : ditlui6v);
ditlui7v = ditlui7v + modif7v;
ditlui7v = ((ditlui7v > 65000) ? 65000 : ditlui7v);
ditlui8v = ditlui8v + modif8v;
ditlui8v = ((ditlui8v > 65000) ? 65000 : ditlui8v);




pond1amplitude = fonctionImagineVoixreponsefonction1(ditlui1v);
pond2amplitude = fonctionImagineVoixreponsefonction2(ditlui2v);
pond3amplitude = fonctionImagineVoixreponsefonction1(ditlui3v);
pond4amplitude = fonctionImagineVoixreponsefonction2(ditlui4v);
pond5amplitude = fonctionImagineVoixreponsefonction1(ditlui5v);
pond6amplitude = fonctionImagineVoixreponsefonction2(ditlui6v);
pond7amplitude = fonctionImagineVoixreponsefonction1(ditlui7v);
pond8amplitude = fonctionImagineVoixreponsefonction2(ditlui8v);


fprintf(joris, "%d %d %d\n", (int)pond1amplitude, ditlui1d, forme1);
fprintf(joris, "%d %d %d\n", (int)pond2amplitude, ditlui2d, forme2);
fprintf(joris, "%d %d %d\n", (int)pond3amplitude, ditlui3d, forme3);
fprintf(joris, "%d %d %d\n", (int)pond4amplitude, ditlui4d, forme4);
fprintf(joris, "%d %d %d\n", (int)pond5amplitude, ditlui5d, forme5);
fprintf(joris, "%d %d %d\n", (int)pond6amplitude, ditlui6d, forme6);
fprintf(joris, "%d %d %d\n", (int)pond7amplitude, ditlui7d, forme7);
fprintf(joris, "%d %d %d\n", (int)pond8amplitude, ditlui8d, forme8);

 
}


boucle1=1;
for (boucle1=1; boucle1 < tempsinv1; boucle1++) {

 

ditlui1d = ditlui1d - modif1rd;
ditlui1d = ((ditlui1d < 2) ? 2 : ditlui1d); 
ditlui2d = ditlui2d - modif2rd;
ditlui2d = ((ditlui2d < 2) ? 2 : ditlui2d); 
ditlui3d = ditlui3d - modif3rd;
ditlui3d = ((ditlui3d < 2) ? 2 : ditlui3d); 
ditlui4d = ditlui4d - modif4rd;
ditlui4d = ((ditlui4d < 2) ? 2 : ditlui4d); 
ditlui5d = ditlui5d - modif5rd;
ditlui5d = ((ditlui5d < 2) ? 2 : ditlui5d); 
ditlui6d = ditlui6d - modif6rd;
ditlui6d = ((ditlui6d < 2) ? 2 : ditlui6d); 
ditlui7d = ditlui7d - modif7rd;
ditlui7d = ((ditlui7d < 2) ? 2 : ditlui7d); 
ditlui8d = ditlui8d - modif8rd;
ditlui8d = ((ditlui8d < 2) ? 2 : ditlui8d); 

ditlui1v = ditlui1v - modif1rv;
ditlui1v = ((ditlui1v < 2) ? 2 : ditlui1v); 
ditlui2v = ditlui2v - modif2rv;
ditlui2v = ((ditlui2v < 2) ? 2 : ditlui2v);
ditlui3v = ditlui3v - modif3rv;
ditlui3v = ((ditlui3v < 2) ? 2 : ditlui3v);
ditlui4v = ditlui4v - modif4rv;
ditlui4v = ((ditlui4v < 2) ? 2 : ditlui4v);
ditlui5v = ditlui5v - modif5rv;
ditlui5v = ((ditlui5v < 2) ? 2 : ditlui5v); 
ditlui6v = ditlui6v - modif6rv;
ditlui6v = ((ditlui6v < 2) ? 2 : ditlui6v);
ditlui7v = ditlui7v - modif7rv;
ditlui7v = ((ditlui7v < 2) ? 2 : ditlui7v);
ditlui8v = ditlui8v - modif8rv;
ditlui8v = ((ditlui8v < 2) ? 2 : ditlui8v);



pond1amplitude = fonctionImagineVoixreponsefonction1(ditlui1v);
pond2amplitude = fonctionImagineVoixreponsefonction2(ditlui2v);
pond3amplitude = fonctionImagineVoixreponsefonction1(ditlui3v);
pond4amplitude = fonctionImagineVoixreponsefonction2(ditlui4v);
pond5amplitude = fonctionImagineVoixreponsefonction1(ditlui5v);
pond6amplitude = fonctionImagineVoixreponsefonction2(ditlui6v);
pond7amplitude = fonctionImagineVoixreponsefonction1(ditlui7v);
pond8amplitude = fonctionImagineVoixreponsefonction2(ditlui8v);


fprintf(joris, "%d %d %d\n", (int)pond1amplitude, ditlui1d, forme1);
fprintf(joris, "%d %d %d\n", (int)pond2amplitude, ditlui2d, forme2);
fprintf(joris, "%d %d %d\n", (int)pond3amplitude, ditlui3d, forme3);
fprintf(joris, "%d %d %d\n", (int)pond4amplitude, ditlui4d, forme4);
fprintf(joris, "%d %d %d\n", (int)pond5amplitude, ditlui5d, forme5);
fprintf(joris, "%d %d %d\n", (int)pond6amplitude, ditlui6d, forme6);
fprintf(joris, "%d %d %d\n", (int)pond7amplitude, ditlui7d, forme7);
fprintf(joris, "%d %d %d\n", (int)pond8amplitude, ditlui8d, forme8);

 
}


}

/**remise de la membrane au repos***/
fprintf(joris, "%d 1 63\n", amplitude);


fclose(joris), joris = NULL;;
}



return 0;
}




#define totajo 256


int fonctionPasserelle (int argc, char *argv[])

{

FonctionEntete(argc, argv);

int un;

  FILE* debutwav = NULL;
    FILE* vachercherentete = NULL;
  debutwav = fopen(efface, "wb+");
  vachercherentete = fopen(a25joris, "rb");


  if (debutwav != NULL)
  {
        if (vachercherentete != NULL)
  {

 un = fgetc(vachercherentete); /* abadie vient chercher tout ce qui bouge*/
while (un != EOF)

{
  		fwrite( &un, sizeof(unsigned char), 1, debutwav);
    un = fgetc(vachercherentete);
}
        fclose(vachercherentete), vachercherentete = NULL;;
  }
    fclose(debutwav), debutwav = NULL;;
  }



  /*j ouvre mon fichier de donner*/
  FILE* jojo = NULL;
  jojo = fopen(cecci, "rb");

  if (jojo != NULL)
  {

    int assemble = 0;
    int ludion = 0;
    int enclanche = 0;
    int nbdepoints, bascule;
    int amplitude;
    double codebash;



    char tab[totajo] =
    {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F,0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF,0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF,0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF,0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F,0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F,0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F,0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,
0x4B,0x4C,0x4D,0x4E,0x4F,0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F,0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F,0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F};

    char *ptr;
    char *petr;
    double jo;
    int sens;
    int sansdimension;
    FILE* script = NULL;

    script = fopen(efface, "ab"); /* pour ajouter a. possible w ou r+ w+ tester */

    if (script != NULL)
    {


      /***valeur possible jo****/

      while ( fscanf(jojo,"%d %d %d", &amplitude, &nbdepoints, &sansdimension) !=EOF )
      {


/*************************************/

        float joie;
	joie = (float)nbdepoints;
        float forme;
	forme = (float)sansdimension;


	/*bon pour variation de d'amplitude 10000*/
		/*en ecemple 32768 a 42768*/
		/*jo = (joie * (1-exp(-joie/(joie * 6.5535))));*/

jo = (joie * forme * (0.01));

	if (ludion > amplitude)
	  sens = 2;
	else
	  sens = 1;

	/***fin conversion***/
	if(sens == 2)
	{
	  if ( nbdepoints < 2)
	  {


/*

	  codebashbrute = (int)(amplitude);


	    codebash = ((2 * codebashbrute) + codebashavant1 + codebashavant2) * 0.25;


*/

	    codebash = (int)(amplitude);


	    int ji;
	    int ij;
	    int ola;
	    ola = (int)codebash;

	    /*ji = ola%256;*/
	    ij = (int)(ola*0.00390625);
	    ji = ola - (256*ij);

	    ptr = &tab[ji];
	    petr = &tab[ij];


	    fwrite( ptr, sizeof(unsigned char), 1, script);
	    fwrite( petr, sizeof(unsigned char), 1, script);


	  }



	  else
	  {


	    float ote, ote1;

	    int boucle;
	    int bouclecomp;
	    boucle = nbdepoints * 0.5;
	    bouclecomp = nbdepoints - boucle;
	    if ( boucle == 0)
	    {
	      boucle = 1;
	    }


	    ote = ( ludion - amplitude) * 0.5;



	    while ( boucle > 0)
	    {
float jj;

jj = ((-boucle)/jo);

		ote1 = ote * ( exp(jj));




codebash = (int)(ludion - ote1);

	      int ji;
	      int ij;
	      int ola;
	      ola = (int)codebash;

	      /*ji = ola%256;*/
	      ij = (int)(ola*0.00390625);
	      ji = ola - (256*ij);

	      ptr = &tab[ji];
	      petr = &tab[ij];


	      fwrite( ptr, sizeof(unsigned char), 1, script);
	      fwrite( petr, sizeof(unsigned char), 1, script);

	      bascule = codebash;


	      /*fin modif*/
	      boucle--;

	    }

	    enclanche = 1;
	    /* debut descente inverse du sens 1 */
	    if (enclanche == 1)
	    {
	      float ote, ote1;
	      int boucle, boncompte;
	      boucle = 1;

	      ote = ( ludion - amplitude) * 0.5;
	      boncompte = bouclecomp + 1;
	      if (boncompte == 0)
	      {
		boncompte = 1;
	      }


	      while (boucle < (boncompte))
	      {

float jj;
jj = ((-boucle)/jo);
ote1 = ote * ( exp(jj));

/*

	  codebashbrute = (int) (amplitude + ote1);


	    codebash = ((2 * codebashbrute) + codebashavant1 + codebashavant2) * 0.25;

*/
	    codebash =  (int) (amplitude + ote1);

		int ji;
		int ij;
		int ola;
		ola = (int)codebash;

		/*ji = ola%256;*/
		ij = (int)(ola*0.00390625);
		ji = ola - (256*ij);


		ptr = &tab[ji];
		petr = &tab[ij];

		fwrite( ptr, sizeof(unsigned char), 1, script);
		fwrite( petr, sizeof(unsigned char), 1, script);


		/*fin modif*/
		boucle++;
	      }


	      enclanche = 0;

	    }

	  }

	}

	/*en attente*/
	/**********/

	if(sens == 1)
	{
	  if ( nbdepoints < 2)
	  {
	    codebash = (int)(amplitude);

	    int ji;
	    int ij;
	    int ola;
	    ola = (int)codebash;

	    /*ji = ola%256;*/
	    ij = (int)(ola*0.00390625);
	    ji = ola - (256*ij);

	    ptr = &tab[ji];
	    petr = &tab[ij];


	    fwrite( ptr, sizeof(unsigned char), 1, script);
	    fwrite( petr, sizeof(unsigned char), 1, script);

	  }


	  else
	  {


	    float ote, ote1;
	    int boucle;
	    int bouclecomp;
	    boucle = nbdepoints * 0.5;
	    bouclecomp = nbdepoints - boucle;
	    if ( boucle == 0)
	    {
	      boucle = 1;
	    }


	    ote = ( amplitude - ludion ) * 0.5;



	    while ( boucle > 0 )
	    {
float jj;
jj = ((-boucle)/jo);
ote1 = ote * (exp(jj));


/*

	  codebashbrute = (int) (ludion + ote1);


	    codebash = ((2 * codebashbrute) + codebashavant1 + codebashavant2) * 0.25;

*/

	    codebash = (int) (ludion + ote1);


	      int ji;
	      int ij;
	      int ola;
	      ola = (int)codebash;

	      /*ji = ola%256;*/
	      ij = (int)(ola*0.00390625);
	      ji = ola - (256*ij);

	      ptr = &tab[ji];
	      petr = &tab[ij];


	      fwrite( ptr, sizeof(unsigned char), 1, script);
	      fwrite( petr, sizeof(unsigned char), 1, script);

	      bascule = codebash;


	      /*fin modif*/
	      boucle--;

	    }

	    enclanche = 1;
	    /* debut descente inverse du sens 1 */
	    if (enclanche == 1)
	    {
	      float ote, ote1;
	      int boucle, boncompte;
	      boucle = 1;

	      ote = ( amplitude - ludion ) * 0.5;
	      boncompte = bouclecomp + 1;
	      if (boncompte == 0)
	      {
		boncompte = 1;
	      }


	      while (boucle < (boncompte))
	      {

float jj;
jj = ((-boucle)/jo);
ote1 = ote * ( exp(jj));

/*

	  codebashbrute = (int) (amplitude - ote1);


	    codebash = ((2 * codebashbrute) + codebashavant1 + codebashavant2) * 0.25;

*/

codebash = (int) (amplitude - ote1);

		int ji;
		int ij;
		int ola;
		ola = (int)codebash;

		/*ji = ola%256;*/
		ij = (int)(ola*0.00390625);
		ji = ola - (256*ij);

		ptr = &tab[ji];
		petr = &tab[ij];

		fwrite( ptr, sizeof(unsigned char), 1, script);
		fwrite( petr, sizeof(unsigned char), 1, script);


		/*fin modif*/
		boucle++;
	      }


	      enclanche = 0;

	    }

	  }

	}


	/* fin*/
	/********/
	/*****/
	ludion = amplitude;
			assemble = 0;


				}

       /***fin assemble***/

      fclose(script), script = NULL;;
      }

    fclose(jojo), jojo = NULL;;

    }



    return 0;
  }



/**************fin passerelle***********************************************************************/




int main ( int argc, char** argv )
{
			fonctionImagineVoix4 (argc, argv);
		  fonctionPasserelle (argc, argv);

    return 0;
}