wav vs mp3
Wed, 07/16/2014 - 9:42am
![]() |
![]() ![]() ![]() ![]() 17 years
|
I want to add some sound files to my POIs (red light and speed camera files) to my Garmin Nuvi 765. I have had problems with this before and was wondering if I need to use mp3 files or wav files. Thanks for your help.
for the lack of quotation marks a conversion was lost
It seems that sox will not itself handle files with spaces in the names.
So POI loader must be looking at the sound file and eliminating spaces before invoking sox.exe.
@Evert, is that what you are finding?
No, I found that sox.exe can handle files with spaces in the names ok by testing this command in a cmd box :
sox.exe "Ace Hardware.mp3" -s -r 44100 -c 1 -2 "Ace Hardware.wav"
I figured the problem was the syntax of my for-in-do command but did not have time to finish working on it. That was why I had the task on my “to do” list:
……..
Things that need to be worked on:
For-in-do does not work for filenames with spaces (there were several of these type amongst the mp3 files I downloaded from Poi Factory.
…...
I have made this change (added quotation marks) which should work for you:
for %%a in (*.mp3) do sox.exe -V "%%a" -s -r 44100 -c 1 -2 "%%~na.wav" >> conversion.log 2>&1
@Evert
The quotes are clearly the way to avoid the space problem within in a file name and maybe that is what POI Loader does under the covers after it recognizes that the name of the .wav file matches the name of the .csv/.gpx file.
Indeed, the revised batch file works. I had made those changes myself.
quotes
The quotes are clearly the way to avoid the space problem within in a file name and maybe that is what POI Loader does under the covers after it recognizes that the name of the .wav file matches the name of the .csv/.gpx file.
I think that Poi Loader would have to put the quotes on the filename because when it calls sox.exe, sox.exe would run in a hidden cmd window and the quotes would be needed for file names with spaces same as my batch file does.
If I were programming it I would simply always put the quotes on the filename I put in the sox.exe input file name. I would not bother to check if it had spaces or not.
As used by Poi Loader, the sox.exe output file name does not need quotes because the name is always temp.wav
Probably the only way to know for sure how it is done would be to decompile Poi Loader and go through the source code.
I opened Poi Loader.exe with notepad and can see the text “POI_SoxInterface.cpp”. No doubt that is the name of one of the source code files used in the Project that was used to compile Poi Loader. Of course when Poi Loader.exe was compiled the POI_SoxInterface.cpp source code became difficult to pull out as an entity.
There was a time when I might have decompiled Poi Loader.exe just for fun but at my age it would be more fun than I can stand.
….. Indeed, the revised batch file works. I had made those changes myself.
Yes, it is almost obvious that is the change that was needed.
But at the time I was not sure if the first %%a in the string need to be quoted, and I wanted to thoroughly test before I posted the fix.
Bulk Rename Facility
One of the ways that we might have removed "spaces" from the file names of POI files would have been to use Bulk Rename Utility.
It is freeware and portable
http://www.portablefreeware.com/index.php?id=1008
It has an option to remove a character replacing that character with another character. I put in a "space" as the character and nothing as its replacement. The spaces were thus removed.
it works but is it needed?
One of the ways that we might have removed "spaces" from the file names of POI files would have been to use Bulk Rename Utility.
.......
Since the mp3 conversion methods and Poi Loader/sox.exe work ok with spaces in the file names, why bother removing the spaces?
@Evert
agree we would not need it on this project, which is why I used the words "might have".
Thought I would mention this package because someone might want to use it for similar or other purposes - like removing "numbers" from file names.
I have found it to be very handy in a number of instances.