Page 1 of 2

Loading sounds in realtime?

PostPosted: Fri Mar 23, 2012 12:25 am
by SuperSonic
Hey all!

Is there any way to load an play sound files in realtime? :D

Thanks! SuperSonic

Re: Loading sounds in realtime?

PostPosted: Fri Mar 23, 2012 12:48 am
by skydereign
Nope, since unlike with graphics and canvas, we have no way of creating sound in gE.

Re: Loading sounds in realtime?

PostPosted: Fri Mar 23, 2012 1:44 am
by SuperSonic
Darn :(

Thanks anyways :D

Re: Loading sounds in realtime?

PostPosted: Fri Mar 23, 2012 6:39 am
by lcl
Actually, I've found out that it is possible to open music files using PlayMusic2() with the complete path of the file.
Like "C:\\Users\\Me\\MusicPlayer\\music\\myMusic.wav"

Here's an example, remember to read the README.txt
I think it may be possible to create a .bat -file like the one I created for the listing of files, this time just to get the path of the folder.

AND of course we could make a little file to list the contents of the music folder and then show the songs available in the music player application!
I just don't have time to do it now. D=

To play a song, write it's actual name and click the green button.
Like: "the_end.wav"+CLICK! xD

Hope this helps you!

EDIT:
Oh yeah, the download link xDDDDD
http://dl.dropbox.com/u/38266203/GE/musicPlayer.zip

Re: Loading sounds in realtime?

PostPosted: Fri Mar 23, 2012 7:04 am
by skydereign
I'm pretty sure that doesn't work in export, which is why I don't consider it. But, I may be wrong, since I've been on Linux, I don't do much sound work.

Re: Loading sounds in realtime?

PostPosted: Fri Mar 23, 2012 7:28 am
by lcl
It works also in exported version, I sent an .exe inside the zip and it works. :D

Re: Loading sounds in realtime?

PostPosted: Fri Mar 23, 2012 2:48 pm
by SuperSonic
Wow lcl! You're amazing! :shock:

+1 :wink:

Re: Loading sounds in realtime?

PostPosted: Fri Mar 23, 2012 3:14 pm
by Jagmaster
Lcl, you're now my favorite person.
:shock: :shock: :shock: :shock:

But, it gets better!

There's no reason to write the whole file path.
Just type "music" in the config file and it still works!!!

Re: Loading sounds in realtime?

PostPosted: Fri Mar 23, 2012 3:50 pm
by SuperSonic
Haha, that's the only way it works for me. I can't get it to work the other way :P

Re: Loading sounds in realtime?

PostPosted: Fri Mar 23, 2012 4:00 pm
by Jagmaster
Double backslashes \\

I wonder if File*fopen can open other directories by using double backslashes. :|
Actually, I hope it can't 'cause that would be dangerous. :lol:

Another thought, you could probably just store the music file in the folder with the program, and open it without any path. :?

But, why go to all the trouble with this? It just make your music prone to piracy. (Not that it wasn't before, but this makes it easier.)

Re: Loading sounds in realtime?

PostPosted: Fri Mar 23, 2012 4:16 pm
by SuperSonic
I was thinking about open source games or game engines ^^

Re: Loading sounds in realtime?

PostPosted: Fri Mar 23, 2012 6:52 pm
by lcl
SuperSonic wrote:Wow lcl! You're amazing!

+1

Thanks! =)
Jagmaster wrote:Lcl, you're now my favorite person.
:veryshocked: <-- removed smilies because of that silly limit -.-

But, it gets better!

There's no reason to write the whole file path.
Just type "music" in the config file and it still works!!!

Thanks to you as well! =D
I thought I already tried with the music only but it seems I didn't..
Jagmaster wrote:I wonder if File*fopen can open other directories by using double backslashes. :|
Actually, I hope it can't 'cause that would be dangerous. :lol:

I tried that when I found out that one can use PlayMusic2() like that, but it didn't work.
Jagmaster wrote:Another thought, you could probably just store the music file in the folder with the program, and open it without any path. :?

Of course you could but it is cleaner this way and seems better. =D
And if this works without the whole path we can even leave the external file thing because the whole folders position doesn't matter anymore.
Jagmaster wrote:But, why go to all the trouble with this? It just make your music prone to piracy. (Not that it wasn't before, but this makes it easier.)

Reason 1: SuperSonic wanted to find a way
Reason 2: Because it is nice to test what can be done with GE
Reason 3: There will still be use for this. I don't think anyone's gonna make their games' sounds to be integrated to the game like this, but for example if someone wants to add possibility to listen to whatever music the one playing the game wants to listen. Or one can build a music player application with this, if one wants.

Too bad this doesn't support .wma or .mp3...
And it lags with some files. I had some .wav-file which played badly and I think it depends on the type of the .wav-file.

But anyway, I hope someone finds this useful! =D

Re: Loading sounds in realtime?

PostPosted: Fri Mar 23, 2012 7:41 pm
by SuperSonic
lcl wrote:But anyway, I hope someone finds this useful! =D
I did xD

So, about what you were saying with mp3's and wma's, you could just create a reader that loads these types of files and converts them to wavs. Just an idea :roll:

Re: Loading sounds in realtime?

PostPosted: Fri Mar 23, 2012 7:55 pm
by lcl
SuperSonic wrote:So, about what you were saying with mp3's and wma's, you could just create a reader that loads these types of files and converts them to wavs. Just an idea :roll:

That would be quite difficult, because they are compressed formats and so reading them is complex.
But if I could find a way to read them, and if I learnt to write a .wav it would be cool of course! =D

Re: Loading sounds in realtime?

PostPosted: Fri Mar 23, 2012 7:58 pm
by Game A Gogo
Good luck... I've tried my luck ages before but there is no information on the internet about them because they are copyrighted file types. Though you can still try your luck, but I think it's illegal