Windows Phone Thoughts - Daily News, Views, Rants and Raves

Check out the hottest Windows Mobile devices at our Expansys store!


Digital Home Thoughts

Loading feed...

Laptop Thoughts

Loading feed...

Android Thoughts

Loading feed...




Go Back   Thoughts Media Forums > WINDOWS PHONE THOUGHTS > Windows Phone Software

Reply
 
Thread Tools Display Modes
  #1  
Old 06-24-2005, 01:04 PM
Menneisyys
5000+ Posts? I Should OWN This Site!
Join Date: Jun 2007
Posts: 5,067
Default AT LAST: Extracting embedded sound (WAV) files from Pocket Notes (PWI) files!

ActiveSync has always been unable to extract embedded sound files from Notes (.PWI) files, causing a lot of problems to people using this way to create notes with embedded voice notes - the embedded voice notes couldn't be played off your dekstop computer. Also, up to now, there has been a complete lack of an app doing this.

I've published the algorithm to extract these files from PWI files a long time ago (see for example this and this). So far, however, I hadn't the time to actually code, test with various JVM's (including Pocket PC JVM's) and document an actual utility that makes this possible.

Now that I had some free hours today, the waiting is over

The source code is pretty straightforward:

Code:
import java.io.*;

class PWIEmbeddedWAVExport
{
public static void main(String[] s) throws Exception
{
	FileInputStream fis = new FileInputStream (s[0]);
	File f = new File (s[0]);
	int fileSize = (int)f.length();
	byte[] barr = new byte[fileSize];
	byte[] barr2 = new byte[fileSize/2];
	int readCount = fis.read(barr);
	for (int i=0; i<fileSize/2; i++)
	  barr2[i]=barr[i*2];
	String str = new String(barr2);
	java.util.Vector indeces = new java.util.Vector();
	int lastIndexFound = 0; 
	while ((lastIndexFound = str.indexOf("VoiceNote.wav", lastIndexFound+1)) != -1)
			indeces.addElement(new Integer(lastIndexFound*2));
	// now, we have the exact position of all VoiceNote.wav's in the file; 
	// we can go on for the actual extraction
	int sumSize = 0;
	for (int i=0; i<indeces.size(); i++)
	{
		int embFileStartsAt = ((Integer)indeces.elementAt(i)).intValue()+ "VoiceNote.wav".length()*2-2 + 4146 + 4;
		int embFileEndsAt = readCount;
		if (i<indeces.size()-1) embFileEndsAt = ((Integer)indeces.elementAt(i+1)).intValue() - 528;
		FileOutputStream fos = new FileOutputStream (s[0].substring(0, s[0].length()-4)+(indeces.size()-i)+".wav"); 
		// indeces.size()-i is needed because of the LIFO order in the file
		fos.write(barr, embFileStartsAt, embFileEndsAt-embFileStartsAt);
		fos.flush();
		fos.close();
	}
	fis.close();
 } // main
}// class
Feel free to compile (preferably with JDK1.1 if you need 100% compliance with all of the PPC JVM's - please note that I deliberately made it JDK1.1-compliant for the best compliance with current PPC JVM's) and JAR it. To make your life easier, you can also download it from here.

On the desktop, put it in the classpath and issue the

java -jar PWIEmbeddedWAVExport.jar <PWI name>

command. The extracted sound files will be created in the current directory.

If you plan to do the extraction on the PDA so that you don't need to have access to any desktop computer, you can use any of the following four JVM's (others may also work): NetFront 3.1+, CrEme, Jeode, J9 PJava. Please read this thread for more information on getting them if you don't have any of them (not even the Java-enabled Netfront - perhaps this is the best solution because you may already have it on your Pocket PC, which makes it unnecessary to install another JVM.

