It depends on the system version. Before macOS 10.15 Catalina we could use any song from our music library in our slideshows that had no digital rights attached (no songs in the in the media kind "protected AAC Audio" or similar, also no song from -Music.) I could use all songs I created myself in GarageBand or Logic or recorded
Since Catalina it has changed. With every system Version I am in for a surprise, when I try to use my own songs.
On Sonoma I seem to be able to use many different songs from Music in a slideshow, as long as the song has been downloaded to the library and does not need downloading, but I can no longer use the songs I played myself on a guitar.
What I am doing on Sonoma to add my own music to a slideshow is to export the slideshow as a video, and then I add a soundtrack to the video in GarageBand or iMovie.