Is there a way to get the sound from the default audio output for the computer? I don't want to manipulate it, I just want to make a visual representation of the frequencies; much like an equalizer.
This question is duplicate of:
Real Time Audio Visualization Java
The java sound API lets you interact with the current audio output. You can find the reference here:
http://www.java-tips.org/java-se-tips/javax.sound/capturing-audio-with-java-sound-api.html
Mac computers do not feed audio output back into the computer for programs to access, and since everything in java has to work on both mac and windows computers, they cannot provide specific access to this feature to windows users either. Windows computers might provide an input device which you can access representing system output, I'm not sure about it, but you could find out with
AudioSystem.getMixerInfo()
It returns a list of objects containing strings for the name, description, version, and vendor of every available audio device. Printing these on a loop lets you look at all the audio devices. If none of them look like they could be the widows system output feedback then you are out of luck, unless you want to use native classes. I'm not going into that here but there is a good page about them here.
Related
I want to control a circulator (Thermo Haake DC30/DL30) which has got a RS232c interface. My first problem is that my computer has got only USB connections. Is it possible to use a RS323 to USB adapter and transmit commands and which libraries could you recommend me to use?
Also I don't know which language would be recommended. I am experienced in C# and Java. But I wanted to try out Python. I heard that it is less code to write and it would be a great opportunity to learn Python at the same time.
At the end I want a GUI in which I can set values like temperature, interval, read the current temperature or any fault messages.
I think what a USB to COM adapter does is create a virtual COM-Port on your PC, which you can then use like a regular one. Just make sure to get the right drivers, if you even need them.
I wrote a small app that required barcode scanners via RS232 in Python and I think I used PySerial, it is also definitely possible with C#, I tried that but gave up, since the application was no longer needed.
I'm trying to get the data that the soundcard is outputting. Unfortunately, from my understanding of the Java Sound API, SourceDataLine does not support the read method, and there is no way to listen for raw data. I want to stick to Java for this, rather than C++, so if anyone knows how to listen for audio output on the soundcard that would be great.
Thanks very much!
Sorry if this post is confusing, just woke up.
I've researched this a while, and determined any implementation using only java sound will not work with any reliability on multiple audio cards.
There are a few solutions though. Hopefully one of these helps you.
Bite the bullet, write some C++ code to allow this functionality on different operating systems.
Use Java Sound to capture audio from a virtual audio recorder adapter which loops back the system audio output.
Create a loopback yourself using cables to feed a sound output port into a sound input port.
I recommend option 1 if you're developing this for a professional application as installation will be cleaner.
Go with option 2 if you've a short amount of time, and you expect to spend more time with your users, or your users are tech savvy.
Use option 3 if this is just a hobby, or some one-off project for a client.
After extensive searches I can't find any information on how to detect the microphone sound level input in mac OSX using either Applescript or Java.
The purpose of this is to write an automatic volume adjust script based on the sound level detected by the built in microphone.
I know that commercial solutions exist but I'm interested simply as an exercise.
Just in case people think I'm posting on here just to make a statement I'm informed that I should add something to which a question mark can be added or people won't understand that it's a question.
I am after some example code in either java or applescript to show how to detect the microphone input sound level. Can anyone help with this?
set currentVolume to output volume of (get volume settings)
This is from a MacScripter thread that will probably answer some more of your questions on this project as well.
How does one obtain the system sound, (beeps and such), and then record it and output to a sound file? I can get sound from a line - in mic, but I can't figure out how to get the actual system sound.
Any assistance?
This has been a long unanswered question which has been frustrating me as well.
I found a way to capture/record Windows' audio output, but it is more of a hack job rather then an actual solution. Disclaimer: This is my blog. I say this because from what I have found Java doesn't capture the data from a specified audio device [See the official Accessing Audio System Resources Java tutorial (although you can list out all of the audio I/O devices/audio ports, See: Programming JavaSound), instead it just takes the default device (which is how I 'solved' the problem).
This, however, introduces a problem where because the default recording device is no longer the microphone, you can no longer record from the microphone as another input; Although, using the Port.Info class to capture the microphone might be a possible solution to this side effect.
I hope this will help.
I want to alert the user in a Swing application of certain events with an old fashioned PC Speaker beep (NOT the soundcard), since not on every PC there is a soundcard with an attached speaker, or volume might be turned to zero, or a headphone might be connected... How can I do this?
UPDATE:
java.awt.Toolkit.getDefaultToolkit().beep() seems usually to generate a sound on the soundcard. It only uses the speaker if there is no active soundcard.
To print an ASCII value 7 works only if the application is launched in a terminal, which at least a Swing app usually isn't.
So the question is still open.
Toolkit.getDefaultToolkit().beep();
Try this:
java.awt.Toolkit.getDefaultToolkit().beep();
It worked for me, although I'm not sure whether this was the PC Speaker beep or some OS-generated beep.
I read somewhere that you need to use a C/C++ dll and connect it with JNI, to make that work,.. link is offline
Ok I found what you're looking for
http://pyx4j.com/pyx4j-native/index.html
he pyx4j-native project is a collection of java wrappers for windows functions like time and beep. Now only works on windows.
NativeThreadDump - Send CtrlBreak Event to current process
Beep - Make a sound using PC speaker
FileUtil - Access and modify file creation time. Used in com.pyx4j.log.RollingFileAppender
NativeTimer - System high-resolution performance counter used before Java 5
Other than the beep sound you can try
JFugue.
JFugue is an open-source Java API for programming music without the complexities of MIDI.
ASCII value 7 is a beep. So just print that character.
{
If (whatever you named the file) = true
Then
Process.Start ("C:\Windows\Media\{whatever you named the file})
}
I use that in C#. It's late for me the code is not exactly accurate before people bash this post. Put a write directory to name a folder and declare it the default location. Move the sound of your choice to this folder and it will play the audio tone. Set the timer in Java to loop the sound every 2 seconds to get the persons attention. Hope this helps as I'm learning my self!