How to Detect a specific sound in android app? [closed] - java

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 4 years ago.
Improve this question
I am beginner in Android Programmming. Developing a sound detection app in Android studio. Can somebody help me to detect a specific sound ?

Try using musicg
musicg is a lightweight audio analysis library, written in Java, with the purpose of extracting both high level and low level audio features. This API allows developers to extract audio features and operate audio data like reading, cutting and trimming easily from an inputstream. It also provides tools for digital signal processing, renders the wavform or spectrogram for research and development purpose.
Add musicg library to your project and try this code :-
Wave w1= new Wave("first_wav"); // Base Audio file
Wave w2= new Wave("second_wav"); // Audio file to compare
// Finding Audio Fingerprint Similarity
FingerprintSimilarity fps = w1.getFingerprintSimilarity(w2);
float score = fps.getScore();
float sim = fps.getSimilarity();
sim contains the similarity between to audio files (value rages from 0 to 1.0). value greater that 0.3 can be considered as similar sound.musicg uses 16 bit PCM audio files.
but getFingerprintSimilarity() accept only wave format files.
This app uses musicg for sound detection.

Related

exact speech word recognition [closed]

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.

Frequency detection for guitar tuning [closed]

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

Morse code audio decoder (Android) [closed]

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.

Java: Guide to write a custom video codec [closed]

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!

how to play pcm raw data in java [closed]

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 have PCM samples in a short array. What is the best way to play this out?
The format is 8000Hz, Mono, 16 bit, big endian.
(The PCM samples are generated in the code and not read through some file)
Thanks
With the javax.sound.sampled package it's pretty much straightforward, but you have to use some boilerplate.
Here's a good tutorial on that: www.wikijava.org/wiki/Play_a_wave_sound_in_Java
Basically you have to create an InputStream from your array and use that to create an AudioInputStream. There you have to specify the format of your audio data.
Then you open an output stream (SourceDataLine) and copy the bytes from the audio stream into that stream.
Check out this article - http://download.oracle.com/javase/tutorial/sound/playing.html.
More specifically, read about SourceDataLine and how to set up AudioFormat.

Categories

Resources