How to detect sound using JMF
Hi,
I want to detect a beep sound that is played on the machine by another application. Basically, connect to the sound card and see if beep was played. This sound would effectively play on the machine speakers. if speakers are present.
I want to eventually grab a couple of sounds but first start with beep. So, over a duration of 2 minutes, I would alternate between 'beep' and 'bang'. And whenever these sounds are played, I want to be able to detect them.
I would appreciate if there is sample code that I can start with.
I am new to java audio/media and most data that I found was recording sound from microphone.
Thanks.
I tried getting the device list on my system but the following code is not returning any devices (deviicelist is empty) ? When I look at my Device Manager on Windows7 machine, I see there is 'High Definition audio device' . Does anyone have a clue why/when would this happen ?
I have jmf installed and it is in the classpath. I also have jmf.jar, sound.jar added to my project.
CaptureDCaptureDeviceInfo di = null;
Vector deviceList = CaptureDeviceManager.getDeviceList(
null);
if (deviceList.isEmpty())
System.out.println("No Devices found");
if ( deviceList.size() > 0 )
di = (CaptureDeviceInfo)deviceList.firstElement();
System.out.println("di::" + di.getName());
Similar Messages
-
How To Record Sound Using Applet
How To Record Sound Using JApplet
Hallo there,
I am intrested on the same topic but I am not so good to modify the sound sdk demo. Is there anyone willing to share some code?
Thanks
Matteo -
How To Detect Color using my application
Hi Friends,
Iam sachin, working as a iphone mobile application developer.K coming to my question is it possible to
detect colors using our application if yes Kindly guide me how to proceed .
Thanks in advance ,you need to ask this in the developers forum - this is a formum mostly for end users not developers
-
Does enyone know how to grabb frames using JMF
can u please help me , if enyone knows
how to grabb frames from .AVI file using JMF and
also
how to save those frames as JPEG in to HDD .Take a look at this
http://java.sun.com/products/java-media/jmf/2.1.1/solutions/JVidCap.html -
How to detect sound attributes
Hi,
can any1 tell me how to retreive the sound attribute what makes a one's voice different from other......This is ugent.
Thanks in advance.
AbhideepHi Auxilius,
I faced your problem, my final project this year was about exact what you ask about?
it's a big problem and you have to work hard.
1 - first the captured voice should pass a preprocessing phase
in this phase any DC component of the wave should be removed, then you should detect the end-points of the speech ( I mean you should remove the silence periods before and after the speech)
2 - then the voice wave should be partitioned into frames (these frames should be interleaved, for example if you chose frame length of 256 samples, interleaving should be of size 128 samples, frame 0 starts at sample 0 to 256, frame 1 from 128 to 384, frame 2 from 256 to 512 and so on).
3 - A method called LPC (Linear Predictive Coding) should be used to calculate some coefficients for each frame these coefficients called LPCs (Linear Predictive Coefficients), calculate from 8 to 12 coefficients for each frame ( I think best number is 10). THESE COEFFICIENTS ARE WHAT YOU LOOK FOR, THEY ARE WHAT IS USED TO IDENTIFY A PERSON FROM HIS/HER VOICE.
4 - Befor starting to compare coefficients from two waves to detect if the same one saying the same word or not, you will face a problem of length of the voice wave (No one will say the same word with the same length twice, always the length will be different, so number of frames is different. You can not start comparison now), to over come this problem an algorith called DTW (Dynamic Time Warping) or (Dynamic Programming) is used.
5 - After DTW is performed the two waves are of the same length and you can start comparison, you can compare by one or more of a variety of methods like mean square error, multi-layer perceptrons,....etc
6 - you should find a tolerance that error between any person and himself is always under it and error between any two persons is higher than it, then use this tolerance for verification.
I think the task is complete now, I know you don't understand the most of what I have said, but don't worry I was like you but now, the project is complete and all things are well.
if you need more help you can send to me at [email protected] you are welcomed. -
How to detect Browser using JSP ?
Hi friends,
I wanna to put some code to detect browser and
Other than IE6+ i have to block other browser to display login.
How do i check that ? Using JSP.
e.g.
If i open IE6+ login page should be displayed. Else on other browsers
it will check brower and deny to display login page.
How Do i check it ? please Help me.this code works for me in IE,Safari and firefox but i could not check in netscape as i dont have.
String userAgent = request.getHeader("User-Agent");
System.out.println("UserAgent:"+userAgent);
userAgent=userAgent.toLowerCase(); //convert to lowercase and then check
if(userAgent.indexOf("netscape6") != -1)
System.out.println("Netscape");
else if(userAgent.indexOf("msie") != -1)
System.out.println("IE");
else if(userAgent.indexOf("firefox") != -1)
System.out.println("Firefox");
else if(userAgent.indexOf("safari") != -1)
System.out.println("Safari");
else
System.out.println("Else");
-
How to test sound using echo call on my Samsung Pr...
I have a Skype account and am trying to see if the audio works on my Samsung Galaxy Pro 8.4 tablet which is running Android 4.4.2. How do I make an echo test call on this device?
I found some refrance it,works.But another thing is every code i found is applied on button.But,I cant use this code b.coz I have n number of buttons,it will again create problem.Can u suggest me anything more?
I want something like it will attch sound through folder path (link).And 1 button should abale to play more than 10 sounds with diffrent click.
Thanks. -
Daily backup: how to detect non used libraries.
Hi,
We use a CL program with a list of SAVLIB commands to save all production librarires every day. The problem is that this CL has been mantained for several years and probably most of the saved libraries are not used anymore. I'm only responsible of the SAP backup lines.
How can I detect what libraries are not used now ? I've tried to look at the file attributes in this libraries but the backup itself mantains this fields.
Of course, I know that our functional people must know what is in use and what is obsolete, but in some cases the people that mantains applications has changed...
Any idea will be appreciated !!
Regards,
Joan B. Altadill
CELSA SAP AdminI use this method in iSeries Navigator, Run an SQL script:
<begin copy>
/*--- Display the objects in the library to an outfile. Change the value of {sourcelib} to the desired library. ---*/
CL: DSPOBJD OBJ(sourcelib/*ALL) OBJTYPE(*FILE) DETAIL(*SERVICE) OUTPUT(*OUTFILE) OUTFILE(QTEMP/DSPOBJDTMP) ;
/*--- List the objects in ascending order by LastUsedDate ---*/
SELECT ( Char(Date(Now())) CONCAT ' ' CONCAT Char( Time(Now())) ) DataPulled,
(CASE WHEN ODCDAT = ' '
THEN ' '
ELSE (CASE WHEN ODCCEN in ( '0' , ' ' )
THEN '19'
CONCAT SUBSTR(ODCDAT, 5, 2 )
CONCAT '-'
CONCAT SUBSTR( ODCDAT, 1, 2 )
CONCAT '-'
CONCAT SUBSTR( ODCDAT, 3, 2 )
ELSE '20'
CONCAT SUBSTR(ODCDAT, 5,2 )
CONCAT '-'
CONCAT SUBSTR( ODCDAT, 1, 2 )
CONCAT '-'
CONCAT SUBSTR( ODCDAT, 3, 2 )
END )
END) CreationDate,
(CASE WHEN ODUDAT = ' '
THEN ' '
ELSE (CASE WHEN ODUCEN in ( '0' , ' ' )
THEN '19'
CONCAT SUBSTR(ODUDAT, 5, 2 )
CONCAT '-'
CONCAT SUBSTR( ODUDAT, 1, 2 )
CONCAT '-'
CONCAT SUBSTR( ODUDAT, 3, 2 )
ELSE '20'
CONCAT SUBSTR(ODUDAT, 5,2 )
CONCAT '-'
CONCAT SUBSTR( ODUDAT, 1, 2 )
CONCAT '-'
CONCAT SUBSTR( ODUDAT, 3, 2 )
END )
END) LastUsedDate,
(CASE WHEN ODSDAT = ' '
THEN ' '
ELSE (CASE WHEN ODSCEN in ( '0' , ' ' )
THEN '19'
CONCAT SUBSTR(ODSDAT, 5, 2 )
CONCAT '-'
CONCAT SUBSTR( ODSDAT, 1, 2 )
CONCAT '-'
CONCAT SUBSTR( ODSDAT, 3, 2 )
ELSE '20'
CONCAT SUBSTR(ODSDAT, 5,2 )
CONCAT '-'
CONCAT SUBSTR( ODSDAT, 1, 2 )
CONCAT '-'
CONCAT SUBSTR( ODSDAT, 3, 2 )
END )
END) SavedDate,
(CASE WHEN ODRDAT = ' '
THEN ' '
ELSE (CASE WHEN ODRCEN in ( '0' , ' ' )
THEN '19'
CONCAT SUBSTR(ODRDAT, 5, 2 )
CONCAT '-'
CONCAT SUBSTR( ODRDAT, 1, 2 )
CONCAT '-'
CONCAT SUBSTR( ODRDAT, 3, 2 )
ELSE '20'
CONCAT SUBSTR(ODRDAT, 5,2 )
CONCAT '-'
CONCAT SUBSTR( ODRDAT, 1, 2 )
CONCAT '-'
CONCAT SUBSTR( ODRDAT, 3, 2 )
END )
END) RestoreDate,
ODCRTU CreatedBy,
ODLBNM LibraryName,
ODOBNM ObjectName,
ODOBTP ObjectType,
ODOBAT ObjectAttribute,
ODSRCL SourceLibrary,
ODSRCF SourceFile,
ODSRCM SourceMember,
(Case When ODOBSZ = 9999999999 Then (ODSIZU * ODBPUN)
Else ODOBSZ
End) ObjectSize,
ODOBTX ObjectText
FROM QTEMP.DSPOBJDTMP
Order BY LastUsedDate ;
<end copy>
Copy/paste the code into the session, change the value of , and then Ctl+R to run all of the statements.
You can then view the results and determine if the objects haven't been used recently.
Hope this helps!
Robert
P.S. This forum doesn't show neatly formatted code as I have it in my script, but it does work.
Message was edited by: Robert Clay
added code tags -
How to record sound with JMF?
I just want to record a clip of sound and save it in a WAV file. I exhausted the web but just couldn't find a tutorial. Would someone be kind enough to give me a tutorial or a sample code? The simpler the better. Thanks.
Hi there,
The following lines of code will record sound for 5 sec and save it in file C:/test.wav.
import java.io.IOException;
import javax.media.CannotRealizeException;
import javax.media.DataSink;
import javax.media.Format;
import javax.media.Manager;
import javax.media.MediaLocator;
import javax.media.NoDataSinkException;
import javax.media.NoProcessorException;
import javax.media.NotRealizedError;
import javax.media.Processor;
import javax.media.ProcessorModel;
import javax.media.format.AudioFormat;
import javax.media.protocol.FileTypeDescriptor;
public class WAVWriter {
public void record(){
AudioFormat format = new AudioFormat(AudioFormat.LINEAR, 44100, 16, 1);
ProcessorModel model = new ProcessorModel(new Format[]{format}, new FileTypeDescriptor(FileTypeDescriptor.WAVE));
try {
Processor processor = Manager.createRealizedProcessor(model);
DataSink sink = Manager.createDataSink(processor.getDataOutput(), new MediaLocator("file:///C:/test.wav"));
processor.start();
sink.open();
sink.start();
Thread.sleep(5000);
sink.stop();
sink.close();
processor.stop();
processor.close();
} catch (NoProcessorException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (CannotRealizeException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (NoDataSinkException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (NotRealizedError e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
public static void main(String[] args) {
new WAVWriter().record();
}I hope this will help. Don't forget to go through JMF guide (http://www.cdt.luth.se/~johank/smd151/jmf/jmf2_0-guide.pdf), especially page 81... it's not always helpfull, but sometimes, it may give you some good answers.
Happy coding!!! -
How to attach sound using link to any button?
Hi,
am using this code to call sound file after click on button.
PAdha1.onRelease = function () {
mySoundC = new Sound(this);
mySoundC.attachSound("PAdhaSound1");
mySoundC.start(0, 99); //10 represents the number of loops
gotoAndPlay("play2");
_global.myTaalLaya = "High1";
My problem is I have more than 100 buttons and their own sound files.Now ,this buttons are on separet scene so, it creates separet image for each button and separet sound for each button which is in liblary.Now,my problem is there are huge sound files and button images.So,flash is not supporting this.It does not show .swf file(Output result).
I think this is beacause of a lot of images and sound files.
Is there any other way to call sound file through link function.Now sounds files are called through "linkage".from liblary.
am using flash cs 5 with as 2.I found some refrance it,works.But another thing is every code i found is applied on button.But,I cant use this code b.coz I have n number of buttons,it will again create problem.Can u suggest me anything more?
I want something like it will attch sound through folder path (link).And 1 button should abale to play more than 10 sounds with diffrent click.
Thanks. -
How to detect usb6009 using c++
how do i detect the name of the attached device in c++?
also how do i detect available channels in c++?char buffer[100];
char *p = buffer;
wxString active;
DAQmxGetSysDevNames(p,32);
active << p;
i already found how to get device name.
i just need to know how to find the list of channels. -
How to record sound using video setting of camera?
using camera as a video recoder works fine but no sound. is sound recording with video possible? Ipad 2
Hallo there,
I am intrested on the same topic but I am not so good to modify the sound sdk demo. Is there anyone willing to share some code?
Thanks
Matteo -
How to render audio with sample rate 48000hz using jmf
hi,
In my application i need to play the audio with jmf player with sampling rate 48000hz. but i found that jmf player plays the audio with sampling rate of 44100hz only.but my application needs to play the audio with sampling rate of 48000hz .please help me how to do this using jmf .
thanks in advance,hi,
In my application i need to play the audio with jmf player with sampling rate 48000hz. but i found that jmf player plays the audio with sampling rate of 44100hz only.but my application needs to play the audio with sampling rate of 48000hz .please help me how to do this using jmf .
thanks in advance, -
URGENT- problem in detecting audio device using JMF in WIndows7 - 64 bit
Hi,
I am trying to detect the audio device in windows 7 -64 bit OS, using JMF API with JRE 1.6.18.But it showing zero device found.below i have mentioned the source code that i have used.please suggest how to solve this , thanks in advance.
import java.util.ArrayList;
import java.util.Vector;
import javax.media.CaptureDeviceInfo;
import javax.media.CaptureDeviceManager;
import javax.media.format.AudioFormat;
import javax.media.format.VideoFormat;
public class CaptureDeviceFinder {
//possible audio formats available
static String audioformats[] = {
AudioFormat.LINEAR };
static ArrayList available_audiolist= new ArrayList();
public static void main(String[] args) {
findAudioDevices();
}//main
public static void findAudioDevices() {
/ Audio capture devices /
System.out.println("CAPTURE AUDIO FORMATS:");
for (String format : audioformats) {
System.out.println("format is :"format);
Vector<CaptureDeviceInfo> devices = CaptureDeviceManager
.getDeviceList(new AudioFormat(format));
System.out.println("devices is"+devices);
for (CaptureDeviceInfo device : devices) {
if (!devices.isEmpty()) {
System.out.println("\tFormat: " format);
System.out.println("\t\t" device.getName());
available_audiolist.add(format"|"+device.getName());
System.out.println("list is :"+available_audiolist);
Edited by: Saravana4u on Mar 17, 2010 10:39 AMalmightywiz wrote:
Well, I don't know if the JMF Studio works on a 64-bit system, but the base java libraries work just as well as on a 32-bit system. I currently use both Windows 7 64-bit and 32-bit version, and I am able to recognize all of my audio input devices.JMF wraps around and makes use of a bunch of native interfaces, all of which are precompiled for 32-bit systems. As such, anything relying upon those 32-bit libraries will not work, and that cuts the functionality down to, essentially, the cross-platform pack stuff.
JMF's sound infastructure is mostly a wrapper around JavaSound, so as long as JavaSound is working on the JRE, you'll be able to utilize the audio functionality.
As for device detection, I know at least some of that is native code. I'm not 100% sure, but I'd almost expect the Windows performance pack to never return any devices on a 64-bit system, but the cross-platform back to return audio devices. This is an assumption, but, that's what I would expect.
In any case, if you're using the Windows performance pack, you'd most likely get better results by switching to the cross-platform pack. -
JMF - how to detect second webcamera
Hi
I am trying to modify single web cam capturing screen code into multiple web cam screen capturing. The method autoDetect() recognizes the web camera. I want to choose web cam by myself. I tried all devInfo from the list but it resulted no success. Always the first camera is selected . I use different cameras (Logitech and Genius). Please, how to detect both camera to work at the same time.
public CaptureDeviceInfo autoDetect ( )
Vector list = CaptureDeviceManager.getDeviceList (null);
CaptureDeviceInfo devInfo = null;
if ( list != null )
String name;
for ( int i=0; i<list.size(); i++ )
devInfo = (CaptureDeviceInfo)list.elementAt ( i );
name = devInfo.getName();
if ( name.startsWith ("vfw:") )
break;
The whole code is on: JWebCamI tried getting the device list on my system but the following code is not returning any devices (deviicelist is empty) ? When I look at my Device Manager on Windows7 machine, I see there is 'High Definition audio device' . Does anyone have a clue why/when would this happen ?
I have jmf installed and it is in the classpath. I also have jmf.jar, sound.jar added to my project.
CaptureDCaptureDeviceInfo di = null;
Vector deviceList = CaptureDeviceManager.getDeviceList(
null);
if (deviceList.isEmpty())
System.out.println("No Devices found");
if ( deviceList.size() > 0 )
di = (CaptureDeviceInfo)deviceList.firstElement();
System.out.println("di::" + di.getName());
Maybe you are looking for
-
once you upload songs,photos or documents fron ipod touch to icloud, can you delete them from ipod touch to free up memory from ipod touch and can you access them from icloud without downloading to ipod?
-
Created Network and Internet Sharing Problems
Hello, I created network with WEP password. I proceeded to turn on internet sharing. All works great until the iMac goes to sleep. Once it comes back on the network I created is missing and I have create it all over again. The internet connection is
-
How to Extract data from a Request management tool to Apex to avoid working on Excel reports
Client uses a ticketing tool,I donot know what is the database for the tool,but I would like to know the best way to extract data from the tool to pex so that we can eliminate working on Excel reports.These excel reports are basically the open reques
-
Using a PB display to display a MacMini
Is there a way to display a Mini on my PB's display? It is the only monitor I have at hand right now.
-
Why can't i backup with iTunes 11
I am trying to backup with my Imac 27" running Lion, but I can't find any devices to back my Itunes library to. I want to back up using my DVD +R-DL disks. Am I doing something wrong? (Just in case, I'm upgrading right now to Mountain Lion and wil