Fun with sound... (retro-tastic!)
BlitzMax Forums/Brucey's Modules/Fun with sound... (retro-tastic!)| 
 | ||
| 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 ! | 
| 
 | ||
| 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? | 
| 
 | ||
| thats quite nice, good job | 
| 
 | ||
|  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. | 
| 
 | ||
| Ooh, nice! I used sfxr generated sounds for most of my games! i'll look forward to using this in future! Cheers Charlie | 
| 
 | ||
| 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. | 
| 
 | ||
| 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. | 
| 
 | ||
| Cool! I have a simple module which directly uses sfxr's source code to generate .wav from .sfs | 
| 
 | ||
| Niiiiice! | 
| 
 | ||
|  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. | 
| 
 | ||
| Released, and available from here. | 
| 
 | ||
| Awesome! Thanks for this. Such a cool little module. :) | 
| 
 | ||
| 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 :-) | 
| 
 | ||
| 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. | 
| 
 | ||
|  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 :-) | 
| 
 | ||
|   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! | 
| 
 | ||
| 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 | 
| 
 | ||
| omg omg omg omg omg i love sfxr! Thanks Brucey! |