[josm-dev] Audio player and synchronisation in JOSM

David Earl david at frankieandshadow.com
Mon Feb 18 18:04:35 GMT 2008


I have just committed a large group of changes to JOSM which much 
improve audio handling. In particular, you can now use your dictaphone 
to record one long continuous audio file while you're surveying, collect 
waypoints on your GPS, and then in JOSM synchronise the audio with the 
waypoints and play each from waypoint individually. This means you're 
not forever having to pause and restart recording while surveying, or 
listen to hours of heavy breathing when playing back.

Also, audio is now threaded, which means it can be controlled while 
playing, so as well as direct access from any waypoint, you can pause, 
jump forward and back, and from one waypoint to the next or previous.

Most of this won't affect you if you don't use audio. But there is a 
flag you can set if the extra menu offends you (see below).

This is quite a big change, so there might be the odd teething problem. 
But I have tried it quite extensively. I thought about doing it in a 
plugin, but all the building blocks for this were already in place in 
JOSM itself. Also, the AudioPlayer class can potentially be used in 
other audio contexts.

I will send a similar message to talk tomorrow once it has built 
(assuming that all goes smoothly!)

Here's the changes to JOSM:

1. When you open a gpx file, it always did extract waypoints from the 
file and turn them into markers in their own layer. If you now right 
click on that marker layer you can "Apply Audio" to the layer. Choose a 
WAV file(*) and the markers all become audio markers.

2. If your GPX creator selectively names trackpoints, these can now be 
turned into Markers as well. Use "Markers from Named Points" on the GPX 
layer. You can also set the advanced option "markers.namedtrackpoints" 
to true and this will happen automatically when GPX is opened (i.e. 
named trackpoints are treated like waypoints).(**)

3. You can play audio for the markers by clicking the marker (that is 
unchanged) - but it starts at the distance in to the audio that the 
marker is timed offset from the first marker. (If you click another 
marker while playing, it jumps straight to the one you just clicked).

4. There is an Audio menu with some controls on it. Note that the period 
(full stop) key is the play/pause key accelerator. If you just play, it 
will play the audio for the first audio marker in the first marker layer 
it can find. Press again to pause (or more likely press full stop) (it 
may take up to 0.5sec to actually pause). Play again then resumes. Click 
the marker again to play from that marker. Forward and back jump 10 
seconds (or whatever value you set in the option 
"audio.forwardbackamount"). And you can advance to the next or previous 
marker with those buttons. If you use these a lot, you will quite likely 
want to add the buttons to the toolbar to make a little player bar, 
using button preferences in the usual way.

5. You will want to sync with a marker. You can do this with any audio 
marker, but usually it will be the first one - you would say "NOW" into 
your recorder at the same time as creating the waypoint on your GPS. 
Then in JOSM, play the marker you want to sync on until you get to the 
"NOW" and pause it. Then use right click on the marker layer and select 
"Synchronize Audio". Then when you play a marker it will adjust the 
playing position accordingly. So if when you got to making waypoint 54 
you said "point 54: pub called Royal Oak on left", when you click on 54 
it should play that phrase immediately. There is a one second lead in 
(i.e. it starts a second earlier than the offset), but you can adjust 
this with "audio.leadin" (incuding negative amounts so the playing can 
skip a short interval after the waypoint, if you find it hard to start 
talking into the dictaphone).

6. Previously waypoints are named/numbered on the map, but when they 
were displayed as audio, only the icon appeared. Now, if you set the 
advanced setting "marker.buttonlabels" to true, it will also show you 
the name/number.

7. If you don't want to see the Audio menu at all, set 
"audio.menuinvisible" to true.

8. One peculiarity of the previous behaviour was that if you clicked to 
add a node on top of an audio marker it _also_ played the audio. It 
still does (I thought about various alternative ways to activate the 
marker, because you often want a node just where the marker is). 
However, it no longer activates the audio (or image, or link marker) if 
you mouse down outside the button. This means you can at least make your 
node and then drag it into position on top of the marker icon without it 
playing.


David


(*) What WAV files it plays is dependent on the Java Audio System. I 
found that it won't play the 32-bit framed wave files that come out of 
my Olympus Digital Voice Recorder. However, a conversion using Audacity
only takes a few seconds even on a long mapping session. The minimum 
Java will play seems to be 8,000 samples per second with 8 or 16-bit 
samples (the Olympus does 8,000 but with 32 bit floating point samples). 
Maemo-recorder on my Nokia N810 was fine (though quiet, but that was a 
microphone/recorder problem I think).

(**) Maemo-mapper on the Nokia N810 does this. It calls them a "mark" 
(Track -> Insert Mark, or tap point context menu). It's a pain to do 
that so I now have an adapted version which requires a prod anywhere on 
the screen - which is great when riding a bike - even wearing gloves. If 
anyone would like this, please ask. I want to try to get it integrated, 
but I've not heard anything back from the Maemo-mapper development group.





More information about the josm-dev mailing list