Fun with sound... (retro-tastic!)

BlitzMax Forums/Brucey's Modules/Fun with sound... (retro-tastic!)

Brucey(Posted 2010) [#1]
Ever wanted to use retro-esque sounds in your retro-esque games?

Well, here's a little tool that might help ;-)



Yes, yes, I know you've probably all seen it before, but this is in fact a BlitzMax port, with some handy modifications.

Of most interest will probably be the facility to generate sounds when you need them, rather than store a crap-load of .wav/.ogg on your drive. Instead, you can save the sound settings (using a custom load/save routine of your choice), and then generate the sounds at runtime, ready to play with your favourite BRL.Audio driver :-)

Oh, and of course, it's a cross-platform BlitzMax module, which you simply Import into your latest groovy Retro project.

* The UI part of it is a standalone app.
* Sound data is generated into TBanks which you can then either play, or store, or whatever.

Available from here !


Oddball(Posted 2010) [#2]
sfxr is a great little utility and this sounds very interesting. I like the idea of being able to generating sounds in-game and on-the-fly. Out of interest how are you exporting wave files using BlitzMax?


slenkar(Posted 2010) [#3]
thats quite nice, good job


Brucey(Posted 2010) [#4]
Out of interest how are you exporting wave files using BlitzMax?

Funnily enough, that's the only bit I've not implemented yet :-)
But I'll base it on the small bit of code from sfxr, so it should work as well as that one.


jkrankie(Posted 2010) [#5]
Ooh, nice! I used sfxr generated sounds for most of my games! i'll look forward to using this in future!

Cheers
Charlie


Armitage 1982(Posted 2010) [#6]
Hey ! I store a "crap-load of Ogg" sounds on the drive ;)

Nice one ! I would love to use such blip-blot sound in a retro-style game.
Good luck for the rest of the portage.


ima747(Posted 2010) [#7]
This is freaking awsome... I can't wait till I have time for a project I can use this in... like I want to drop all my work right now and get started... once again I bow before your greatness.


Tommo(Posted 2010) [#8]
Cool!
I have a simple module which directly uses sfxr's source code to generate .wav from .sfs


SLotman(Posted 2010) [#9]
Niiiiice!


Brucey(Posted 2010) [#10]
Out of interest how are you exporting wave files using BlitzMax?

Turns out it wasn't so hard to implement :
	Method ExportWAV(filename:String)
		Local stream:TStream = WriteStream(filename)
		If stream Then
		
			Local audioData:TBank = FillBank()
		
			stream.WriteString("RIFF")
			
			stream.WriteInt(36 + audioData.size())
			
			stream.WriteString("WAVEfmt ")
			stream.WriteInt(16)
			stream.WriteShort(1)
			stream.WriteShort(1)
			stream.WriteInt(wavFreq)
			stream.WriteInt(wavFreq * wavBits / 8)
			stream.WriteShort(wavBits / 8)
			stream.WriteShort(wavBits)
			stream.WriteString("data")
			
			stream.WriteInt(audioData.size())
			
			stream.write(audioData.buf(), audioData.size())
		
			stream.close()
		End If
	End Method


Just need to tidy up the docs, and it should be good to go.


Brucey(Posted 2010) [#11]
Released, and available from here.


rs22(Posted 2010) [#12]
Awesome! Thanks for this. Such a cool little module. :)


Brucey(Posted 2010) [#13]
I should mention that in the examples folder, you'll find the FX generator program (aptly named generator.bmx !) and a small example which loads in a saved settings file and plays the sound (after generating it at run time).

The app is a direct port of the original C++, which is why it looks almost identical. Except that with our BlitzMax native graphics we don't require SDL :-)


Armitage 1982(Posted 2010) [#14]
So great.
I just try it and the generator is working just as good as the original.
Cool module !

It would be fantastic to have something similar for graphics. Random generator of Mario sprite ^^ Then a random level generator and voilą, game in a minute.


Brucey(Posted 2010) [#15]
I just try it and the generator is working just as good as the original.

It should be! It's using the same core engine (the original C++ core, wrapped up in a more OO API).

I got it working just the way I wanted - to generate straight to Blitz-friendly sound data - so I'm quite pleased with the whole thing. And, another of my "module in a weekend" projects too :-)


DavidDC(Posted 2010) [#16]
Instead, you can save the sound settings (using a custom load/save routine of your choice), and then generate the sounds at runtime, ready to play with your favourite BRL.Audio driver

Makes me want to make a game using procedural data only. Thanks Brucey!


Spot-Nothing(Posted 2010) [#17]
I actually used sfxr lately in on of our casual game productions. All GUI sounds and effects or done with it, only the background sound is instrumental: http://bit.ly/csjKUK


BlitzSupport(Posted 2010) [#18]
omg omg omg omg omg i love sfxr!

Thanks Brucey!