I need to playback an audio file at a specified GPS based location

I need to trigger an audio file playback based on specific defined GPS location.

Basic Step:

  1. Use the Location Sensor

  2. Target Location: Store the GPS coordinates of the location where you want the audio to play

  3. Set Up a Timer or When Location Changes Trigger: Use this to keep checking if the user’s location matches your target location.

  4. Compare Coordinates: check if the user is within, say, 20-50 meters using the Haversine formula or a simple radius check.

  5. Trigger Audio: Once the location condition is met, use the Sound component to play the audio file.

Logic

If distance between current location and target location < 30 meters
→ Then play audio

At Impero IT Services, we helped build a tourism app that plays audio guides when users approach historic landmarks. We used the same logic — set radius checks and played location-specific narratives automatically. It’s surprisingly engaging for users!

Thank you for your reply. I am busy building an audio guide. The app is already working, some audio files are running on timers, but I need to trigger some by GPS location. Currently the guide has to click on to play audio button to start. I have already built the blocks for checking my current location, but I don’t know how to built the block that includes the target location. Basically I cant figure out how to say if target location is “yes”, or 500m away then do…I understand the logic, but I struggle to built the actual block. Could you assist me with that?

  1. Should Define target location:

Like,

  • Latitude: 40.7128
  • Longitude: -74.0060

Store in App

targetLat = 40.7128  
targetLong = -74.0060
  1. Calculate Distance Between Two Coordinates

you can use the distance from block from the Location Sensor to compare current location and target bcoz Thunkable doesn’t have a built-in “distance” block.

When Timer Fires (every X seconds):
  set currentLat = LocationSensor.Latitude
  set currentLong = LocationSensor.Longitude

  set distance = call LocationSensor → Distance from (targetLat, targetLong)

  if distance < 500:
     call Sound.Play (your audio file)
  1. Control Playback with a Flag
if distance < 500 AND hasPlayed = false:
   call Sound.Play
   set hasPlayed = true

Optional: Reset hasPlayed to false once they move away (e.g., distance > 600).

Thank you for your kind assistance. I will spend time on this soon again when I have got some more time.
Gerald