Notifications
Clear all

eSpeak on a Raspberry Pi 4

116 Posts
9 Users
30 Likes
20.8 K Views
frogandtoad
(@frogandtoad)
Member
Joined: 5 years ago
Posts: 1458
 

@robo-pi

Um... all I do is defend the native language that the designers of Arduino intended for us to use, that which being C++!  I also advocate the us of classes, and have no issue with you implementing them in your python examples either!

So why exactly are you tainting me in your reply as a bickerer?
I am simply defending the platform, and the language of choice that was intended to be used with it!

I agree with the remainder of your comments to @byron.

 


   
ReplyQuote
codecage
(@codecage)
Member Admin
Joined: 5 years ago
Posts: 1038
 

@robo-pi

I don't know about others but I'm enjoying the heck out of your "terrible" videos.  Thanks for these videos, it is going to save me multiple years of my life! 😎 

SteveG


   
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
Topic starter  
Posted by: @frogandtoad

I am simply defending the platform, and the language of choice that was intended to be used with it!

There's no need to defend the Arduino platform as it stands on its own strength.  The fact that others love it so much that they bother to write other languages for it only serves to verify its superiority as a microcontroller platform.

If someone wants to use Python instead of C++ let them do it.  If they can get away with it what's the problem?  Depending on the application Python might actually be the better choice in certain situations.  Let's not forget that technology is advancing rapidly with the advent of IoT.   If someone wants to use Python to interface with their thing on the Internet why complain that they aren't using C++?

Perhaps Python is all they know and they don't want to have to bother to learn C++. 

In the end, all computer languages ultimately get interpreted or compiled into machine instructions suitable for the CPU or MPU of the device anyway.  Because of this one could argue that assembly  language is the only way to go.  But it's clearly not.  And why not?  Because other languages like C++ and Python have built-in functions, methods, and/or libraries that have already been coded to do lower level tasks.

In fact, Python typically has many modules that are already written in C++.   So people who program using Python are actually using C++ without even realizing it.

In the end, the best way to choose a computer language is to choose the one that the team you are working with uses. 😊   And if you are working on your own, then you are free to do whatever you want.

One thing we have to admit about Python is that it is extremely easy to use.  And why is that?  Because that was the goal of the people who designed it.  C++ is not easy to use, nor is it easy to learn. That's just a fact of reality.  So it makes sense that many people are going to view Python as being "easier", because it is.  Python is a "higher level" language than C++.   Simply meaning that it's closer to the way humans think than the way CPU instructions work.

In the automotive world I prefer to drive a stick shift.  But many other people prefer an automatic transmission because it's "easier".   I'm not going to argue that everyone else should be driving a stick shift.   But I will continue to drive one myself.  I simply prefer it.  I have more control with a stick shift, and that's just a fact.  That's never going to change no matter how many people drive automatics.  One could argue that this is a similar difference between C++ and Python.  Python is more like driving an automatic, while C++ is more like driving a stick shift.  They both get you where you want to go in the end so why bother trying to defend one over the other?  It's a matter of personal preference right?

 

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
Topic starter  
Posted by: @codecage

@robo-pi

I don't know about others but I'm enjoying the heck out of your "terrible" videos.  Thanks for these videos, it is going to save me multiple years of my life! 😎 

I'm working on a new video: eSpeak (Part 5): Alysha Adds Words to Dictionary

I've written a small Python program to have Alysha ask me for a new word.  I have to type the new word in for now since I don't have the SRE up and running in Python yet.  But Alysha then tells me what word I entered and asks me if I would like her to add it to the dictionary.

If I reply with a 'y' she will then add the new word into the dictionary list file along with its phonemes and then recompile the ai_dict herself.

So now I have Alysha adding words to the dictionary basically on her own.  Well, almost.  I actually give her the new words and approve having her add them to the dictionary.  But she's now in a position to be doing this on her own.

The program is extremely short and sweet.   However, there were some little quirky things that had to be done.  First I had to change the filesClass to insure the UTF-8 coding when both reading and writing to the dictionary list file.  Secondly, I had to make sure that the ai_list and ai_rules files were in the same directory with the Python program.  Because, if you remember, you need to be in the current directory with those files when compiling. 

