?
Solved

Convert WAV to MP3 in J2ME or other compressed format!!!

Posted on 2003-03-21
7
Medium Priority
?
1,495 Views
Last Modified: 2009-07-29
Hi all,

I have created an audio capture player within my MIDlet using:

player = Manager.createPlayer("capture://audio");

I am then recording using the RecordControl object that is obtainable from the player. As default it is recording using a sample rate of 44khz. This creates very large *.wav files. (is itr possible to change this sample rate?)

These files are too large and i need them to be smaller, therefore i need to compress them, possibly into MP3.

(Average wav size = 2meg, required file size less than 400k)

Either that or something smaller, which i can then make back into a WAVE at my ASP Side.

Has anybody solved this problem before.

Help will be very greatfully appreciated.

Thanks

Rashel
0
Comment
Question by:Rashimus
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
7 Comments
 

Expert Comment

by:schalow
ID: 8212888
Should your OEM device *always* default to a high format rate use this function:

private RateControl getRateControl()
{
   return (RateControl) player.getControl("RateControl");
}

then try and set the rate against the capture player...

RateControl rtc = getRateControl();
rtc.setRate(int rate);


Works well with my large-scale TTS/Reco implementation processing many-to-many formats for devices that support WAV, AU, GSM, MP3 in conjunction w/back-end services.  (Also works via JMF and applets for J2SE/JDK1.1.)  For more on this, here's an article (incl. function models) for a media brokering approach I wrote published at the Australian Developer's Magazine this year (should be in the U.S. at WDJ soon):

http://developer.net.au/features/articles/article+j2me+media+for+the+enterprise1.asp

Hope this helps.

Dale Schalow
AMN Corporation (USA)
+1 301.496.5120
dale@a-m-n.com
http://a-m-n.com


0
 

Author Comment

by:Rashimus
ID: 8213715
Hi,

As i am using "capture://audio" as the player type, when i try and get a RateControl from it, it is null.

Will i be able to get this RateControl a different way or will i be able to set the rate via my RecordControl.

Thanks.
0
 

Expert Comment

by:schalow
ID: 8217492
From an audio engineering perspective, you can do some interesting things with rate control in general.  For the JSR's MIDP spec. work RateControl (interface) was probably viewed more as a precise way to toggle "player rate" of a stream.  For that matter, pitch control (I believe the PitchControl interface class) can also bend frequencies for audio samples & MIDI as such (Hey, it sounds like Mickey Mouse -or- Hey, it sounds like it's in slow-motion).  More like adjusting "player speed"... In any event, setting a rate can also shape sound based from its sample rate.

Nothing *documented* for RecordControl indicates an easy approach for setting a capture sampling rate (but hey, it's an interface so anything's possible, right?).

My tests have revealed mostly 22kHz in emulation and below for OEM devices. Since I'm assuming you're using an Emulator (or maybe not) here's some recent MIDP 2.0 info regarding emulation support for all audio formats (ref. <WTK 2.0 home>\docs\BasicCustomizationGuide_HTML\ch_creating-property-files.html):

=============

The Emulator supports all sound file formats currently supported by JDK1.4:

Audio file formats: AIFF, AU and WAV
Music file formats: MIDI Type 0, MIDI Type 1, and Rich Music Format (RMF)
Sound formats: 8-bit and 16-bit audio data, in mono and stereo, with sample rates from 8 kHz to 48 kHz
Linear, A-law, and mu-law encoded data in any of the supported audio file formats

=============

To incorporate MP3 you'll need to address at a codec level (i.e. covert from PCM/Wav).  I seem to recall a WTK I looked at a couple months ago that delivered JMF with it most likely for these purposes (among others).  JMFRegistry can give you more info on this.

Dale

Dale Schalow
AMN Corporation (USA)
+1 301.496.5120
dale@a-m-n.com
http://a-m-n.com
0
 

Accepted Solution

by:
schalow earned 940 total points
ID: 8256652
...Okay, let's try to make this a little 'easier' on you.

(Ref. javax.microedition.media.Manager):

"capture://" device [ "?" params]

Ex.

capture://audio (default audio)
capture://audio?encoding=pcm (default audio in PCM format)
capture://devmic0?encoding=pcm&rate=11025&bits=16&channels=1 (audio from a specific device--devmic0)

...

Dale Schalow
AMN Corporation (USA)
+1 301.496.5120
dale@a-m-n.com
http://a-m-n.com 
     
0

Featured Post

Optimum High-Definition Video Viewing and Control

The ATEN VM0404HA 4x4 4K HDMI Matrix Switch supports 4K resolutions of UHD (3840 x 2160) and DCI (4096 x 2160) with refresh rates of 30 Hz (4:4:4) and 60 Hz (4:2:0). It is ideal for applications where the routing of 4K digital signals is required.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

MAC Filtering: MAC filtering is like handing a list of names to a doorman. If someone comes to the door and mentions a name, this name is checked by the doorman on his list and granted or denied access by this. This means that if someone menti…
This program is used to assist in finding and resolving common problems with wireless connections.
This Micro Tutorial will show you how to maximize your wireless card to its maximum capability. This will be demonstrated using Intel(R) Centrino(R) Wireless-N 2230 wireless card on Windows 8 operating system.
Viewers will learn how to connect to a wireless network using the network security key. They will also learn how to access the IP address and DNS server for connections that must be done manually. After setting up a router, find the network security…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question