murali chevuri

Greenhorn
+ Follow
since Dec 24, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by murali chevuri

Hi Sanjit Kumar,

Thanks for your reply. You are correct. I got the idea. Thanks for your clarification.
[ December 12, 2006: Message edited by: murali chevuri ]
Hi praveen balaji,

Thanks for your reply. My doubt is method1 is synchronized. So I am expecting until Thread1 completes the method1 Thread2 will not enter. Same case for method2 also.But output is showing method1 and method2 allowing both the threads. Why its happen like that.
Hi all,

I ran this program on jdk1.5. Anybody Please explain output and why...


public class Thread extends Thread{

public synchronized void method1() throws Exception {
System.out.println(Thread.currentThread().getName() + " method1");
Thread.sleep(10*1000);
System.out.println(Thread.currentThread().getName() + " method1 done");
}

public synchronized void method2() throws Exception {
System.out.println(Thread.currentThread().getName() + " method2");
Thread.sleep(10*1000);
System.out.println(Thread.currentThread().getName() + " method2 done");
}

public void run() {
try {
method1();
//System.out.println("method 1 Done");
method2();
System.out.println(Thread.currentThread().getName()+" Done");
}catch(Exception e) {
e.printStackTrace();
}
}
public static void main(String args[]) {
Thread1 t1 = new Thread1();
Thread1 t2 = new Thread1();
t1.setName("T1");
t2.setName("T2");
t1.setPriority(8);
t2.setPriority(9);
t1.start();
t2.start();
System.out.println("Done");
}
}


Output:
T1 method1
T2 method1
Done
T2 method1 done
T2 method2
T1 method1 done
T1 method2
T2 method2 done
T2 Done
T1 method2 done
T1 Done
Hi,

My name is Murali. I am doing project on Sound Systems. My work is converting the differen wav file formats to a Standard format. For example 44000 sampled rate wav file to 8000 Sample rate. When I am trying to converting the file. I am getting exception like Unsupported Conversion. Please help me. Thanks in advance. I am sending my code. Please check and advise me.



import java.io.IOException;
import java.io.File;

import javax.sound.sampled.AudioFileFormat;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.UnsupportedAudioFileException;


public class Audio
{

int nDefaultSampleSizeInBits = 16;
float fDefaultSampleRate = 8000;
AudioFormat.Encoding defaultEncoding = AudioFormat.Encoding.PCM_SIGNED;
AudioFileFormat.Type defaultFileType = AudioFileFormat.Type.WAVE;
boolean bDefaultBigEndian = false;
int nDefaultChannels = 1;
float frameRate= 8000;
int frameSize = 2;
AudioFormatdefaultFormat = null;
File inputFile = null;
File outputFile = null;



public Audio(String sou,String tar)
{

try
{
//Standard Format
defaultFormat = new AudioFormat(defaultEncoding,fDefaultSampleRate,nDefaultSampleSizeInBits,nDefaultChannels,frameSize,frameRate,bDefaultBigEndian);
inputFile = new File(sou);
outputFile = new File(tar);
convert();
}
catch(Exception e)
{
e.printStackTrace();
}
}

protected void convert() throws UnsupportedAudioFileException, IOException
{

AudioFileFormatinputFileFormat = AudioSystem.getAudioFileFormat(inputFile);
AudioFormatinputFormat = inputFileFormat.getFormat();

if(inputFormat.matches(defaultFormat))
{
System.out.println("No Change");
return;
}
AudioInputStream sourceStream = AudioSystem.getAudioInputStream(inputFile);
intnWrittenBytes = 0;
AudioInputStream stream = AudioSystem.getAudioInputStream(defaultFormat,sourceStream);
nWrittenBytes = AudioSystem.write(stream, defaultFileType, outputFile);
System.out.println("Written bytes: " + nWrittenBytes);
}

public static void main(String args[])
{
new Audio(args[0],args[1]);
}
}
15 years ago
Hi,

I am new to this group. In my project I want to catch the Real Time Streaming means live streams. For catch it I used url connections in java. The streaming url starts with rtsp://. URL connections are not supporting this type of protocols. Please suggest me.

Regards,
Murali.
Hi,

I am new to this group. In my project I want to catch the Real Time Streaming means live streams. For catch it I used url connections in java. The streaming url starts with rtsp://. URL connections are not supporting this type of protocols. Please suggest me.

Regards,
Murali.
15 years ago