Author Topic: Non-Restarting music only working on one song?  (Read 3119 times)

xElectricZz

  • Wannabe
  • Posts: 14
  • ECH
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Firefox 27.0 Firefox 27.0
    • View Profile
    • Twitch Page
  • Playstyle: Keyboard
Non-Restarting music only working on one song?
« on: February 08, 2014, 04:38:30 PM »
the engine I'm using is Yutuuu Edition.

While trying to make my fangame music not restart, i looked around this forum and found some code Seph posted under an older thread, along with instructions to delete a few things in a few objects..

Code: [Select]
if !sound_isplaying(song) { sound_loop(song); }
When i deleted the things, and used this under the creation code of the playMusic object for the default track01, (guy rock), it worked. I pressed R, the music didn't restart. I died, it didn't restart. i switched rooms, it didn't restart.

But, after that testing, i added in some music i found so i didn't have to use guy rock on some rooms. Once i added it, and tried it on a a few rooms, it didn't work. The strange thing is, the rooms with guy rock worked perfectly. The room restarted quickly, and the music didn't ever restart. In the rooms with my music, the room took about a full second to load every time i hit R, and the music restarted. while it was loading, it looked like it was trying to resize itself a bit. before posting this i messed around in game maker for about 60 or so minutes on and off trying to fix it. does anybody have any idea what I'm doing wrong?
« Last Edit: February 08, 2014, 06:00:10 PM by xElectricZz »
Discord - Electric#6878

infern0man1

  • ~(=^・ω・^)ψ
  • Global Moderator
  • Oatmeal Killer
  • Posts: 1.021
  • Dear sir stroke madam, fire exclamation point
  • OS:
  • Linux Linux
  • Browser:
  • Safari 4.0 Safari 4.0
    • View Profile
    • Twitter
  • Playstyle: Keyboard
Re: Non-Restarting music only working on one song?
« Reply #1 on: February 08, 2014, 06:04:49 PM »
Well, how big is the music file? Sometimes it can lag the game a bit because music takes up a large amount of memory.

YoSniper

  • Awexome
  • Global Moderator
  • Spike Dodger
  • Posts: 142
  • People regard me as a programming overlord.
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Chrome 32.0.1700.107 Chrome 32.0.1700.107
    • View Profile
    • My YouTube
  • Playstyle: Keyboard
Re: Non-Restarting music only working on one song?
« Reply #2 on: February 08, 2014, 06:13:08 PM »
Is "song" a variable that could represent a variety of sound files in your library? It would help to make sure you are setting the variable "song" correctly before trying to play the sound.

Then again, you may have already considered this. But without seeing the whole code, I can't be sure.
I don't traverse the forums as much anymore. Follow me on Twitter if you want to keep tabs on me!

Twitter: @YoSniperGames
Twitch: yosniper

Streams happen whenever I feel like it.

xElectricZz

  • Wannabe
  • Posts: 14
  • ECH
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Firefox 27.0 Firefox 27.0
    • View Profile
    • Twitch Page
  • Playstyle: Keyboard
Re: Non-Restarting music only working on one song?
« Reply #3 on: February 08, 2014, 06:36:28 PM »
The song i'm using is a 6.17MB mp3 file.

The code i'm using is this. I ctrl + right click the playMusic object in a room, and click Creation Code. There, i paste the code i put into the OP. I believe it is a variable of any sounds in the music folder. The name of both show in yellow so i know i got the names correct of what i named them in game maker. If it matters, under the music folder put there for me in yuuutu edition, i made a new folder under that folder entitled "Area 1" to organize my music, and put it in there.

This is the song that won't work for me, and restarts every time.
Code: [Select]
if !sound_isplaying(buttdawgfunk) { sound_loop(buttdawgfunk); }
This is the song that came with Yuuutu edition, guy rock.
Code: [Select]
if !sound_isplaying(track01) { sound_loop(track01); }
If it helps, this is where i got the song. https://chiptuneswin.com/track/buttdawg-funk
Discord - Electric#6878

infern0man1

  • ~(=^・ω・^)ψ
  • Global Moderator
  • Oatmeal Killer
  • Posts: 1.021
  • Dear sir stroke madam, fire exclamation point
  • OS:
  • Mac OS X 10.6.3 Mac OS X 10.6.3
  • Browser:
  • Safari 5.0 Safari 5.0
    • View Profile
    • Twitter
  • Playstyle: Keyboard
Re: Non-Restarting music only working on one song?
« Reply #4 on: February 08, 2014, 08:03:08 PM »
The song i'm using is a 6.17MB mp3 file.


:PogChamp: You need to compress that sound file. That's probably the main reason why the game is doing that.

dYnAm1c

  • Wannabe
  • Posts: 24
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Chrome 32.0.1700.107 Chrome 32.0.1700.107
    • View Profile
Re: Non-Restarting music only working on one song?
« Reply #5 on: February 08, 2014, 09:16:23 PM »
.ogg files are probably the best for music in fangames, it has a very good compression but still good audio quality. Also the audio bitrate shouldn't go over 128kb/s as you shouldn't notice a difference anyways to higher bitrates, this saves space and probably better loading times and no lag on restarts.

to compare: a 3 minute song in good mp3 quality is about 4-6mb. A 3 minute song in good ogg quality is about 1,5-2,5mb.
« Last Edit: February 08, 2014, 09:21:31 PM by dYnAm1c »

xElectricZz

  • Wannabe
  • Posts: 14
  • ECH
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Firefox 27.0 Firefox 27.0
    • View Profile
    • Twitch Page
  • Playstyle: Keyboard
Re: Non-Restarting music only working on one song?
« Reply #6 on: February 11, 2014, 02:59:21 PM »
.ogg files are probably the best for music in fangames, it has a very good compression but still good audio quality. Also the audio bitrate shouldn't go over 128kb/s as you shouldn't notice a difference anyways to higher bitrates, this saves space and probably better loading times and no lag on restarts.

to compare: a 3 minute song in good mp3 quality is about 4-6mb. A 3 minute song in good ogg quality is about 1,5-2,5mb.

Thanks for the help, After trying to compress it didn't work since its size was still too big, and trying to convert it into an ogg didn't work since it wouldn't play in game maker; i got an idea to convert it like this: 211kbit MP3 (Original File) - 96kbit OGG (From Earlier) - 96kbit MP3 using media.io. It managed to drop to 2.2 or so MB on the OGG, and the exact same size for the MP3 somehow. it works perfectly now.
Discord - Electric#6878