Hi all i'm developing an app for audio recording.
So i used the MediaRecorder class to record. Unfortunately this class hasn't got the pause method so i can just start or stop.
How can i pause the recorder?
For example i'd like to do something like this:
press rec button to start recording
press pause button
press rec button to continue recording...
press stop to save and exit.
ps: I'd like to save the output file as amr or 3gp.
Any idea?
Up
Sent from my HTC HD2 using XDA App
it doesnt appear to be possible with the api's provided by the MediaRecorder class. the way you would have to do it with a MediaRecorder is to record multiple files and then merge them into one audio file. i was thinking that you could append to the file using a file descriptor but then i realized that its not just a plain text file. its an audio file with headers and a complex compressed format and just appending another audio file on the end would do nothing. here are some links
http://stackoverflow.com/questions/5190967/how-to-pause-capturing-video-in-android
http://stackoverflow.com/questions/5743165/pause-and-resume-audio-recording-in-android
http://www.benmccann.com/dev-blog/android-audio-recording-tutorial/
this is a tough one.
ps: I'd like to save the output file as amr or 3gp.
Click to expand...
Click to collapse
this one isnt... =)
setOutputFormat(int outPutFormat);
where outPutFormat can be these values:
---------------------------------------------
int AMR_NB AMR NB file format
int AMR_WB AMR WB file format
int DEFAULT
int MPEG_4 MPEG4 media file format
int RAW_AMR AMR NB file format
int THREE_GPP 3GPP media file format
Related
Hi
Edited a WAV file and stored in my storage card. It plays OK in my XDA2 but when I tried to use it as a ringtone for the phone, it does not play any sound other than some clicking noises.
Please help.
make sure your wav is PCM.. xda II doesnt support all formats of wav.
mephistodan said:
make sure your wav is PCM.. xda II doesnt support all formats of wav.
Click to expand...
Click to collapse
Is there a utility to convert this to PCM WAV format? Thanks.
To convert WAV file so will play on XDA2, use the windows utility Sound Recorder: sndrec32.exe
Open the wav file in Sound Recorder.
Click File -> Properties
Click Convert Now button
Change Format combo to 'PCM'
Change Attributes combo to 11.025KHz, 8 Bit, Mono
You don't really need more than that as XDA2 doesn't play stereo.
Hi,
I have MDA compact, and want to know is it possible to use mp3 or any song file as a ringtone.
If so, then how can i do this.
Please !!
Thanks
i think it is possible, i tried this in my i mate pda2k try it and tell us the result.
first use rescue registry which usually comes with rescue explorer then open HKEY_CLASSES_ROOT THEN MP3 THEN DEFAULT THEN CHANGE MP3FILE IN THE SECOND SQUARE TO BE WMAFILE THEN OK
PUT THE MP3 RING TONE IN FOLDER WINDOWS\RINGS
THEN TRY TO MAKE IT RING TONE
THX
MP3 as a ringtone
use this file and you have in the explorer-popupmenu the option "set as ringrone"
woolies said:
Hi,
I have MDA compact, and want to know is it possible to use mp3 or any song file as a ringtone.
If so, then how can i do this.
Please !!
Thanks
Click to expand...
Click to collapse
It is very easy and simple.
Copy your mp3 to My Device>Windows>Rings folder
Then go Start>Settings>Phone and select it as a ringtone.
I have MDA compact, and want to know is it possible to use mp3 or any song file as a ringtone.
Click to expand...
Click to collapse
Yes it is! The easiest way to do that is copying the desired mp3 file to the folder \Windows\Rings, than you can choose it as ring tone in the same way as the preinstalled tones (it appears in the same list).
If you like to have the "Set as ring tone" entry in the explorer context menu also for mp3 files (and not only for midi, mp4 and wma) do not the following registry change:
i think it is possible, i tried this in my i mate pda2k try it and tell us the result.
first use rescue registry which usually comes with rescue explorer then open HKEY_CLASSES_ROOT THEN MP3 THEN DEFAULT THEN CHANGE MP3FILE IN THE SECOND SQUARE TO BE WMAFILE THEN OK
PUT THE MP3 RING TONE IN FOLDER WINDOWS\RINGS
THEN TRY TO MAKE IT RING TONE
THX
Click to expand...
Click to collapse
First: if you want to copy and choose the file manually, you don't need to change anything in the registry!
But if you change the linked file type from MP3File to WMAFile, you are telling the system that .mp3 is a wma file (and that is definitely wrong). That works as long as the system has under \\\registry\HKCR\MP3File and \\\registry\HKCR\WMAFile equal entries for the used software to handle those files. But it's never a good idea to map different file extensions to the same file type except all these extension are synonyms and belongs to the same type of data (like .htm and .html). As soon as a user installs different players for wma and mp3 he will get into trouble.
So instead of mapping .mp3 to the type WMAFile it will be much better to add the missing context handler entry to the file type MP3File in the registry . (Only the entry is missing, the handler exists, we can use the one which is already used for wma, mp4 and midi, see below)
So lets have a look to \\\registry\HKCR\midifile\Shellext, \\\registry\HKCR\mp4file\Shellext, \\\registry\HKCR\wavfile\Shellext, \\\registry\HKCR\WMAFile\Shellext and \\\registry\HKCR\MP3File\Shellext and see:
the first 4 have a key named ContextMenuHandlers and all refer to the same handler, but there is no key named ContextMenuHandlers in \\\registry\HKCR\MP3File\Shellext. So copy (not move!) \\\registry\HKCR\WMAFile\Shellext\ContextMenuHandlers completely (with all subkeys) to \\\registry\HKCR\MP3File\Shellext and you have will have the "Set as ring tone" entry in the explorer context menu of a .mp3 file too (and not only for .wma, .wav, .mp4 and .mid files). And you preserve the possibility to link different players to .mp3 and to .wma files.
And don't be afraid, the context handler for "Set as ring tone" for wma is the same as for wave, midi and for mp4 so it will work well with mp3 files too because it doesn't care about the file content. It does nothing more than copy the file to the folder \Windows\Rings. (Ok, the message box is telling that the file also has been set as new ring tone, but on my Magician that is not true, it is still the previous tone active and I have to choose it manually)
use this file and you have in the explorer-popupmenu the option "set as ringrone"
Click to expand...
Click to collapse
That also creates the missing key but installs an additional handler and refers to it. I believe that these 100kBytes can be used better for other thing. As long as you are happy whith the way the systems handles .wma files (as ring tones) you can use the same handler for .mp3 files too and there is no need for an special "ring tone" handler for .mp3 files. But if you are afraid of modifying your registry but really want the context entry than this cab file is better than nothing.
Joe
I'm trying to set HTCAlbum as standard video file viewer (at least for mp4 files) in order to get its acceleration features and view files from any location.
I changed HKEY_CLASSES_ROOT\mp4file\Shell\Open\Command
to
\Windows\HTCAlbum.exe -mode:gizmo "%1"
But the parameter "-mode:gizmo" is not passed to HTCAlbum...
Anyone has an idea on how to pass a parameter via registry file association? The parameter is correct, tried with a link like this:
"\Windows\HTCAlbum.exe -mode:gizmo [fullpathtomp4file]" and it worked...
Thanks!
try \Windows\HTCAlbum.exe "%1"
ravest, thaks for the reply!
Unfortunately I need to pass the "-mode:gizmo" parameter otherwise HTCAlbum only starts in thumbnail mode... and I cannot open files outside its default dir...
Also this parameter starts immediately the video playback in fullscreen....
i thought it may be with an intent but can't find anything, nor can i find anything in the mediaplayer class, but what do i have to do to trigger the stock music player and do i have to pass in a filename as the param?
mhh, something like:
Code:
Uri data = Uri.parse("file://" + mf1.getFilename());
MediaPlayer mp = android.media.MediaPlayer.create(this, data);
mp.start();
will only trigger it as a background process, not switch to it. and an intent view seems to launch a mini player inside the app, so how do i switch to the music player?
http://forum.xda-developers.com/showpost.php?p=13036528&postcount=4
Note: TouchWiz has it's own DB for music for Samsung phones, so you know, we hate them (and the second method may/maynot work on TouchWiz phones).
thanks, i need to get my head around querying the content provider now!
I have an Online Radio App and would like to add some sort of recording feature on it. I have done quite a bit of research and found one solution and from what I understand maybe the only solution is to rip it byte by byte. I have also tried to use the built in android recording method but it only records from the mic and I do not know or cannot figure out how to record from an external source such as a url like http://92.68.34.221:7000. Currently I am using the default Android media player method to play the url and its working flawlessly problem is I would like to set up the recording feature as a service to where when a the button is clicked run the service start recording and when it is clicked again terminate the service and save the file in a folder called online radio. Button might end up being a ToggleButton. I would really appreciate it if anyone could help me out and steer me in the right direction. Thanks in Advance
Saving a stream to file is quite easy, but if you want to define the exact start and end point of saving/recording by a button click it gets difficult.
You'll have to change your implementation a lot. Your android mediaplayer class handles everything for you, it opens the stream, fills a buffer and starts playing when the buffer is full. The mediaplayer doesn't offer any access to the bytes that it received.
Next problem: If you click on the button to start recording, the bytes you are listening to, have been in the (internal) buffer for an unknown amount of time. So you can't just open another connection to the stream url to start saving the bytes.
I would try it this way:
Implement these three parts in three different threads.
1. Use android.media.MediaExtractor to open the stream and implement a ringbuffer to store the extracted bytes
2. Use android.media.MediaCodec to decode your stream to pcm.
3. And use android.media.AudioTrack to play the pcm stream
Choose the size of the ringbuffer as large as the buffer of the AudioTrack. (Size in seconds, not in bytes!)
When the user clicks on the record button, you can read the data out of the ringbuffer, (encode them back to mp3 or something else) and save them to a file.
Not very easy for a beginner, but its a way you can do it.