Skip to content

Commit

Permalink
zz
Browse files Browse the repository at this point in the history
  • Loading branch information
lifeinapril committed Mar 15, 2023
1 parent 9256d0a commit c4a579f
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 15 deletions.
39 changes: 39 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
"aws-sdk": "^2.1333.0",
"axios": "^0.26.1",
"bootstrap": "5.1.3",
"fs": "^0.0.1-security",
"langdetect": "^0.2.1",
"mdb-react-ui-kit": "3.0.0",
"react": "^18.0.0",
"react-avatar": "4.0.0",
Expand Down
2 changes: 1 addition & 1 deletion src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,6 @@ body {
@media only screen and (max-width: 590px) {
.message_a,.message_b{
min-width: 100px !important;
max-width: 350px !important;
max-width: 290px !important;
}
}
22 changes: 21 additions & 1 deletion src/Maya.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ReactGA.initialize(TRACKING_ID);
const Maya = function(){
const [user , setUser ] = useState(null);
const [isLoading,setLoader] = useState(true);
const [settings,changeSettings] = useState({dark:true,mode:"text",speak:false,voice:110});//147
const [settings,changeSettings] = useState({dark:true,mode:"text",speak:false,voice:"Tessa"});//147
const [show , showSettings ] = useState(false);
const [chatid, setID] = useState();
const [ip, setIP] = useState(null);
Expand Down Expand Up @@ -73,6 +73,26 @@ var changeVoice=function(value){
CloseSettings();
localStorage.setItem("settings",settings);
}
// const detectedLanguage = "en"// detectLanguage.detect(input);
// switch (detectedLanguage) {
// case 'en':
// changeVoice('Google US English');
// break;
// case 'ko':
// changeVoice('Yuna');
// break;
// case 'zh':
// changeVoice('TingTing');
// break;
// case 'es':
// changeVoice('Paulina');
// break;
// case 'za':
// changeVoice('Tessa (en-ZA) [Default]');
// break;
// default:
// changeVoice('Google US English');
// }


useEffect(() => {
Expand Down
12 changes: 6 additions & 6 deletions src/components/Items/Settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,28 +64,28 @@ function Settings(props) {
</Form.Select>

<br/>
{props.speechMode && (
{/* {props.speechMode && (
<>
<Form.Label><small>Select Voice</small></Form.Label>
<Form.Select className={props.dark ? "bg-grey":"bg-light"} value={props.voiceMode} onChange={e => ChangeVoice(e.target.value)}>
{voices.map((voice, index) => (
<option key={index} value={index}>
{voice.name} ({voice.lang}) {voice.default && ' [Default]'}
<option key={index} value={voice.name}>
{voice.name} ({voice.lang})
</option>
))}
</Form.Select>
</>
)}
<br/>
<br/> */}


{/* <br/>
<br/>

{props.user && (
<ListGroup.Item as="li" onClick={Logout} className={"d-flex "+(props.dark ? "bg-dark":"bg-light")}>
<small className='red'><RiLogoutBoxFill/>&nbsp;&nbsp;&nbsp;Logout</small>
</ListGroup.Item>
)} */}
)}

</ListGroup>
</>
Expand Down
12 changes: 5 additions & 7 deletions src/components/Sections/ChatBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,12 @@ function ChatBox(props) {


function Speak(input) {
console.log("text to speech ......");
console.log(input);
const naturalVoice = window.speechSynthesis.getVoices();
const naturalVoice = window.speechSynthesis.getVoices().find((voice) => voice.name === props.voiceMode);
const utterance = new SpeechSynthesisUtterance(input);
utterance.voice = naturalVoice[props.voiceMode];
utterance.rate = 1; // Adjust the rate to make it sound more natural
utterance.pitch = 0.95; // Adjust the pitch to make it sound more human-like
utterance.volume=10;
utterance.voice = naturalVoice;
utterance.rate = 0.99; // Adjust the rate to make it sound more natural
utterance.pitch = 1; // Adjust the pitch to make it sound more human-like
utterance.volume=100;
window.speechSynthesis.speak(utterance);
}

Expand Down

0 comments on commit c4a579f

Please sign in to comment.