Loading sounds in realtime?

Non-platform specific questions.

Loading sounds in realtime?

Postby SuperSonic » Fri Mar 23, 2012 12:25 am

Hey all!

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

Thanks! SuperSonic
A tree never hits an automobile except in self-defence.

Want to use your joystick or controller with Game Editor? Check out my controller engine =D
User avatar
SuperSonic
 
Posts: 1443
Joined: Fri Sep 24, 2010 9:24 pm
Location: Anywhere
Score: 72 Give a positive score

Re: Loading sounds in realtime?

Postby skydereign » Fri Mar 23, 2012 12:48 am

Nope, since unlike with graphics and canvas, we have no way of creating sound in gE.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Loading sounds in realtime?

Postby SuperSonic » Fri Mar 23, 2012 1:44 am

Darn :(

Thanks anyways :D
A tree never hits an automobile except in self-defence.

Want to use your joystick or controller with Game Editor? Check out my controller engine =D
User avatar
SuperSonic
 
Posts: 1443
Joined: Fri Sep 24, 2010 9:24 pm
Location: Anywhere
Score: 72 Give a positive score

Re: Loading sounds in realtime?

Postby lcl » Fri Mar 23, 2012 6:39 am

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
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: Loading sounds in realtime?

Postby skydereign » Fri Mar 23, 2012 7:04 am

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.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Loading sounds in realtime?

Postby lcl » Fri Mar 23, 2012 7:28 am

It works also in exported version, I sent an .exe inside the zip and it works. :D
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: Loading sounds in realtime?

Postby SuperSonic » Fri Mar 23, 2012 2:48 pm

Wow lcl! You're amazing! :shock:

+1 :wink:
A tree never hits an automobile except in self-defence.

Want to use your joystick or controller with Game Editor? Check out my controller engine =D
User avatar
SuperSonic
 
Posts: 1443
Joined: Fri Sep 24, 2010 9:24 pm
Location: Anywhere
Score: 72 Give a positive score

Re: Loading sounds in realtime?

Postby Jagmaster » Fri Mar 23, 2012 3:14 pm

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!!!
User avatar
Jagmaster
 
Posts: 875
Joined: Sun May 08, 2011 4:14 pm
Location: Not where you think.
Score: 82 Give a positive score

Re: Loading sounds in realtime?

Postby SuperSonic » Fri Mar 23, 2012 3:50 pm

Haha, that's the only way it works for me. I can't get it to work the other way :P
A tree never hits an automobile except in self-defence.

Want to use your joystick or controller with Game Editor? Check out my controller engine =D
User avatar
SuperSonic
 
Posts: 1443
Joined: Fri Sep 24, 2010 9:24 pm
Location: Anywhere
Score: 72 Give a positive score

Re: Loading sounds in realtime?

Postby Jagmaster » Fri Mar 23, 2012 4:00 pm

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.)
User avatar
Jagmaster
 
Posts: 875
Joined: Sun May 08, 2011 4:14 pm
Location: Not where you think.
Score: 82 Give a positive score

Re: Loading sounds in realtime?

Postby SuperSonic » Fri Mar 23, 2012 4:16 pm

I was thinking about open source games or game engines ^^
A tree never hits an automobile except in self-defence.

Want to use your joystick or controller with Game Editor? Check out my controller engine =D
User avatar
SuperSonic
 
Posts: 1443
Joined: Fri Sep 24, 2010 9:24 pm
Location: Anywhere
Score: 72 Give a positive score

Re: Loading sounds in realtime?

Postby lcl » Fri Mar 23, 2012 6:52 pm

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
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: Loading sounds in realtime?

Postby SuperSonic » Fri Mar 23, 2012 7:41 pm

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:
A tree never hits an automobile except in self-defence.

Want to use your joystick or controller with Game Editor? Check out my controller engine =D
User avatar
SuperSonic
 
Posts: 1443
Joined: Fri Sep 24, 2010 9:24 pm
Location: Anywhere
Score: 72 Give a positive score

Re: Loading sounds in realtime?

Postby lcl » Fri Mar 23, 2012 7:55 pm

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
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: Loading sounds in realtime?

Postby Game A Gogo » Fri Mar 23, 2012 7:58 pm

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
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Next

Return to General

Who is online

Users browsing this forum: No registered users and 1 guest