Skip to content

Commit

Permalink
GretaFurhatInterface For Readme
Browse files Browse the repository at this point in the history
No change in actual code, just formatting some blocks that belongs to GretaFurhatInterface
  • Loading branch information
Fousseyni-Sang committed Sep 26, 2024
1 parent d0b7c8f commit dcd69c8
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

/**
*
* @author sanga
* @author Fousseyni Sangaré 04/2024-09/2024
*/


Expand All @@ -44,11 +44,6 @@
*/



/**
*
* @author Admin
*/
public class GretaFurhatAUSender extends TextSender {

private HashMap<String,Object> metaDataMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

/**
*
* @author sanga
* @author Fousseyni Sangaré 04/2024-09/2024
*/
public class GretaFurhatAUSenderGUI extends javax.swing.JFrame implements ConnectionListener, AUPerformer {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

/**
*
* @author sanga
* @author Fousseyni Sangaré 04/2024-09/2024
*/

import java.util.HashMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

/**
*
* @author Admin
* @author Fousseyni Sangaré 04/2024-09/2024
*/
public class GretaFurhatRotationSender extends TextSender {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

/**
*
* @author sanga
* @author Fousseyni Sangaré 04/2024-09/2024
*/


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import java.util.Map;
/**
*
* @author Admin
* @author Fousseyni Sangaré 04/2024-09/2024
*/
public class GretaFurhatTextSender extends TextSender {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,19 @@ public abstract class MPEG4Agent extends Thread {
private Skeleton skeleton;
boolean visible;

/*===========================================================================================*/
/* This block is part of the Greta Furhat Interface
Author: Fousseyni Sangaré 04/2024-09/2024 */
/*===========================================================================================*/
String rotation; // This attribute is used for sending the greta rotation to furhat
// Create an instance of SocketServer
private GretaFurhatRotationSender server; // = new ActivemqGretaFurhatSender(61617);
//private Broker broker;
private int frameNumber;
/*===========================================================================================*/
/*===========================================================================================*/



public MPEG4Agent(String id, SceneNode parent) {
super("MPEG4Agent-" + id);
this.agentNode = createChildSceneNode(parent, id + "_agentNode");
Expand Down Expand Up @@ -114,22 +120,6 @@ public void update() {
if (mpeg4 != null) {
FAPFrame ff = mpeg4.getCurrentFAPFrame();
BAPFrame bf = mpeg4.getCurrentBAPFrame();
//System.out.println("### OgrePlayer ###: fap frame: " + ff + ", bap frame: " + bf + ", bap value: " + bf.getValue(57)+ " " + bf.getValue(58) + " " + bf.getValue(59) + ", bap Degree value: " + bf.getDegreeValue(57)+ " " + bf.getDegreeValue(58) + " " + bf.getDegreeValue(59));

// Send and receive messages
String rotation = bf.getDegreeValue(59) + " " + bf.getDegreeValue(57)+ " " + bf.getDegreeValue(58);
frameNumber = bf.getFrameNumber();
//System.out.println("### OgrePlayer ###: Rotation angle angle from Bap: "+ rotation);

//System.out.println("broker Connection: "+broker.isConnected() + " url: " + broker.getURL());
//System.out.println("Connection: "+server.isConnected() + " url: " + server.getURL());




//String receivedMessage = server.receiveMessage();

//server.stop();

applyFapFrame(ff);
if(bf.getMask(BAPType.HumanoidRoot_tr_lateral) ||
Expand Down Expand Up @@ -222,13 +212,17 @@ protected void updateHeadOrientation(Quaternion orientation){
}
protected void updateHeadOrientation(greta.core.util.math.Quaternion orientation){
mpeg4.getHeadNode().setOrientation(orientation);

/*==================================================================================================================================================*/
// This block is part of the Greta Furhat Interface
// Author: Fousseyni Sangaré 04/2024-09/2024
// These lines send the rotation angle to the activemq for the Furhat application
/*==================================================================================================================================================*/
// Author: Fousseyni Sangaré
// These lines send the rotation angle to the activemq for the Furhat application

String rotation = orientation.getEulerAngleXYZByAngle().x() + " " + orientation.getEulerAngleXYZByAngle().y()+ " " + orientation.getEulerAngleXYZByAngle().z() + " " + frameNumber;
server.send(rotation);
//System.out.println("orientation Euler angle: "+rotation+ " at frame: "+ frameNumber);

/*==================================================================================================================================================*/
/*==================================================================================================================================================*/
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,15 @@ public CereProcTTS(CharacterManager characterManager) {
setupCharacterLanguageVoiceParameters();
clean();
tmnumber = 0;

/*====================================================================================================*/
/* This block is part of the Greta Furhat Interface
Author: Fousseyni Sangaré 04/2024-09/2024 */
/*====================================================================================================*/
speechtextserver = new GretaFurhatSpeechTextSender("localhost", "61616", "greta.furhat.SpeechText");
audioserver = new GretaFurhatAudioSender("localhost", "61616", "greta.furhat.Audio");

/*====================================================================================================*/
/*====================================================================================================*/
}

/**
Expand Down Expand Up @@ -662,10 +668,13 @@ public void compute(boolean doTemporize, boolean doAudio, boolean doPhonems) {
audio = new Audio(audioFormatCereProc, rawAudioBuffer);


/* ==============================================================================================================
author: Fousseyni Sangaré
the following lines send the speech text and the audio over the activemq topic for furhat
*/
/*=================================================================================================================*/
/* This block is part of the Greta Furhat Interface
Author: Fousseyni Sangaré 04/2024-09/2024
the following lines send the speech text and the audio over the activemq topic for furhat */
/*=================================================================================================================*/


try{
System.out.println("Sending speech text over the topic");
audioserver.send(rawAudioBuffer, phonemes, speech.getSpeechElements(), audio);
Expand All @@ -679,8 +688,8 @@ public void compute(boolean doTemporize, boolean doAudio, boolean doPhonems) {
catch(Exception e){
System.err.println("Error when sending audiobuffer: "+e.getMessage());
}
/* ============================================================================================================== */

/*================================================================================================================= */
/*=================================================================================================================*/

/* DEBUG
rawAudioBuffer = new byte[(samples16bitNum) * 2];
Expand Down

0 comments on commit dcd69c8

Please sign in to comment.