- 1
In any Programming language, can we take audio as an input or output?
If the answer is yes, please answer me the associated language and some prototype codes
3 Antworten
+ 11
Yes, otherwise a lot of things like voice recognition, music, and sound in general wouldn't exist. I imagine most any language could do it. If you want prototype codes, search github.
+ 1
yes it is possible, Python is the most used language for such complex method, You're talking about the mechanism of Google now or cortana or siri, They are written in Multiple programming Languages but Python is used for Voice recognition, Coding yourself Is not possible,
0
there is an api in java here is some code:
import javax.speech.*; import javax.speech.recognition.*; import java.io.FileReader; import java.util.Locale; public class HelloWorld extends ResultAdapter { static Recognizer rec; // Receives RESULT_ACCEPTED event: print it, clean up, exit public void resultAccepted(ResultEvent e) { Result r = (Result)(e.getSource()); ResultToken tokens[] = r.getBestTokens(); for (int i = 0; i < tokens.length; i++) System.out.print(tokens[i].getSpokenText() + " "); System.out.println(); // Deallocate the recognizer and exit rec.deallocate(); System.exit(0); } public static void main(String args[]) { try { // Create a recognizer that supports English. rec = Central.createRecognizer( new EngineModeDesc(Locale.ENGLISH)); // Start up the recognizer rec.allocate(); // Load the grammar from a file, and enable it FileReader reader = new FileReader(args[0]); RuleGrammar gram = rec.loadJSGF(reader); gram.setEnabled(true); // Add the listener to get results rec.addResultListener(new HelloWorld()); // Commit the grammar rec.commitChanges(); // Request focus and start listening rec.requestFocus(); rec.resume(); } catch (Exception e) { e.printStackTrace(); } } }