Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I need to create a "morse code decoder" for Android, very similar to this app: https://play.google.com/store/apps/details?id=org.jfedor.morsecode
My app must listen a sounds (morse code) from the microphone. And translate the code in original text.
To be honest, this feature is part of a larger project. My intent is create a system:
ENCODE: a Java Application that translate a text in sound (in this case I have chosen the morse code... we don't have much time for create a our "alphabet"...). So, it is text-to-sound.
DECODE: an Android App for "listen" this sound (the morse code) and obtain the original text. So, sound-to-text.
Creating the java application isn't problem, but it is for the android app... to listen the sound is ok, but TO UNDERSTAND IT is the issue.
Just break the problem down into the parts. There's:
1) recording from the microphone [ok, no problem]
2) detecting the start times of the tones
3) building up this into a sequence of dots and dashes.
4) translating this into text
I would start from step 2)... thought to act like this: I set the app to listen to the sound at a certain frequency and speed. Must recognize morse code... translate it and print the original text for the user... but how? I do not know where to start. Any ideas?
Just break the problem down into the parts. There's :
1) recording from the microphone
2) detecting the start times of the tones
3) building up this into a sequence of dots and dashes.
4) translating this into text
None of those seems particularly difficult on its own. 2) and 3) are probably hardest, especially if the speed of the signal varies a lot or if you need to handle errors. So perhaps you could start there with some pre-recorded audio files.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I used Android Speech-to-Text API (Recognizer Intent), for recognition of the word said by the user. But the problem is that it returns the accurate word after autocorrection. I want it returns the exact word (without correction) said by the user. Please suggest me any other android library for this feature or how can I got my feature inside the android inbuild speech to text API.
I also saw the google API for this but that is paid And that is also AI-based.
I want it to return the exact word (without correction) said by the user.
I think you misunderstand what speech recognition is capable of doing.
A speech recognizing system is only capable of recognizing an uttered word as being one of a number of possible words. It doesn't ... and cannot ... tell you with 100% accuracy what the speaker actually said.
This applies to any speech recognition system, including a human listener. (How many times have you had to ask someone to "Say that again please" ?)
The only way to determine with absolute certainly the exact words that were spoken is to ask the person who spoke them to type them in! (And even then, they may not give you a 100% accurate answer, in some cases.)
In short, what you want is not possible. Software cannot do it. Humans cannot do it, even if they believe that they can1. You need to adjust your expectations.
1 - The Two Ronnies - Four Candles sketch
Identifying / recommending better (more accurate) speech recognition software or services is off-topic.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
This may seem like a bit of a strange question, but I want to make an "enter" keystroke into a string. I made a rather basic program to scan my papers (that I write for school) to find things such as prepositions at the end of a sentence or contractions I may have accidentally added. My issue is, when i put the paper into my code, it try to tokenize all the sentences at periods. When it reaches the point where I hit "enter" to move to the next line, it breaks and stops tokenizing. I thought of maybe making "enter" into a string so that i could replace it with a space, but I can't figure out how to get the effects of an "enter" into a string. Is there another way to stop the "enters" from breaking my code?
Sum up:
I enter my paper into my code and the effects of hitting "enter" in the paper cause the code to err. I want to be able to enter the paper and have the code ignore the effects of the "enter."
Thanks for any help!
In java, "enters" are considered new lines. There are several ways to combat your problem. The most simple way is to compare each index of the string with the '\n' char which denotes a new line.
Please post a sample code of your problem if the problem persists. It is easier to correct issues when someone can see exactly what you are doing.
I would not look for just \n\ or \r\n as the line feed can be different from computer to computer, especially with different OS.
I would use the System Properties to get the specified line feed you need:
String enterKey = System.getProperty("line.separator");
This gets the sequence used by operating system to separate lines in text files
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am planning to implement a mobile guitar tuner app. I did an initial research and found out some commonly used methods for pitch detection such as fast Fourier transformation , autocorrelation ,etc.
I have also found out that FFT is not a very good mechanism to detect frequency.
Since there are 2 parts in this project which is detecting the frequency of a guitar string and matching that frequency with the frequency which the string should be in,i thought of using an already implemented class library for detecting the frequency of a string.
I currently have no idea how tough this project will be, so my question is which part of the project is tougher? Is it matching the 2 frequencies or detecting a frequency of a string ? Also is there a way to use the FFT but at the same time get the accurate frequency of the string.
Thank you for your time.
The TarsosDSP project, a java audio processing library, contains several pitch detection algorithms. You can test them using the provided pitch detection example, an see which one works best in your case. The source code can be found on the TarsosDSP github page
The library is open source and available on Android. I think it is a good match for your application.
To match a frequencies to a target frequencies, i would convert both to the absolute cents scale (or MIDI cents). 100 cents equals a semi-tone. You then can round up to the nearest 100 to get the assumed target tone. Consult this page to convert frequencies in hertz to cents
There are numerous libraries that can help you do this.
The phone mic should be able to detect the audible spectrum you want
Detecting frequency is the first part, FFT should be able to do this
Transferring frequency to pitch is something you'll have to think about
matching frequencies is just the second part
Here's a good start:
Frequency detection and pitch tracking in java
FFTW is the 'fastest fourier transform in the west', and has some Java wrappers:
FFT JAVA library
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
For a game I am writing, the world is saved as chunks. Each chunk (when saved) is just under 200kb (they are very large chunks). Whenever a world is loaded 121 chunks need to be loaded. Each one only takes a fraction of a second, but all those fractions add up and lead to taking several seconds.
This would be ok, but saving is even more important. When a player walks into new chunks, all the chunks out of range will be saved and unloaded. As each save takes a fraction of a second, I would get a lag spike of over a second every time the player moves chunks. For this reason, I hope to use Threads to save and load chunks so that a chunk can be saved/loaded while the game is still running.
I have no idea how I would implement such a thing though. So, if anyone could share a link to a tutorial or give some source code I could play with, that would be great!
Thanks!
I would use memory mapped files and I would load as much as possible in as few files as possible (each files adds an overhead)
If you do this you can load/save GB in a fraction of a second.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
I have quite a weird question, but here it is:
Is it possible, and are there any guides for writing a custom video codec in C++ or Java?
Here's the weird part: I don't need to dive into those tons of info about audio and motion picture I don't understand. What I actually need is the technical stuff behind how to make a software layer between a movie player and a movie file.
Here's why: I would like to create a library or ultimately 2 functions - encode / decode - in C++ / Java, which will take the RAW binary input of any type of file and encode / decode it according to a given password or something like that. Then I need to put this processing between a movie player and a movie file. The final result will be a password protected mp4 / avi / mpeg / wmv (doesn't really matter) file, that could be played only with this "codec". The internal logic of the codec is not the issue right now.
How I imagine it is like a stream, movie player request the file and calls my encode() function, it takes a chunk of the file, decodes it (it has been previously encoded) and returns the correct bytes in wmv/mp4 and so on format.
Is any of this possible and how?
A codec generally takes image blocks and context information, transforms and quantizes the data, applies predictions, then encodes the resulting error stream using one of any number of coding schemes.
The API is usually simple. For encode, you send blocks of image data (frames) to the encoder, and it generates a stream of bits. You may be responsible for writing the container (file format) yourself. For decode, you stream bits in and frames come out.
There is absolutely no standard to any of this -- the technologies used in the codecs are sometimes standardised, but the exact interfaces are not.
MediaTool Introduction is a simple Application Programming Interface (API) for decoding, encoding and modifying video in Java:
http://wiki.xuggle.com/MediaTool_Introduction#How%5FTo%5FTake%5FSnapshots%5FOf%5FYour%5FDesktop
Java Media frame work tutorial:
http://wwwinfo.deis.unical.it/fortino/teaching/gdmi0708/materiale/jmf2_0-guide.pdf
maybe helps you!