Note that there are some explanatory texts on larger screens.

plurals
  1. POCapturing audio streams in JAVA
    primarykey
    data
    text
    <p>I am new to Java, and although I have mastered the syntaxes and constructs, I am having difficult time in getting processed digital audio samples from a mic. </p> <p>What I am trying to achieve is very simple, while in the long run, I am trying to create a very simple spectrogram, but just to understand/master the audio manipulation process I am trying to start from scratch. </p> <hr> <p><strong>Here is my problem</strong></p> <p>When a microphone detects a single beep or any sound, I want to capture that binary data, and just simply display it, in its raw format. </p> <hr> <p>Is that really too much to ask from JAVA? </p> <p>I have read about analog/digital signals, FFT, matlab and I have searched many links in so like these one:</p> <p><a href="https://stackoverflow.com/questions/6166187/is-there-a-way-of-recording-audio-of-streaming-broadcast-from-a-webpage">Is there a way of recording audio of streaming broadcast from a webpage?</a></p> <p><a href="https://stackoverflow.com/questions/13966918/working-with-audio-in-java">Working with audio in Java</a></p> <p><a href="https://stackoverflow.com/questions/9886668/openal-playback-captured-audio-data-c">OpenAL playback captured audio data c++</a></p> <p>and the famous introduction from oracle </p> <p><a href="http://docs.oracle.com/javase/tutorial/sound/capturing.html" rel="nofollow noreferrer">http://docs.oracle.com/javase/tutorial/sound/capturing.html</a> </p> <p>and this is actually a good tutorial <a href="http://www.developer.com/java/other/article.php/3380031/Spectrum-Analysis-using-Java-Sampling-Frequency-Folding-Frequency-and-the-FFT-Algorithm.htm" rel="nofollow noreferrer">http://www.developer.com/java/other/article.php/3380031/Spectrum-Analysis-using-Java-Sampling-Frequency-Folding-Frequency-and-the-FFT-Algorithm.htm</a></p> <p><strong>But</strong> they all fall short of providing a solution to my answer. </p> <p>I am not asking for a code, although it would it would be awesome, just to read every line and understand about the mechanics involved, but a simple hint would be nice as well. </p> <hr> <p>And here is a simple code, to capture bytes, but only from an existing <code>wav</code> file</p> <pre><code>import java.io.FileInputStream; import java.io.IOException; public class Boo{ public static void main(String[] arguments){ try { FileInputStream file = new FileInputStream("beep.wav"); boolean eof = false; int count = 0; while(!eof){ int input = file.read(); System.out.print(input + ""); if(input == -1) eof = true; else count++; } file.close(); System.out.println("\nBytes read: " + count); }catch (IOException e){ System.out.println("Error - " + e.toString()); } } } </code></pre> <h2>After Bounty</h2> <p>-For better clarity-</p> <p>All I am trying to make it just a simple program to read from mic. and show the binary data of the sound it caputures in a real time.</p> <p>Think of it like a spectrogram, when sound is captured the graph goes up and down depending on the variety of the signal level, but in this case, there is no need to convert the binary data to audio graph, just only to show any raw data itself. No need to write/read files. Just capture from mic, and show what is read from the mic.</p> <p>If the above provides to be difficult, as I have searched all over the web, and couldn't find anything helpful, you can just give me guides/directions.. thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload