Author Topic: Music and sound  (Read 3479 times)

kolyamatic

  • Guest
Music and sound
« on: March 05, 2013, 04:32:32 PM »
On my journey through EGSL, I was now about to add music/sound.
I know the possible file formats for images (see docu), but are there limitations on music/sound regarding the format?
If so, which are supported?
If not so, how do I load a .midi?

Cybermonkey

  • Administrator
  • *****
  • Posts: 0
Re: Music and sound
« Reply #1 on: March 05, 2013, 06:05:43 PM »
MIDI files are supported but only as music, not as sounds. So do a:
Code: [Select]
mymusic = loadmusic ("mymidi.midi")
playmusic (mymusic, 100, -1)
The second paramter of playmusic is the volume, the third the loop. Use -1 for looping forever. Use 0 to play it once, 1 to play it twice ...

kolyamatic

  • Guest
Re: Music and sound
« Reply #2 on: March 05, 2013, 09:56:46 PM »
Well, I looked it up in the docu and wrote some kind which was nearly 1:1 yours. (I added "local" before the variable, is that a mistake in this case?)
But there was one difference though: I had a path including two additional folders - and I got the "Can not open music/sound file." error. So I guess it might be that?
Looking forward for future responses.

Cybermonkey

  • Administrator
  • *****
  • Posts: 0
Re: Music and sound
« Reply #3 on: March 06, 2013, 03:44:52 PM »
Please post your code for further help.

kolyamatic

  • Guest
Re: Music and sound
« Reply #4 on: March 06, 2013, 04:59:16 PM »
Code: [Select]
openwindow(640,480,32,"GoF")

local AmparoRoca = loadmusic("data/music/AmparoRoca.midi")
playmusic(AmparoRoca,100,0)

inkey()
closewindow()

I triple-checked possible spelling mistakes with the file's name. The path does also exist.
Furthermore I tried leaving out the "local" - no changes.

Cybermonkey

  • Administrator
  • *****
  • Posts: 0
Re: Music and sound
« Reply #5 on: March 07, 2013, 12:40:20 PM »
Is it really ".midi"? My midi files have only ".mid" as an extension.

kolyamatic

  • Guest
Re: Music and sound
« Reply #6 on: March 08, 2013, 08:07:48 PM »
It says .midi, yes.
Though I tried with .mid - and it works. And it is so loud... but I think that's the fault of my computer/headset/ears.

Anyway, thanks for the help.