Welcome to Synthiam!

Program robots using technologies created from industry experts. ARC is our free-to-use robot programming software that makes features like vision recognition, navigation and artificial intelligence easy.

Get Started
Asked — Edited

Let Roli Say Specified Words Through Ez-B V4's Speakers

Hi , I am programming roli in c#. I want roli speak specified words through the EZB4 soundboard. How can I do that? I used EZ_B.­Speakjet.­Speak­String(EZ_B.­Digital.­Digital­Port­Enum, ­System.­String), but no sound.

AI Support Bot
Related Content
Synthiam
PRO
Synthiam
#1  
Speakjet is a third party microchip that can connect to an ez-b for synthesized sound. What you want is to do one of these two things...

Code:


ezb.SoundV4.PlayData(ezb.SpeechSynth.SayToStream("Hello, i am speaking in the background thread."));

ezb.SoundV4.PlayDataWait(ezb.SpeechSynth.SayToStream("Hello, i am speaking in the current thread and blocking until completed."));
#2  
@DJ Sures

Hello dear eng ,
I use this part of code to make my jd robot speak but it gave me that exception
User-inserted image



would you help me plz?

all i need is to make my jd speak a string I gave to it in vs
#3  
you would have to provide your code to see where the null reference exception is happening. Can you run in debug mode to see where the break happens?
#4  
@CochranRobotics

thanks for the fast replaying here is the complete snapshot of my error
User-inserted image


I've made a plugin with one button say , when I click on that button , the jd robot will say what i right in the string but it gave me that exception
#5  
Can you show your references? The message would appear to indicate that the ezb or one of its classes isn't present. You might want to download the latest version of ARC if you haven't to make sure that the classes are present. I am in meetings pretty much all day but will try to duplicate the error when I have time.

Make sure that ARC and EZ_B are both referenced. It looks like you are trying to build a plugin using the SDK but I might be wrong. I promise that I will try this out and let you know the results if nobody else gets back to you.
#6  
@CochranRobotics

my references was given below & I'm sure they are right
User-inserted image


also my ARC version is 30.5 which is the latest version & to check that I'm right if u have the sdk tutorial open c# then choose tutorial 61
& run it it will run but if u put this line of code the program will not work .
#7  
Sounds good. I will look at it and see if I can offer any help. Thanks for the info. I will get back to you.
#8  
I think that you have to have a connection to the EZ-B V4 before this will work. Does your other code establish a connection to an EZ-B first?
#9  

Code:


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace testingplugin
{
public partial class Main : EZ_Builder.UCForms.FormPluginMaster
{
public EZ_B.EZB ezb;

public Main()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
ezb = new EZ_B.EZB();
ezb.Connect("192.168.100.112:23");
ezb.SoundV4.PlayData(ezb.SpeechSynth.SayToStream("This is a test"));
}
}
}
PRO
USA
#10  
@shaimaabes,

NullReference Exception is very clear, basically you have a NULL object e.g. instance and you try to call or reference a method on it.

looking to the picture:

the class field ezb is not created neither is pointing to a valid reference.

you have two options:

1) Do it like David mention in the above post, basically you create an EZB instance, connect and you hold it like in a standalone application (remember the other example)

2) You are building an ARC.plugin, you have access to the ARC.singleton class EZBManager inside this class you have an array of 5 EZBs representing the same 5 EZBs available in the ARC.Connection Control.

the 5 ezbs exists even if they are not connected.

Code:


EZ_Builder.EZBManager.EZBs[0].SoundV4.PlayData( ... );


if you prefer you can keep a reference and use the reference:

Code:


this.ezb = EZ_Builder.EZBManager.EZBs[0];
...

this.ezb.SoundV4.PlayData(this.ezb.SpeechSynth.SayToStream("This is a test"));


you can also connect the ezb instance, although i think is not possible to obtain the IP/Address specified in the Connection Box's TextBox

but if you are successful the ARC.Connection Box's Button will turn blue.

if you are building a ARC.plugin you should use the ARC.EZManager to keep the actions in sync with ARC.

Otherwise you will have 2 or more TCP connections to the EZB Controller.
#11  
I wouldn't do it like I mentioned, just providing an example showing that the connection has to be established and that the instance of the object has to be established before it's used. More than anything, just showing real quickly that it needs to be setup before it can be used.
PRO
USA
#12  
@David,

"There's more than one way to skin a cat.", your code works plugin or not.

To be honest i had the idea that only one EZB could be connected (TCP) to the controller, but, it's possible to have 2 or more TCP connections and sending commands.

Although is not possible the EZB use the same TCP channel to initiate a communication and send data (async results), i'm making this deduction based in the WIFI firmare code.

ASFAIK all the EZB controller commands are (sync) initiated from the Host to the controller.
PRO
Synthiam
#13  
Yeah I'll confirm that this approach contradicts the fantastic and in depth plugin tutorial. Never connect to the ezb in a plugin - there's no reason. Also, you can only have one connection to the ezb at a time.

Original poster, please follow the tutorial that was created to avoid these circumstances.:)

If you want access to speaker, use the EZBManager.EZBs[0].....
#14  
I agree totally. The example was to show why the null reference exception was happening. He was trying to use the object before it was created as it was never created. Also there was some confusion as to if they were making a plugin or if they were making something with the C# SDK. I am of the opinion that they were making something from the C# SDK due to the category and reference to tutorial 61. The confusing thing comes in with the way that the form is inheriting from UCForms.PluginMaster. Not sure still which they are trying to do, but maybe they will come back on and clarify.
#15  
Oh, I see now...
The original poster wasn't the same person who asked the question today.

It would probably be best to start a new thread with the correct category so that it doesn't confuse those who are trying to help.

All good...
#16  
@CochranRobotics

thanks for ur help:) it's working:D
nw I could here my jd <3 thanks alot
#17  
@ptp
thanks for being always here , replying on my questions:)