To run the converter on the PDA, make a directory in it with the name, say, \conv in there. Copy the JAR file and one of the following batch files (I've also listed their contents here).

NetFront jvlite (tested with NF 3.1):

"\Program Files\NetFront3\jvlite.exe" -classpath \conv\PWIEmbeddedWAVExport.jar PWIEmbeddedWAVExport %1

CrEme 3.x/4.x (tested with 3.26):

"\SD-MMCard\creme\bin\CrEme.exe" -Ob -classpath \conv\PWIEmbeddedWAVExport.jar PWIEmbeddedWAVExport %1

Jeode (tested with 1.7.3):

\SD-MMCard\jeode\evm.exe -Djeode.evm.console.local.keep=true -cp \conv\PWIEmbeddedWAVExport.jar PWIEmbeddedWAVExport %1

IBM J9 PJ (tested with 5.7.2):

"\SD-MMCard\IBM PPRO10\bin\J9.exe" "-jclpro10" -cp \conv\PWIEmbeddedWAVExport.jar PWIEmbeddedWAVExport %1

Please modify the path to the executable according to the directory your JVM/NetFront is installed to!

The next step is installing PPC Command Shell - please see my post on doing this here (second page, third post) - to provide a console to run batch files to avoid the need for editing link files with wired-in filenames.

After installing it, fire up the console and go to \conv. Assuming you've already copied here the .BAT batch file(s) you want to invoke your JVM('s) with, PWIEmbeddedWAVExport.jar and the source PWI file(s), you can start working right away by issuing the <batchname> \conv\<PWI name> command. (Note that you need to supply the full directory path, here, \conv to the JVM so that it finds the input file.) The embedded WAV files will be created in the same directory.

I may rewrite/repackage this app using the CF framework some day (but not in the very near future!).
 
Reply With Quote
  #2  
Old 07-10-2005, 04:02 PM
Menneisyys
5000+ Posts? I Should OWN This Site!
Join Date: Jun 2007
Posts: 5,067
Default Re: AT LAST: Extracting embedded sound (WAV) files from Pocket Notes (PWI) files!

Quote:
Originally Posted by Menneisyys
I may rewrite/repackage this app using the CF framework some day (but not in the very near future!).
Yes! It's here!

The Pocket PC version can be found here, while the PC version can be found here. Both require the CF framework, which is installed by default on all WM2003+ devices.

Tested on both an iPAQ 2210 and a Pocket Loox 720 (and, of course, the PC version on the desktop); works flawlessly.

Using on the Pocket PC:

1, download the ZIP file

2, extract the CAB file meant for your device. For example, all WM2003+ users should extract PWI_Embedded_Sound_Extractor_ARMV4.CAB. Transfer it to your PDA.

3, start File Explorer on your PDA and click the CAB file. Alternatively, you can use CabInstl or other tools like FileDialogChanger to install it on a storage card.

4, start the application (it doesn't have any fancy icon - just look for the name PWISoundExtractor). You'll be presented the following screen:




5, As instructed, click ĎConvert!í and, on the next screen, just click on a PWI file that contains embedded sound files. The app will extract the files and tells you how many of them there were and into what directory it extracted them.

The PC version is similar but it lacks error detection (which isnít a problem if you donít pass it files that donít have embedded sound files etc) and has a slightly different GUI (I didnít have the time to synchronize the two GUIís.) It works the same way: it puts the extracted files into the same directory as the input file.
 
Reply With Quote
  #3  
Old 07-10-2005, 06:50 PM
Sven Johannsen
Editorial Contributor
Sven Johannsen's Avatar
Join Date: Jun 2007
Posts: 5,411

Cool. Checked it out and works as advertised. Tried both the PPC and PC version. To bad you didn't do this 4-5 years ago. I remember an empasioned plea from a new father that had recorded his baby's first moments, and couldn't get the darn wav out of the note. It was back in the early days of the Jornada, and I don't think we ever figured out how short of playing it out the headset jack and recording it with something else.

Great job, man.

P.S. You need an icon
__________________
Sometimes you are the anteater, sometimes you are the ant.
 
Reply With Quote
  #4  
Old 07-10-2005, 07:00 PM
Menneisyys
5000+ Posts? I Should OWN This Site!
Join Date: Jun 2007
Posts: 5,067

BTW, I've also uploaded the sources of the PPC version (the PC version is a bit older and has no error handling, so, I've chosen to make the PPC sources available) at http://winmobiletech.com/062005PWIEm...rt/PPC/src.rar .

