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

**URL:** <https://community.thunkable.com/t/i-need-to-playback-an-audio-file-at-a-specified-gps-based-location/3888272>\
**Category:** Questions about Thunkable X\
**Created:** [June 2, 2025, 2:34pm UTC](https://community.thunkable.com/t/i-need-to-playback-an-audio-file-at-a-specified-gps-based-location/3888272 "2025-06-02T14:34:58Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![g.kolb001eby4sf](https://avatars.discourse-cdn.com/v4/letter/g/8baadc/32.png) [@g.kolb001eby4sf](https://community.thunkable.com/u/g.kolb001eby4sf)\
**Post date:** [June 2, 2025, 2:34pm UTC](https://community.thunkable.com/t/i-need-to-playback-an-audio-file-at-a-specified-gps-based-location/3888272/1 "2025-06-02T14:34:58Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![imperoitservices](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/imperoitservices/32/204690_2.png) [@imperoitservices](https://community.thunkable.com/u/imperoitservices)\
**Post date:** [June 3, 2025, 5:39am UTC](https://community.thunkable.com/t/i-need-to-playback-an-audio-file-at-a-specified-gps-based-location/3888272/2 "2025-06-03T05:39:11Z")

</div>

**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!

---

<div class="post-metadata">

**Author:** ![g.kolb001eby4sf](https://avatars.discourse-cdn.com/v4/letter/g/8baadc/32.png) [@g.kolb001eby4sf](https://community.thunkable.com/u/g.kolb001eby4sf)\
**Post date:** [June 3, 2025, 6:41am UTC](https://community.thunkable.com/t/i-need-to-playback-an-audio-file-at-a-specified-gps-based-location/3888272/3 "2025-06-03T06:41:37Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![imperoitservices](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/imperoitservices/32/204690_2.png) [@imperoitservices](https://community.thunkable.com/u/imperoitservices)\
**Post date:** [June 3, 2025, 7:29am UTC](https://community.thunkable.com/t/i-need-to-playback-an-audio-file-at-a-specified-gps-based-location/3888272/4 "2025-06-03T07:29:24Z")

</div>

1. Should Define target location:

Like,

- Latitude: `40.7128`
- Longitude: `-74.0060`

Store in App

```auto
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.

```auto
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**

```auto
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`).

---

<div class="post-metadata">

**Author:** ![g.kolb001eby4sf](https://avatars.discourse-cdn.com/v4/letter/g/8baadc/32.png) [@g.kolb001eby4sf](https://community.thunkable.com/u/g.kolb001eby4sf)\
**Post date:** [June 5, 2025, 6:52am UTC](https://community.thunkable.com/t/i-need-to-playback-an-audio-file-at-a-specified-gps-based-location/3888272/5 "2025-06-05T06:52:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/f/0f59f292712368bce16ff80133ae10de8a6f27e8.png) [@system](https://community.thunkable.com/u/system)\
**Post date:** [September 3, 2025, 6:52am UTC](https://community.thunkable.com/t/i-need-to-playback-an-audio-file-at-a-specified-gps-based-location/3888272/6 "2025-09-03T06:52:22Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
