Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
actually i have code which convert complete audio file into text and i want to convert line by line through multi threading.
Posted

1 solution

Errm, no you don't. You may think you do, but in reality what you need to define is what you mean by multi-threading.

That was a provocative opening paragraph, but it's important for you to realise that you need to put bounds around what multi-threading means in the context of the application. If you are just talking about converting the audio into text and not having it run on a UI thread, then you would simply want to run the entirety of the process in a background task. This is fairly straightforward (I would do this using the Task Parallel Library).
C#
Task.Factory.StartNew(()=> ConvertAudioFile());
If, however, you are talking about converting each line on a separate thread, then I would caution you against this for the following reasons:

1. How do you know when a line has finished in an audio file?
You would have to process a line to know that it was a line. So, what would you gain by putting it on a thread?

2. Without complex synchronisation, you aren't guaranteed to get the lines out in the order you put them in. That's kind of the point with threading - it's not deterministic.
 
Share this answer
 
Comments
ch.haya 17-Feb-14 12:39pm    
Yes its good solution to convert complete audio b i want to convert according to media size 128kb ...i think 1 thread will use to extract audio of this size then 1 thread to convert into text and display and finally 1 thread for synchronization ..what u say regarding this let me guide....

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