In any case, it's pretty slick.  I'm actually a bit surprised how easy this was to do.  So now I no longer need to add words to the dictionary manually, but instead I have Alysha adding the words and their phonemes to her own dictionary via Python.

Yep, this is going to be purfect for my Linguistic AI project.  I thought it would be. 😊 

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
byron
(@byron)
No Title
Joined: 5 years ago
Posts: 1123
 
Posted by: @robo-pi

Alysha Adds Words to Dictionary

Any more of this and you may even get me interested in AI 😀  When adding words as you describe, is this just when bot is put into a learning mode, or will this facility be on all the time.  I guess I should wait for your video.  I'll be interested to see what happens if you speak a sentence to Alysha.  Will you get a barrage of do you want to add to dictionary, how will a cough be interpreted etc. 

Anyway its all interesting stuff, but I know that I'm too busy right now to get into this apart from perusing the possibilities for future projects.  And for that reason I'm going to be a bit cheeky and ask if you have considered accompanying notes like dronebots does.  When coming to use, say, a stepper motor, and I remember a good dronebots video I often dont want to view a whole video again but prefer scan through the notes, which is especially handy for copying any code.

If you do consider doing accompanying notes probably this is not the time but maybe an over winter exercise.  Anyway just a thought (ok a bit oliver twist like 😀 ) and keep up the good work in this series of videos.  I know it must be a busy time for you if you are getting your vegie plot underway.  We just had a late frost which blackend the leaves for first early spuds. I should have listened more to the weather forecast.  Now I will have to plant some more... busy busy busy.


   
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
Topic starter  
Posted by: @byron

 I'll be interested to see what happens if you speak a sentence to Alysha.  Will you get a barrage of do you want to add to dictionary, how will a cough be interpreted etc. 

You're the programmer, so the program does whatever you told it to do.

There's no AI in anything I've done thus far, including this talking dictionary. 

Posted by: @byron

And for that reason I'm going to be a bit cheeky and ask if you have considered accompanying notes like dronebots does.

I might post some code on GitHub some day.  There's no money in this for me.  I'm just sharing what I'm doing on videos for fun, and because I like to help others who might be interested in this.   I'm just putting it out there as "food for thought".   The idea is to take whatever ideas work for you and run with them in your own designs.

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
byron
(@byron)
No Title
Joined: 5 years ago
Posts: 1123
 
Posted by: @robo-pi

I'm just putting it out there as "food for thought". 

The videos are certainly good eating 😀 and appreciated.


   
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
Topic starter  

This is a very simple program to have Python add words and phonemes to the dictionary and then compile the dictionary programmatically.  This is much better than having to do all this manually as we were doing it before.   There are still many options and features that can be added to this program.   For example I already have her adding words from entire sentences too.  But for this video I just stayed with adding one word at a time to introduce and explain the idea.

Here's the video:

I'm also working on moving my programs into a GUI environment instead of having to do everything using the Python IDE and terminal window.

DroneBot Workshop Robotics Engineer
James


   
codecage reacted
ReplyQuote
codecage
(@codecage)
Member Admin
Joined: 5 years ago
Posts: 1038
 

@robo-pi

Unable to load video.  It's telling me it is private.  ☹️ 

 

SteveG


   
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
Topic starter  
Posted by: @codecage

Unable to load video.  It's telling me it is private.  ☹️ 

Sorry about that.  It should work now, hopefully.  😊 

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
codecage
(@codecage)
Member Admin
Joined: 5 years ago
Posts: 1038
 

@robo-pi

You are right, it is working now!  Can't wait to dig in!

SteveG


   
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
Topic starter  

By the way, I probably should mention that this program is just to show that the dictionary can be modified programmatically.   This particular program is clearly not the most efficient way to add words to the dictionary as you can only add one word at a time and each time the computer is talking a lot.

However, now that you see how to add words to the dictionary using Python you should be able to easily modify this basic idea to add words from entire sentences, or even from entire text files, instantly.   Remember eSpeak can read from text files using the -f command.  We included the following method in the eSpeak class:

