Java send WAV file thorugh modem to phone
I am currently using Java communication API to configure a modem to send a WAV file to a phone. Once the user answer the phone, he/she will hear the WAV file.
I am using AT command. I got the "CONNECT" from the modem. I am ready to send the WAV file. But how to format the file ?
I directly send the file by write(), but I cannot hear the voice ...
How to do ?
Thanks !
Hi everybody,
I am also working on modems and trying to send wav files to phone over modem. As far as I know, the code should be something like :
send("AT#CLS=8"); expect("OK"); //voice initialize
send("AT#VLS=0"); expect("VCON"); //use phone line
send("at#vsm=128,8000"); expect("OK"); // I think this command about sound file format
send("AT#VTX"); expect("CONNECT"); //voice transmit
/* send a small music file here */
expect(" VCON");
And most of sites that I searched says that the music file must have those properties: "PCM 8000Hz Mono 128kbps" ... Eventhough I have been tried on this task for many months, I have not succeeded in, yet :(
If you have any idea about solution and if you can help, this will really be helpful :) Thanks!
Similar Messages
-
Playing a WAVE file after making a phone call.
Hi everyone..
I'm trying to play a wav file after making a phone call. I was able to make the call. But I get an exception when i try to paly a wav file..
Can any one tell me where I've gone wrong..
This is the code which plays the audio file..(I downloaded it by the way.. and it's working fine when used as a seperate program)
import java.io.File;
import java.io.IOException;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.DataLine;
import javax.sound.sampled.FloatControl;
import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.SourceDataLine;
import javax.sound.sampled.UnsupportedAudioFileException;
public class PlayWave extends Thread {
private String filename;
private Position curPosition;
//30000000(7324.21 kb)
private final int EXTERNAL_BUFFER_SIZE = 524288; // 128Kb
enum Position {
LEFT, RIGHT, NORMAL
public PlayWave(String wavfile) {
filename = wavfile;
curPosition = Position.NORMAL;
public PlayWave(String wavfile, Position p) {
filename = wavfile;
curPosition = p;
public void run() {
File soundFile = new File(filename);
if (!soundFile.exists()) {
System.err.println("Wave file not found: " + filename);
return;
AudioInputStream audioInputStream = null;
try {
audioInputStream = AudioSystem.getAudioInputStream(soundFile);
} catch (UnsupportedAudioFileException e1) {
e1.printStackTrace();
return;
} catch (IOException e1) {
e1.printStackTrace();
return;
AudioFormat format = audioInputStream.getFormat();
SourceDataLine auline = null;
DataLine.Info info = new DataLine.Info(SourceDataLine.class, format);
try {
auline = (SourceDataLine) AudioSystem.getLine(info);
auline.open(format);
} catch (LineUnavailableException e) {
e.printStackTrace();
return;
} catch (Exception e) {
e.printStackTrace();
return;
if (auline.isControlSupported(FloatControl.Type.PAN)) {
FloatControl pan = (FloatControl) auline.getControl(FloatControl.Type.PAN);
if (curPosition == Position.RIGHT)
pan.setValue(1.0f);
else if (curPosition == Position.LEFT)
pan.setValue(-1.0f);
auline.start();
int nBytesRead = 0;
byte[] abData = new byte[EXTERNAL_BUFFER_SIZE];
try {
while (nBytesRead != -1) {
nBytesRead = audioInputStream.read(abData, 0, abData.length);
if (nBytesRead >= 0)
auline.write(abData, 0, nBytesRead);
} catch (IOException e) {
e.printStackTrace();
return;
} finally {
auline.drain();
auline.close();
}I inserted
new PlayWave("greeting.wav").start();In to a method an called this method in the program where i send commands to the modem.
These are my modem commands
send("ATZ");
expect("OK");
//Enable voice mode
send("AT+FCLASS=8");
expect("OK");
//Dial the number
send("ATDT"+number);
expect("OK");
//Choose encoding method //This is the default
send("AT+VSM=140,8000,0,0");
expect("OK");
// start sending audio data
send("AT+VTX");
expect("OK");
PlayAudio();
send("ATH");The size of my audio file is 100 kb.I'm using a 56 K intel externel voice modem connected to a serial port.I wonder if it's because the buffer is too big. If anyone tried this and succeded please correct me.
Thankyou in advance
goodnewsHi goodnews!
Did I understand well? Can You record the speech? This is what I want!
Can you help me and send me sample code?
This would be a big help for me!
Thank You!
rflair -
Hi folks,
I need to send sound files over a network. The files I'm wanting to send are wav files. I kinda have the mechanism that sends a file, but I am not sure how to convert wav files into something that I can easily send. Do I need to convert them into bytes, serialize them...etc I don't know.
Can anyone please point me in the right direction? An example would be very much appreciated.
Thank you,
Ehi
this is very simple
convert voice to bytearray
just create one server socket and client socket then connect a sockets and transmit
download sample from
http://javasolution.blogspot.com/2007/04/voice-chat-using-java.html -
How to send wav file to NI audio out
How do I send a wav file to the D/A Audio Out
of a 6071E.
A futher requirement is to send it out differentially
using channel 0 and 1
- Make Software User Friendly -I've attached an example to this posting. This example generates an analog output waveform on the board and channel specified. The waveform generated will be based on the WAV file selected. It is an example of the using a multifunction data acquisition board to play a WAV file on speakers.
Instructions:
1. Select the desired device and channel #.
2. Enter the path to your 8 bit mono WAV file. ( a sample WAV file is included in attachment below)
3. Enter the update rate for your Analog Output(AO) channel. This should equal the rate of your WAV file.
4. Wire your speakers to the Analog Output channel
5. Run it.
6. The program will continue to loop the WAV file waveform on the AO channel until you clickthe stop button.
How it works:
An 8 bit mono WA
V file is read from disk. After the data and header of the WAV file are extracted, the data is scaled from 0 to 1 V and then the entire waveform is written to the Analog Output channel specified. The example is set form continuous generation (or playback) and will continue looping the WAV files waveform until the stop button is pressed.
I hope this helps.
Regards,
Todd D.
NI Applications Engineer
Attachments:
WAV_File_to_AO_Channel.zip 30 KB -
Kind of a weird idea, but I'd like to see if it would be
possible to "assemble" a WAV file (using CF) from smaller WAV
files.
My idea: We report of the heights of rivers across the U.S.
(as in, at this moment, the Potomac River is 5.45 feet). I am able
to have people send in an email asking for a certain river, and CF
produces an email back to them with the river height (process runs
every 5 minutes).
But I thought of sending them back a voice (WAV) file to
their cell phones, so they could hear the river height instead of
using a text email. I thought if I could have a library of small
WAV files for each number, a "point", and some words, maybe I could
combine the needed pieces from multiple WAV files:
"Potomac" + "Height is" + "5" + "point" + "4" + "5" + "feet"
Somehow join those little WAV files into a single WAV file:
"Potomac height is 5 point 4 5 feet"
I can't believe CF could join these files, but if anyone has
any ideas, please let me know!
Thanks....Is there any shareware online that lets you merge wav files?
I would imagine you could string the phrases and send them to
the program
with <cfexec> or something, haven't looked into it
myself, but it sounds
like a interesting idea...
"Howard Perlman" <[email protected]> wrote
in message
news:f3h85b$jba$[email protected]..
> Kind of a weird idea, but I'd like to see if it would be
possible to
> "assemble"
> a WAV file (using CF) from smaller WAV files.
>
> My idea: We report of the heights of rivers across the
U.S. (as in, at
> this
> moment, the Potomac River is 5.45 feet). I am able to
have people send in
> an
> email asking for a certain river, and CF produces an
email back to them
> with
> the river height (process runs every 5 minutes).
>
> But I thought of sending them back a voice (WAV) file to
their cell
> phones, so
> they could hear the river height instead of using a text
email. I thought
> if I
> could have a library of small WAV files for each number,
a "point", and
> some
> words, maybe I could combine the needed pieces from
multiple WAV files:
> "Potomac" + "Height is" + "5" + "point" + "4" + "5" +
"feet"
>
> Somehow join those little WAV files into a single WAV
file:
> "Potomac height is 5 point 4 5 feet"
>
> I can't believe CF could join these files, but if anyone
has any ideas,
> please
> let me know!
> Thanks....
> -
.wav files not playing after upgrade to IOS 7.1
My company's email system sends .wav fils to our email. Since the upgrade to IOS 7.1, the .wav files are garbled and staticy. Anyone have any info on known bugs affecting .wav files?
thanksADd this to the ever growing list of issues with apple devices ( note the first two letters capitalized?).
i Can no longer play any downloaded .wav files either! And I've just restored my iPad, yadda, yadda!
IT won't be long now and my iPad will be totally useless! Honestly not a day goes by anymore where my ipad and phone don't give me some sort of trouble.
using safari it constantly locks up, resets my session , reboots the whole ipad, radio buttons on pages May or may not work and the list goes on!
i Recall a day when I used to tell people if they wanted an easy to use bullet proof computer that was handicapped ,but stable to buy Apple. That is no longer the case and even with the stringent controls Apple puts on developers of Apple apps, Apple is losing its appeal. Actually for me, that time has already come. Heck if I can't even use this $1000 device to do so,etching as simple as surf the web, then what good is it for anything? ( that was something spelt correctly twice).
GRrrr -
Any way to get project as a wav. file
I am trying to DL my songs to a digital distribution service that recommends sending wave files. Is there any way to save my GB projects as wav files, if not what would be the best format to save it in for export?
http://www.bulletsandbones.com/GB/GBFAQ.html#converttowav
(Let the page FULLY load. The link to your answer is at the top of your screen) -
E66 .wav file attachment download
On the E51 and E65 when an email attachment that is a .wav file was downloaded, the phone would allow playback immediately without saving or any other action. On the E66 as with the N95 the file comes up with the attachment but will not allow it to be immediately played. The only way that I have been able to figure out playing the attachemtn is to save it to the phone internally in "sound clips". I must then go to sound clips and play the file from there after downloading and saving. There must be a better wa to do this. Any help would be appreciated.
Hi Trung,
Try disabling plug-ins in Chrome and see if it works, if works you can pin-point out the exact plug-in causing the issue.
Type this in the chrome browser's address bar:
about:plugins
Reference:
Chrome: Attachments save as attachment.ashx and a number
Regards,
Satyajit
Please “Vote As Helpful”
if you find my contribution useful or “Mark As Answer” if it does answer your question. That will encourage me - and others - to take time out to help you. -
Java servlet to send audio file
Hi, I have used the example in this link http://www.java2s.com/Code/Java/Servlets/Sendmp3.htm to send a wav file to the client. I have changed the content type to audio/x-wav as I am sending a wav file not mp3 as in the example.
For some reason, it seems to send something back, but the audio file does not have any data in it (0 bytes). Eg try this link to see what happens: http://mel.our-lan.com/?=barcode50214561353872
The file browser opens up winamp/media player, but the file has no data in it. Can anybody see the problem in my code?:
String fileName = "";
while (rs.next())
fileName = rs.getString("SoundClip");
if (fileName == null || fileName.equals(""))
throw new ServletException(
"Invalid or non-existent file parameter in barcodeServlet.");
String wavDir = ("http://mel.our-lan.com/wav-dir/" + fileName);
/*getServletContext().getInitParameter("wav-dir");*/
if (wavDir == null || wavDir.equals(""))
throw new ServletException(
"Invalid or non-existent wavDir context-param.");
ServletOutputStream stream = null;
BufferedInputStream buf = null;
try
stream = response.getOutputStream();
File wav = new File(wavDir + "/" + fileName);
//set response headers
response.setContentType("audio/x-wav");
response.addHeader("Content-Disposition", "attachment; filename="
+ fileName);
response.setContentLength((int)wav.length());
FileInputStream input = new FileInputStream(wav);
byte[] buf1 = new byte[1024];
int len;
while ((len = input.read(buf1)) > 0)
stream.write(buf1, 0, len);
/* TRIED THE FOLLOWING ASWELL BUT SAME RESULT:
buf = new BufferedInputStream(input);
int readBytes = 0;
//read from the file; write to the ServletOutputStream
while ((readBytes = buf.read()) != -1)
stream.write(readBytes);*/
input.close();
catch (IOException ioe)
throw new ServletException(ioe.getMessage());
finally
if (stream != null)
stream.close();
if (buf != null)
buf.close();
}I tried the link; got the following:
java.lang.NullPointerException
BarcodeServlet.doPost(BarcodeServlet.java:23)
BarcodeServlet.doGet(BarcodeServlet.java:17)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)Take a look at this example, [1],might help you some.
[1] http://balusc.blogspot.com/2007/07/fileservlet.html
People on the forum help others voluntarily, it's not their job.
Help them help you.
Learn how to ask questions first: http://faq.javaranch.com/java/HowToAskQuestionsOnJavaRanch
(Yes I know it's on JavaRanch but I think it applies everywhere)
---------------------------------------------------------------- -
How do I play the .wav file google mail sends me on my Iphone 5?
I have cable phone service that sends out a .wav file of any voicemails I recieve to my e-mail account. I use google mail on my Iphone, and cannot play the .wav file that is attached to that e-mail. When I click on the "audio message box", it brings up a circle containing a south-west facing arrow which has a slash through it.
I have the latest software (6.1.4) and I can play the attachment if I go through "Mail" instead of "GMail". I am still not certain why I have a widget called "Mail".
Inside the "Mail" app, there are it's own Inbox, VIP, Flagged, etc which are all in color. Further down the list is my GMail boxes and sub-boxes. They are all grayed out, but still funtional.
Do I have something set up wrong causing me to be unable to play the .wav files that come to me through gmail? -
How to send a file from a java program to a servlet and get a response
Hi,
How can I call a servlet from a standalone java program and send a file to a servlet using POST method and in return gets the status back from the servlet. Any help is appreciated any small sample will help.
Thanks.Hi,
I am trying the following sample I got from net and am getting the following error. Any help what I am doing wrongs:
06/12/24 02:15:58 org.apache.commons.fileupload.FileUploadBase$InvalidContentTypeException: the request doesn't contain a multipart/form-data or multipart/mixed stream, content type header is null
06/12/24 02:15:58 at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:294)
06/12/24 02:15:58 at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:268)
06/12/24 02:15:58 at mypackage9.Servlet1.doPost(Servlet1.java:38)
06/12/24 02:15:58 at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
06/12/24 02:15:58 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
06/12/24 02:15:58 at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
06/12/24 02:15:58 at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
06/12/24 02:15:58 at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:663)
06/12/24 02:15:58 at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330)
06/12/24 02:15:58 at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:830)
06/12/24 02:15:58 at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:285)
06/12/24 02:15:58 at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:126)
06/12/24 02:15:58 at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
06/12/24 02:15:58 at java.lang.Thread.run(Thread.java:534)Here is the sample client code:
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.PostMethod;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
public class PostAFile {
private static String url =
"http://192.168.0.17:8988/Vulcan_Materials-ServletPost2-context-root/servlet/Servlet1";
public static void main(String[] args) throws IOException {
HttpClient client = new HttpClient();
PostMethod postMethod = new PostMethod(url);
client.setConnectionTimeout(8000);
File f = new File("C:\\load.txt");
System.out.println("File Length = " + f.length());
postMethod.setRequestBody(new FileInputStream(f));
int statusCode1 = client.executeMethod(postMethod);
System.out.println("statusLine>>>" + postMethod.getStatusLine());
postMethod.releaseConnection();
}Here is the sample servlet code:
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.PrintWriter;
import java.io.IOException;
import org.apache.commons.fileupload.DiskFileUpload;
import org.apache.commons.fileupload.FileItem;
import java.util.List;
import java.util.Iterator;
import java.io.File;
public class Servlet1 extends HttpServlet
private static final String CONTENT_TYPE = "text/html; charset=windows-1252";
public void init(ServletConfig config) throws ServletException
super.init(config);
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
try
response.setContentType(CONTENT_TYPE);
PrintWriter out = response.getWriter();
java.util.Enumeration e= request.getHeaderNames();
while (e.hasMoreElements()) {
String headerName=(String)e.nextElement();
System.out.println(headerName +" = "+request.getHeader(headerName));
//System.out.println("Content Type ="+request.getContentType());
DiskFileUpload fu = new DiskFileUpload();
// If file size exceeds, a FileUploadException will be thrown
fu.setSizeMax(1000000);
List fileItems = fu.parseRequest(request);
Iterator itr = fileItems.iterator();
System.out.println("***************************");
while(itr.hasNext()) {
FileItem fi = (FileItem)itr.next();
//Check if not form field so as to only handle the file inputs
//else condition handles the submit button input
if(!fi.isFormField())
System.out.println("\nNAME: "+fi.getName());
System.out.println("SIZE: "+fi.getSize());
//System.out.println(fi.getOutputStream().toString());
File fNew= new File("C:\\", fi.getName());
System.out.println(fNew.getAbsolutePath());
fi.write(fNew);
else
System.out.println("Field ="+fi.getFieldName());
out.println("SUCCESS123456: ");
out.close();
catch(Exception e)
e.printStackTrace();
}Any help on what is wrong.
Thanks -
How do I set up my phone to send a file to print from my iphone 5 to my Samsung CLX-4195FW printer?
Read the printer manual.
-
I need an equipment with an entry USB port to send a wav file and exit I & Q
We are working with an equipment consisted in a transmitter and a receiver.At the end we have 2 computers,we are trying to send a wav file through USB port from one computer and converted to I & Q signal (that supports our transmitter).
On the other end we have to convert from I & Q signals to a signal who can interprete the USB port.
Our ask is if exists an equipment which could do these two fuctions.
Thanks a lot.
Attachments:
national.doc 34 KBWe have data acquisition (DAQ) devices that have a USB interface. You could send a .wav file to an analog output of a USB-DAQ device and you could acquire an analog signal (with analog inputs on a USB-DAQ device) and write that to a .wav file with another USB-DAQ device.
What is an I&Q signal? You need to give more information on what what characteristics are needed for a signal to be I&Q. I have included a link below to a USB-DAQ device within our on-line catalog for you to take a look at.
NI DAQPad-6020E for USB
http://sine.ni.com/apps/we/nioc.vp?lang=&cid=11922
Regards,
Todd D.
Applications Engineer
National Instruments -
How can i send a PDF file to my i phone and be able to read it
How can i send a PDF file to my i phone and be able to read it
Use the free Adobe Reader for iPhone -> https://itunes.apple.com/us/app/adobe-reader/id469337564?mt=8.
Clinton -
I have to send large files like 5MB or biger via mobile phone, but in that cases phone is telling mi to plug in power. And when I do that, there is no problem to send the file. For smaller files there is no problem. How can I solve the problem? Because when I'm not at home I can't plug in the power.
hi,
I am sending file from server to client i.e client will request for a file and service will send it back....... no socket connection is there...I am using JBOSS and apache axis.
pls help me out.....
Rashi
Maybe you are looking for
-
How to find out the aligning Data dictionary table for a structure.
Hi As the table controls are associated with strucures, the data input goes to the data dictionary table aligned to that structure. Is there any way we can find out the table related to that particular structure ? Thanks, Dhareppa
-
How can I add/edit a category to multiple contacts at once?
I have a few lists created in Thunderbird which I'd like to access for other purposes via categories. How can I edit several contacts all part of a list to assign/edit categories at once?
-
Mail Merge problem with Word 2007
I recently replaced my laptop and installed Office 2007. When I try to create mailing labels, it is only merging the first three labels and those are not formatted correctly or even consistently. It seems like a compatibility problem, but my excel
-
Ref Cursor from PL/SQL Table
I'm building a complex report in which the information cames from a lot of tables and needs complex formatting. I'd like to base my report in a table returned by a stored procedure (like you can do in Forms). Is there any way to convert an PL/SQL tab
-
Export Release Build/Standard Edition
Hi- Is the Export Release Build feature available in Flash Builder 4 - Standard Edition? Thanks, Dave