I am trying to add music to my game but ti won't play

hi, I have this at the end on my main.lua

audio.reserveChannels( 1 )
-- Reduce the overall volume of the channel
audio.setVolume( 1, { channel=1 } )


-- Load audio
musicTrack = audio.loadStream( "audio/Tom.wav",system.ResourceDirectory)
 
-- Play the background music on channel 1, loop infinitely 
audio.play( musicTrack, { channel=1, loops=-1 } )

but I cant hear any sound at all… I suspect it may be because I am using the Linux version of solar2d, but maybe not, any ideas?

quick update, the sound worked on hte android version but not in the simulator or HTML5 versions

Filepaths are case sensitive on some platforms, so I would first of all double check that “audio/Tom.wav” is correct.

If the file is actually called “tom.wav” or “Tom.WAV”, some platforms will fail to find it when you specify the name as “Tom.wav”.

Otherwise, it’s possible that there is an issue with the wav file itself. It could be that it’s actually an mp3 rather than a wav file, and has just had the extension part renamed.

1 Like