Feel free to experiment with it
 
Reply With Quote
  #5  
Old 07-10-2005, 07:01 PM
Menneisyys
5000+ Posts? I Should OWN This Site!
Join Date: Jun 2007
Posts: 5,067

Quote:
Originally Posted by Sven
Cool. Checked it out and works as advertised. Tried both the PPC and PC version. [...]

Great job, man.

P.S. You need an icon
Thanks
 
Reply With Quote
  #6  
Old 01-02-2006, 12:43 PM
pocketpcadmirer
Sage
pocketpcadmirer's Avatar
Join Date: Jan 2006
Posts: 805

Hey thanks Menneisyys..I've been looking for such an app for soooooooo long

Sunny
__________________
Windows Phone help
 
Reply With Quote
  #7  
Old 01-03-2006, 05:40 AM
ctmagnus
5000+ Posts? I Should OWN This Site!
ctmagnus's Avatar
Join Date: Aug 2006
Posts: 5,616

If you use OneNote on your desktop, you can import Outlook's notes into it and any embedded sounds in Outlook's notes will come across as wma files in the My Documents\My Notebook folder on the desktop end.
__________________
iPhone 4! ☠☠☠ Mid-2010 15" MacBook Pro! ☠☠☠ Gateway LT2102h! ☠☠☠ Dell XPS M1210!
 
Reply With Quote
  #8  
Old 01-05-2006, 11:52 AM
Johnathan
Pupil
Join Date: Apr 2004
Posts: 33
Send a message via ICQ to Johnathan Send a message via MSN to Johnathan

thanks Menneisyys.. :wink:
 
Reply With Quote
  #9  
Old 07-14-2006, 05:32 PM
lyfoster99
Neophyte
Join Date: Jul 2006
Posts: 2
Default Can you translate this for a novice?

I recorded some audio using the notes feature on my Dell Axim x50. I copied the file to my PC and want to share it via e-mail. It is a .wpi file and I can't figure out how to play it on my pc.

Your post sounds like it will do exactly what I want, but I am not savvy enough to know how to use your information. I downloaded the PWIembeddedWAVExport.run file to my PDA, but when I try to open it it says there is no application associated with it and to run the application first. What application?

My second question is to avoid this in the future, how do I save audio notes as a .wav instead of a .pwi file type?

Thanks so much. What I want to share is audio of my 2 year old singing, so I can't exactly re-create it and I'd liek to share with out of town family. Thanks for your help.
 
Reply With Quote
  #10  
Old 07-14-2006, 05:38 PM
Menneisyys
5000+ Posts? I Should OWN This Site!
Join Date: Jun 2007
Posts: 5,067
Default Re: Can you translate this for a novice?

Quote:
Originally Posted by lyfoster99
I recorded some audio using the notes feature on my Dell Axim x50. I copied the file to my PC and want to share it via e-mail. It is a .wpi file and I can't figure out how to play it on my pc.

Your post sounds like it will do exactly what I want, but I am not savvy enough to know how to use your information. I downloaded the PWIembeddedWAVExport.run file to my PDA, but when I try to open it it says there is no application associated with it and to run the application first. What application?

My second question is to avoid this in the future, how do I save audio notes as a .wav instead of a .pwi file type?

Thanks so much. What I want to share is audio of my 2 year old singing, so I can't exactly re-create it and I'd liek to share with out of town family. Thanks for your help.
Welcome to PPCT

1. Did you download the PC version ( http://winmobiletech.com/062005PWIEm...undExtract.exe )?

2. to record straight into WAV files, make sure you allow for displaying the Recording toolbar in Notes. That is,

on pre-WM5 OS'es, click the casette icon next to Tools
on WM5, go to Menu and click View Recording Toolbar

Make sur eyou do this in the List view.

Then, you'll be able to record into individual WAV files.
 
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:55 AM.