View Full Version : AT LAST: Extracting embedded sound (WAV) files from Pocket Notes (PWI) files!
Menneisyys
06-24-2005, 01:04 PM
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 (http://www.pocketpcthoughts.com/forums/viewtopic.php?t=36508&highlight=voicenote+wav) and this (http://pocketpcmag.com/forum/topic.asp?TOPIC_ID=14211)). 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:
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 (http://www.winmobiletech.com/062005PWIEmbeddedWAVExport/PWIEmbeddedWAVExport.jar).
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 (http://www.pocketpcthoughts.com/index.php?action=expand,40880) 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): (http://www.winmobiletech.com/062005PWIEmbeddedWAVExport/NF.bat)
"\Program Files\NetFront3\jvlite.exe" -classpath \conv\PWIEmbeddedWAVExport.jar PWIEmbeddedWAVExport %1
CrEme 3.x/4.x (tested with 3.26): (http://www.winmobiletech.com/062005PWIEmbeddedWAVExport/CrEme.bat)
"\SD-MMCard\creme\bin\CrEme.exe" -Ob -classpath \conv\PWIEmbeddedWAVExport.jar PWIEmbeddedWAVExport %1
Jeode (tested with 1.7.3): (http://www.winmobiletech.com/062005PWIEmbeddedWAVExport/Jeode.bat)
\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): (http://www.winmobiletech.com/062005PWIEmbeddedWAVExport/J9.bat)
"\SD-MMCard\IBM PPRO10\bin\J9.exe" "-jcl:ppro10" -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 (http://www.pocketpcthoughts.com/index.php?action=expand,40880) (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!).
Menneisyys
07-10-2005, 04:02 PM
I may rewrite/repackage this app using the CF framework some day (but not in the very near future!).
Yes! It's here! :D
The Pocket PC version can be found here (http://winmobiletech.com/062005PWIEmbeddedWAVExport/PPC/PWI_Embedded_Sound_Extractor.zip), while the PC version can be found here (http://winmobiletech.com/062005PWIEmbeddedWAVExport/PC/PWISoundExtract.exe). 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 (http://winmobiletech.com/062005PWIEmbeddedWAVExport/PPC/PWI_Embedded_Sound_Extractor.zip)
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 (http://www.vancouverpocketpc.com/CAB_installation_tweak.html) 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:
http://winmobiletech.com/062005PWIEmbeddedWAVExport/PWIEmbSoundExtract-1.gif
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.
Sven Johannsen
07-10-2005, 06:50 PM
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 ;)
Menneisyys
07-10-2005, 07:00 PM
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/062005PWIEmbeddedWAVExport/PPC/src.rar .
Feel free to experiment with it :)
Menneisyys
07-10-2005, 07:01 PM
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 :)
pocketpcadmirer
01-02-2006, 12:43 PM
Hey thanks Menneisyys..I've been looking for such an app for soooooooo long :D
Sunny
ctmagnus
01-03-2006, 05:40 AM
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.
Johnathan
01-05-2006, 11:52 AM
thanks Menneisyys.. :wink:
lyfoster99
07-14-2006, 05:32 PM
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.
Menneisyys
07-14-2006, 05:38 PM
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/062005PWIEmbeddedWAVExport/PC/PWISoundExtract.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.
lyfoster99
07-28-2006, 08:04 PM
When I attempt to convert a file, I get a security error. It says to grant this application the required permission to use the Microsoft.NET security policy administration tool.
How do I do that?
Thanks.
dshillis
09-20-2006, 11:12 PM
I've downloaded and am trying to run this program on my Treo 700w, and having a hard time getting it to work! Have tried figuring out a workaround, but can't seem to find it.
I push convert, and select the PWI file. It then says...
"An unexpected error has occurred in PWISoundExtractor.exe. Select Quit and then restart this program, or select Details for more information." Details say:
PWISoundExtractor.exe
OutOfMemoryException
Application::Run+0xf
Form1::Main+Oxa
I have tried pointing to the file on my main memory and on the memory card, but keep getting this error. What can I do?
I assume I've installed the right CAB file...the names weren't very self-explanatory, but I installed PWI_Embedded_Sound_Extractor_ARMV4.CAB. Is that correct?
Thanks to anyone who can help!...
Menneisyys
09-21-2006, 08:27 AM
Treo 700w ... OutOfMemoryException
Well, I don't think this can be helped - you're trying to convert too big PWI files, which just can't be read into the (very meager) RAM of the 700w. (The disadvantages of a 32M RAM device...)
That is, run the converter on the desktop - there, you won't encounter memory shortage problems.
dshillis
09-21-2006, 06:33 PM
That is, run the converter on the desktop - there, you won't encounter memory shortage problems.
Are one of these 4 files runnable on a Mac? That is what I use. I've been having a hard time getting the file to transfer from the Treo 700w onto the desktop, it keeps telling me that the file is unable to be copied...
I'm surprised it's too big, the file is only 4 MB. So the error is a RAM error, not a storage space issue?
Thanks!
dshillis
Menneisyys
09-21-2006, 06:39 PM
That is, run the converter on the desktop - there, you won't encounter memory shortage problems.
Are one of these 4 files runnable on a Mac? That is what I use. I've been having a hard time getting the file to transfer from the Treo 700w onto the desktop, it keeps telling me that the file is unable to be copied...
I'm surprised it's too big, the file is only 4 MB. So the error is a RAM error, not a storage space issue?
Thanks!
dshillis
How much RAM / storage do you have?
dshillis
09-21-2006, 07:38 PM
How much RAM / storage do you have?
The About under settings says I have 25.48MB memory. It also says on that screen that the expansion slot is "In use", so it recognizes it properly.
I don't see any way to tell how much disk space I have...when I mount the Treo onto my Mac Desktop I see sometimes it tells me I have 3.3MB space free, sometimes 104.6MB space free. I'm assuming the 3.3MB is on the Treo and the 104.6 is combined with the memory card, but I can't tell for sure.
Is there a way to make this program run solely from the memory card? I.e., in pointing it to the file on the memory card it would create the file on the memory card too? Because if there is only 3.3MB really on the main treo available, then that may be why it tells me there is no memory when it tries to convert.
Menneisyys
09-21-2006, 07:59 PM
Yes, 3.3M is far too low. Just make sure you install the app on the storage card and also copy the PWI's to be converted there. Then, it'll write to the storage card directly and you won't run out of storage space.
dshillis
09-21-2006, 11:50 PM
Yes, 3.3M is far too low. Just make sure you install the app on the storage card and also copy the PWI's to be converted there. Then, it'll write to the storage card directly and you won't run out of storage space.
Menneisyys, it wasn't the disk space. The Mac program I'm using to try to get this information while connected via USB or Bluetooth just isn't accurate. I found a place on the Treo where I could check the file space, and there is 23MB free on the Treo and another 46MB free on the storage card.
It must be the RAM. Same error over and over again on the 4MB PWI files! I uninstalled the PWI_Embedded_Sound_Extractor_ARMV4 program from the Treo, then installed this file again and installed it to the Storage Card. I moved a file to the storage card and tried it, and the exact same error.
I did try making a 2-second PWI voice recording and converting it and it did work, so I know the install is correct. I also tried a 1.79MB file, and it was successful. It's just not handling the 4MB files! I tried closing all programs running on the Treo to free up as much RAM as possible, but it still gives that error.
I'm not sure if there is anything else I am going to be able to try to make this work?
Menneisyys
09-23-2006, 09:36 AM
Yes, 3.3M is far too low. Just make sure you install the app on the storage card and also copy the PWI's to be converted there. Then, it'll write to the storage card directly and you won't run out of storage space.
Menneisyys, it wasn't the disk space. The Mac program I'm using to try to get this information while connected via USB or Bluetooth just isn't accurate. I found a place on the Treo where I could check the file space, and there is 23MB free on the Treo and another 46MB free on the storage card.
It must be the RAM. Same error over and over again on the 4MB PWI files! I uninstalled the PWI_Embedded_Sound_Extractor_ARMV4 program from the Treo, then installed this file again and installed it to the Storage Card. I moved a file to the storage card and tried it, and the exact same error.
I did try making a 2-second PWI voice recording and converting it and it did work, so I know the install is correct. I also tried a 1.79MB file, and it was successful. It's just not handling the 4MB files! I tried closing all programs running on the Treo to free up as much RAM as possible, but it still gives that error.
I'm not sure if there is anything else I am going to be able to try to make this work?
Try to free up as much RAM as possible. Do you run any memory-hog Today plug-in (for example, Spb Pocket Plus?) Try to disable them all in Settings/Today/Items and repeat the conversion after a reboot.
dshillis
09-27-2006, 07:49 AM
Try to free up as much RAM as possible. Do you run any memory-hog Today plug-in (for example, Spb Pocket Plus?) Try to disable them all in Settings/Today/Items and repeat the conversion after a reboot.
Perfect. Great suggestion! That did the trick. I didn't have any memory-hog plug-ins running, and I had used Memory Manager to stop all running programs and it still did it. But when I took your suggestion and shut off all of the Today stuff I could, the conversion worked. Blessings!!!
Menneisyys
09-27-2006, 08:01 AM
Try to free up as much RAM as possible. Do you run any memory-hog Today plug-in (for example, Spb Pocket Plus?) Try to disable them all in Settings/Today/Items and repeat the conversion after a reboot.
Perfect. Great suggestion! That did the trick. I didn't have any memory-hog plug-ins running, and I had used Memory Manager to stop all running programs and it still did it. But when I took your suggestion and shut off all of the Today stuff I could, the conversion worked. Blessings!!!
Glad to hear it worked :)
Nickund
10-10-2006, 10:48 AM
Just wanted to say thank you for such user-friendly advice. I am still negotiating the techno-minefield that are pocket pc's, but this site has been great.
Menneisyys
10-10-2006, 10:51 AM
Just wanted to say thank you for such user-friendly advice. I am still negotiating the techno-minefield that are pocket pc's, but this site has been great.
Thanks, and welcome to PPCT :)
bengraves
01-02-2007, 11:25 PM
I cannot get either version (PC or Windows Mobile) to work. When I run the extractor off of my desktop (XP Pro) I click on the "Extract!" button, a dialog box comes up to select the file, I select the file and nothing seems to happen. I can't find the extracted file anywhere.
So I tried to download the Windows Mobile file and when I extract the ARMV4.CAB file Winzip tells me the file is corrupt. Please help!!
I cannot get either version (PC or Windows Mobile) to work. When I run the extractor off of my desktop (XP Pro) I click on the "Extract!" button, a dialog box comes up to select the file, I select the file and nothing seems to happen. I can't find the extracted file anywhere.
So I tried to download the Windows Mobile file. When I extract the ARMV4.CAB (WM6 for HTC 3600) file during the setup tells me:" .. the file requires the installation of netcf.all.wce4.armv4.cab. Install the cab file before ru n the application"
Please help!!
Menneisyys
08-06-2007, 05:00 PM
I cannot get either version (PC or Windows Mobile) to work. When I run the extractor off of my desktop (XP Pro) I click on the "Extract!" button, a dialog box comes up to select the file, I select the file and nothing seems to happen. I can't find the extracted file anywhere.
So I tried to download the Windows Mobile file and when I extract the ARMV4.CAB file Winzip tells me the file is corrupt. Please help!!
Just tap the CAB file on your WM device, NOT extract its contents.
Menneisyys
08-06-2007, 05:01 PM
So I tried to download the Windows Mobile file. When I extract the ARMV4.CAB (WM6 for HTC 3600) file during the setup tells me:" .. the file requires the installation of netcf.all.wce4.armv4.cab. Install the cab file before ru n the application"
Please help!!
Install http://www.winmobiletech.com/sekalaiset/CF1SP3/netcf.all.wce4.ARMV4.rar
Thanks for you help. You gave me the best tool ever
flipflop67
09-25-2007, 06:18 AM
So I tried to download the Windows Mobile file. When I extract the ARMV4.CAB (WM6 for HTC 3600) file during the setup tells me:" .. the file requires the installation of netcf.all.wce4.armv4.cab. Install the cab file before ru n the application"
Please help!!
Install http://www.winmobiletech.com/sekalaiset/CF1SP3/netcf.all.wce4.ARMV4.rar
I was hoping you could answer a more general question regarding netcf.all.wce4.armv4.cab. Usually, isn't this generally part of the ROM of whatever device you purchased - or is this a 1.1 specific part that no longer gets distributed with the new models using WM5/6.
LarryBrown
10-06-2008, 09:08 PM
To: Menneisyys (http://forums.thoughtsmedia.com/members/menneisyys/). Thanks for this awesome program. It worked great for me, reading the pwi files from my Windows Mobile 5 device and saving the WAV.
Really great work.
I don't know why I was so stupid as to buy this brain dead Microsoft based mobile phone. Mine is T-Mobile MDA. I need something with a hardware keyboard and the ability to type notes of unlimited length because I am a writer and I am always typing stuff. I saw a guy with this phone so I bought it. I didn't even know it was Microsoft. If I had known I would have looked elsewhere. I have been very dissatisfied. On Vista, the Windows Mobile Sync software is a destructive joke. It's destroyed my data twice. To sync your contacts, you have to use Outlook, yet another example of Microsoft's malicious technique of locking you in to their stuff, at $$$ expense. Using Outlook to sync contacts with a telephone is like using a bazooka instead of a flyswatter. Also, the .pwi files are useless on the main computer, unless some genius like you helps us out.
Thanks again!
It does not work that flawlessly. It extracts a bigger part of sound notes but not all of them. Generally ranging from 50% to 80%.
Maybe it's the Windows Mobile 6.1 that's the root of the problem. There is a chance. But on my PC (WinXP) I get exactly the same results (the same .wav notes are extracted and the same are omitted).
I checked it more thoroughly and it came out that exactly 50% of sounds are extracted.
If you ordered the sounds 1, 2, 3, ..., n the program would produce only every second sound in the following order:
1: sound no n-1
2: sound no n-3
3: sound no n-5
....
n/2: sound no 1
This may not always be exactly the case as I tested it with the file that had an odd numer of sound notes (39). If the number is even it may be slightly different. But you get the general idea.
I also downloaded the source code and spotted some fileSize/2 occurences there. I am not a programming expert however so maybe it has absolutely nothing to do with it. I' m thinking of experimenting with the code myself a bit.
Menneisyys
02-19-2009, 12:28 AM
I checked it more thoroughly and it came out that exactly 50% of sounds are extracted.
If you ordered the sounds 1, 2, 3, ..., n the program would produce only every second sound in the following order:
1: sound no n-1
2: sound no n-3
3: sound no n-5
....
n/2: sound no 1
This may not always be exactly the case as I tested it with the file that had an odd numer of sound notes (39). If the number is even it may be slightly different. But you get the general idea.
I also downloaded the source code and spotted some fileSize/2 occurences there. I am not a programming expert however so maybe it has absolutely nothing to do with it. I' m thinking of experimenting with the code myself a bit.
Thanks for reporting this; I'll try to look into the problem when I have some time.
I came across this thread with the same problem of extracting WAV files from PWI files. I found a technique that works entirely through software with no need to modify anything on the mobile device.
In the PWI files the WAV file is stored at the end of the file. All that needs to be done is to delete everything before the WAV portion and then save the remaining data as a new file. Here is an easy method to do this using a freeware hex editor.
Transfer the PWI files to a PC using ActiveSync.
Open the PWI file in the hex editor XVI32. All following steps are in XVI32. http://www.chmaas.handshake.de/delphi/freeware/xvi32/xvi32.htm
Search --> Find
"Text String" should be checked
Enter the following text in the search field: RIFF
Click OK
The "R" in RIFF will be highlighted in the window on the right
In the window on the right, select the character before the R in RIFF. That is, select the character to the left of the R in RIFF.
Edit --> Delete to cursor
File --> Save As --> Filename.wav
Filename can be anything you like, but it needs to end in .wav.
WAV file headers begin with "RIFF" so this is just deleting everything before it and saving the rest, leaving only the WAV file.
Enjoy!
janolsen
11-28-2011, 01:03 PM
Tried extracting on PC. But soundfile not playable in Win7 with MediaPlayer and with VLC there's no sound. Then I also tried recording directly to .wav, same problem. Strange...using WM6.1 on HTC
vBulletin® v3.8.9, Copyright ©2000-2019, vBulletin Solutions, Inc.