eSpeak.textFile(filename)

Just call that method to pass in the text file, and then modified the program to find the phonemes for each word it reads and add that word to the dictionary alone with its phonemes.

So it doesn't take much to have it do this.   In fact, I've already done it, but I only made the "cute" video where Alysha adds one word at a time and asked for your permission to add the word first.

So now we have a very quick and easy way to add a ton of words to our new dictionary list file.  We can then go over that list manually by hand if we want, using the eSpeak Edit program to modified any specific phomes to pronounce words to our liking.

This is just the tip of the iceberg for my AI project.  As it grow Alysha will obtain more capabilities and eventually she will be able to modify her own phonemes.  In fact, I plan on having her do this based on how I say the word to her using the Pocket Sphinx SRE.

So that's the next journey. 

Who wants instructional videos on Pocket Sphinx the speech recognizer?  Anybody?

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
codecage
(@codecage)
Member Admin
Joined: 5 years ago
Posts: 1038
 

@robo-pi

Still awesome work James.  Enjoyed it immensely!  And my wife got a kick out of the first word you had Aylesha add to her dictionary.  She said that I was now famous!  Not quite!! 😎 

SteveG


   
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
Topic starter  

Alysha's voice will improve over time.   Not on its own, but I have improvement strategies in works.  One way improve her voice is to go into the dictionary manually using eSpeak Edit and clean up the way she pronounces her words.   I've already done this to some small degree, but I can see where there's a lot of room for improvement yet.  And this is just by fiddling with the phonemes and flags in the dictionary list.

There's also the formants that can be played with for the voice too.

But I'm going to wait until the AI project gets underway.  I can have Alysha improve her own speech herself.

This is going to be a very interesting project as it unfolds over the following years.  Not only will she be improving her voice and the way she speaks, but she will also be learning the meanings of words, etc.   That's the part that's going to be truly interesting.

At this point, all I'm doing is setting up the basic TTS tool.

I also need to go over the SRE tool too.  And I'm about ready to move onto Pocket Sphinx here pretty soon.

After I get these two tools well-established in Python, I can then move forward to begin my actual Linguistic AI project. I'm really looking forward to starting in on that.

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
frogandtoad
(@frogandtoad)
Member
Joined: 5 years ago
Posts: 1458
 

@robo-pi

Posted by: @frogandtoad
Posted by: @frogandtoad

I am simply defending the platform, and the language of choice that was intended to be used with it!

There's no need to defend the Arduino platform as it stands on its own strength.  The fact that others love it so much that they bother to write other languages for it only serves to verify its superiority as a microcontroller platform.

True, but I didn't really express what I was trying to say properly.

The point I tried to get across was that I don't go to python forums and down play the need to use python classes when they're discussed, just because I may not like to use classes, or may not be competent enough to use them, let alone spruik that everyone should be checking out a different language, which may or not be a personal choice of mine.  95% of Bills video's involve Arduino, Arduino IDE and the C++ language, and trying to push people away from learning that (default) combination is what I am actually against, because they come here to learn about it in the first place.

As you already know from previous discussions, I'm not against any language, and I have previously stated that I use many different ones, and the right tool for the job.  I don't have an issue discussing the merits of one language over another, and that could be easily done in a separate post.

Posted by: @robo-pi

Perhaps Python is all they know and they don't want to have to bother to learn C++. 

I never said or implied anything otherwise, to assume that I did would make you very wrong.

If a beginner comes here with a python problem on their PI, I will try to help them with that if I can, and I won't try to tell them, oh wait... you should try this new fandango microC++!  it's better, it's faster, yadda, yadda... I'm sure even you can see the difference between supporting and spruiking.

Posted by: @robo-pi

They both get you where you want to go in the end so why bother trying to defend one over the other?  It's a matter of personal preference right?

Again... after many debates on this topic, you've misunderstood my view - I'm not trying to defend one language over the other here... I'm trying to defend against others downplaying the use of the exact same language features in one language (classes in this case), and appear not to have the same issue using them when it comes to another language, python in this case.


   
ReplyQuote
Page 6 / 8