diff --git a/src/raudio.c b/src/raudio.c
index e5aef5cf9..002d89d7f 100644
--- a/src/raudio.c
+++ b/src/raudio.c
@@ -1314,6 +1314,20 @@ void ResumeMusicStream(Music music)
     if (music != NULL) ResumeAudioStream(music->stream);
 }
 
+void jar_xm_reset(jar_xm_context_t* ctx)
+{
+    // I don't know what I am doing
+    // this is probably very broken
+    // but it kinda works
+    for (uint16_t i = 0; i < jar_xm_get_number_of_channels(ctx); i++)
+    {
+        jar_xm_cut_note(&ctx->channels[i]);
+    }
+    ctx->current_row = 0;
+    ctx->current_table_index = 1;
+    ctx->current_tick = 0;
+}
+
 // Stop music playing (close stream)
 // TODO: To clear a buffer, make sure they have been already processed!
 void StopMusicStream(Music music)
@@ -1335,7 +1349,7 @@ void StopMusicStream(Music music)
         case MUSIC_AUDIO_MP3: drmp3_seek_to_pcm_frame(&music->ctxMp3, 0); break;
 #endif
 #if defined(SUPPORT_FILEFORMAT_XM)
-        case MUSIC_MODULE_XM: /* TODO: Restart XM context */ break;
+        case MUSIC_MODULE_XM: jar_xm_reset(music->ctxXm); break;
 #endif
 #if defined(SUPPORT_FILEFORMAT_MOD)
         case MUSIC_MODULE_MOD: jar_mod_seek_start(&music->ctxMod); break;