flutter_tts icon indicating copy to clipboard operation
flutter_tts copied to clipboard

synthesizeToFile() is creating an empty audio file

Open AyeshaIftikhar opened this issue 3 years ago • 6 comments

💬 Questions and Help

Provide question related to this flutter plugin. I am working on an application in which user enters a script and then generate an audio file from that but the issue I am facing is synthesizeToFile() function is generating an empty audio file if the entered script is more than 1 lines. Also I am saving the generated audio file into firebase storage and the audio files are not getting played if it is generated successfully.

I have tried await _tts.awaitSpeakCompletion(true) but it also did not help.

AyeshaIftikhar avatar Mar 01 '22 13:03 AyeshaIftikhar

@AyeshaIftikhar does it work with await flutterTts.awaitSynthCompletion(true); ? I'm not sure what you mean by having a user enter a "script" and then generate an audio file from it.

dlutton avatar Mar 03 '22 23:03 dlutton

@AyeshaIftikhar does it work with await flutterTts.awaitSynthCompletion(true); ? I'm not sure what you mean by having a user enter a "script" and then generate an audio file from it.

I am doing this await and even though I haven't used flutterTts.speak() but still it utters the script in the background and that's why it is generating the empty audio file.

AyeshaIftikhar avatar Mar 04 '22 08:03 AyeshaIftikhar

@AyeshaIftikhar by "script" do you mean "text" that a user passed to the function? Can you provide an example showing the issue you're running into so I can try to replicate it?

dlutton avatar Mar 07 '22 20:03 dlutton

@dlutton I can't share the complete code because there are too much variable and steps included and the code is the property of the company I work for and they don't allow to share the code publicily but I can share the process. And the process is:

  • User creates the script by typing some test or selecting some of the options provided by the application.
  • Then they will generated the audio script.
  • Now the issue I am facing is that according to the documentation audio files being generated for android are with .wav extension. Firstly, the .wav files are not played by any of the audio playing packages. Second, As I have to save that generated audio file on Firebase Storage then I am facing the issue while creating the audio from text. I am not using speak() function but somehow it stills utters the text that are being generated but without speaking it out loud which isn't a problem for the text that is just a few words long but when the text is like one paragraph or so the the generated audio file is of 0 bytes in size which as we know is empty.

It will be very helpful if you can give me any kind of solution or suggestion for resolving this issue. Thanks.

AyeshaIftikhar avatar Mar 09 '22 05:03 AyeshaIftikhar

@AyeshaIftikhar is the issue with the length of the text you're passing into the method? Do you know how many characters are being passed in?

dlutton avatar Mar 09 '22 18:03 dlutton

@AyeshaIftikhar is the issue with the length of the text you're passing into the method? Do you know how many characters are being passed in?

I can't say it exactly but the text entered by the user can be of any length. I would say it can go up to 1000 to 10,000 characters in length.

AyeshaIftikhar avatar Mar 12 '22 06:03 AyeshaIftikhar

@AyeshaIftikhar is the issue with the length of the text you're passing into the method? Do you know how many characters are being passed in?

I can't say it exactly but the text entered by the user can be of any length. I would say it can go up to 1000 to 10,000 characters in length.

I have also this issue of creating empty file with zero size . have you solved it?

Amankhan-mobipixels avatar Nov 03 '22 04:11 Amankhan-mobipixels

@Amankhan-mobipixels is this occurring on iOS or Android or both? Also, what's the filename and extension you're giving it?

dlutton avatar Nov 03 '22 18:11 dlutton

@AyeshaIftikhar is the issue with the length of the text you're passing into the method? Do you know how many characters are being passed in?

I can't say it exactly but the text entered by the user can be of any length. I would say it can go up to 1000 to 10,000 characters in length.

I have also this issue of creating empty file with zero size . have you solved it?

It just don't work no matter what approach do you do. So I just switch to Azure Tts

AyeshaIftikhar avatar Nov 04 '22 09:11 AyeshaIftikhar

@AyeshaIftikhar is the issue with the length of the text you're passing into the method? Do you know how many characters are being passed in?

I can't say it exactly but the text entered by the user can be of any length. I would say it can go up to 1000 to 10,000 characters in length.

I have also this issue of creating empty file with zero size . have you solved it?

It just don't work no matter what approach do you do. So I just switch to Azure Tts

@AyeshaIftikhar is the issue with the length of the text you're passing into the method? Do you know how many characters are being passed in?

I can't say it exactly but the text entered by the user can be of any length. I would say it can go up to 1000 to 10,000 characters in length.

I have also this issue of creating empty file with zero size . have you solved it?

It just don't work no matter what approach do you do. So I just switch to Azure Tts

Its work fine now with tts after some changes in code thank you all of you for your reply and help

Amankhan-mobipixels avatar Nov 07 '22 04:11 Amankhan-mobipixels

Hi I have the same issue! What did you do to your code for it to start working?

anonna16 avatar Mar 18 '23 18:03 anonna16

It really never worked properly for my particular scenerio.

On Sat, Mar 18, 2023, 11:01 PM anonna16 @.***> wrote:

Hi I have the same issue! What did you do to your code for it to start working?

— Reply to this email directly, view it on GitHub https://github.com/dlutton/flutter_tts/issues/312#issuecomment-1474933123, or unsubscribe https://github.com/notifications/unsubscribe-auth/APDNEYUF3UIUNOMMATRHHGDW4XZ53ANCNFSM5PUBLERQ . You are receiving this because you were mentioned.Message ID: @.***>

AyeshaIftikhar avatar Mar 19 '23 16:03 AyeshaIftikhar

@Amankhan-mobipixels Can you please share what changes you did in your code?

devsideal avatar Jun 19 '23 12:06 devsideal

await flutterTts.awaitSynthCompletion(true); this can help

mminhlequang avatar Nov 06 '23 14:11 mminhlequang