Click here to Skip to main content
15,896,444 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have this program:

Text To Speech For Windows[^]


The program orders Windows to speak text in clipboard when Ctrl+C is pressed twice fast.

The simple source code is in my Google site.

Every time it speaks a new sentence it adds around 3 MB of RAM for the program, reaching 521 MB this once, how can I release the resources (dispose them) and forget every spoken sentence, the spoken sentence is no longer needed after speaking it or stopping it in the middle.

It's like it's remembering something and adding it to RAM every time a sentence is spoken and that shouldn't be the case, in the past when using SPVoice, I think this didn't happen.

What I have tried:

public void speak1Text(string s)
        {

            s = prepareTextForSpeech(s);

            SS.SpeakAsyncCancelAll();
            SS = new SpeechSynthesizer();
            SS.SetOutputToDefaultAudioDevice();
            SS.SelectVoice(SS.GetInstalledVoices()[comboBoxVoice.SelectedIndex].VoiceInfo.Name);
            SS.Rate = trackBarRate.Value;
            SS.Volume = trackBarVolume.Value;

            SS.SpeakAsyncCancelAll();
            SS.SpeakAsync(s);
        }
Posted
Updated 22-Jul-17 3:42am

1 solution

I changed it to SPvoice and it seems to work well now, I will try it for some time, I read that Microsoft are aware of the problem but work on more common problems...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900