Friday, June 13, 2008

Java - Passing string with spaces to exec

While using Runtime.getRuntime().exec in Java

To pass the string with spaces in the argument we need to use exec(String[]) method instead of exec(String)

Both of the above command execute the specified command and arguments in a separate process.

If we will use exec(String) then this will not take string with spaces.

Labels:

Post a Comment(0 comments)

Sunday, April 6, 2008

Audio Recording in browser

I have researched and found various options to do sound recording. Here are the details about each option:

Flash Audio Recording

Requirement:
Server
Flash Media Server - http://www.adobe.com/products/flashmediaserver/
Nelly2PCM Decoder - http://code.google.com/p/nelly2pcm/

Client
Flash player

1. Flash Audio/Video(or both) recording works on client server architecture. Client is the Flash player on the client browser whereas server is the Flash Media Server.
2. Client streams the live audio/video(or both) to the FMS server.
3. FMS server can record the streaming and store it in the *.flv type file.
4. FMS internally use Nellymoser(audio/video encoding technique) to encode stream to the FLV file.
5. Once the FLV file is located on the server then you will need a decoder to converted flv to MP3(in our case). Nellymoser provides decoder for $7500(which is too expensive in open source market).
6. I tried some more of the flv to mp3 convertor to convert the nellymoser flv to mp3 but had no luck initially.
7. One of the conversion program that worked creating AMR from nellymore encoding flv file was Total Video Convertor. I used GUI tool to convert flv to AMR. They have command line utility available for $350. http://www.effectmatrix.com/total-video-converter/
8. Finally I found this, Nelly2PCM convertor http://code.google.com/p/nelly2pcm/downloads/list which was able to convert FLV file generated by FLASH to PCM. JACKPOT !!
9. I converted flv to PCM and now PCM to WAV to MP3 using SOX and LAME.
10. Now I know the route to complete the flash recording using all above steps, I just need to code it for our need.


Red5 (Open Source Flash Server) -http://osflash.org/red5
Another option to do the same job without using ADOBE flash was RED5. It does the same job of FLASH MEDIA SERVER. The good part is it is open source . That means streaming and recording streaming data to FLV file. Although it also generate the streaming data to FLV only.
I didn't tried this server yet.

ViMas Technology (Mp3 Recording) using Java Applets http://www.vimas.com/index.php
Requirements
Server-
Java
JAVA applet object

Client
Java
JavaScript to communicate with server object

1. This thing works perfectly on different browser and platform including mac and pc
It support
Target OS Platform: Windows 98/NT/2000/ME/XP/2003, Mac OS X.
Target browsers: Windows: Microsoft IE 4.0 and up, Netscape 7, Opera, Mozilla, Firefox.
Mac : Safari, Opera.
Java versions: Microsoft Java 1.1 and Sun Java plug-in 1.4 -1.6.
2. It can generate MP3 directly and can upload to a server. It can also be used to store it on the local hard drive.
3. The only limitation is JAVA in this case.
4. This is a ready to use solution if we want to start recording from web.
5. We can use there demo version which currently allow 20 sec of recording. Otherwise they are priced at $399

MFC Application
1. I created an MFC app that can record sound on the desktop.
2. It can record the sound from the local computer microphone.
3. It currently stores the file to the local machine in WAV format.
4. But in next update we can make it upload to the server.
5. Once done then we can make it as a browser plugin to record sound.


By the way, I also learned about Ogg Vorbis format which an open source royalty free formats used to store and play digital music.
http://www.vorbis.com/faq/#what

Labels: ,

Post a Comment(0 comments)