Need some beeps, boops, or bops, to go with your UI or games? Here’s a quickie for you. Got the idea from my Making Waves post.
Just mess around with the sliders (or choose a preset), press ‘play’ to preview the sound, and ‘save’ to save the sound locally as a .wav file. There’s a bit of a strange bug though. The saved files play slower than previewed sounds. But that’s what you get in a lunch hour.
If I sort that problem out (and if anyone has any ideas on what would cause that, post a comment), I may elaborate on this a bit more and create a desktop version in AIR. We’ll see.
This is Awesome Devon, I wish I had this about 200 projects ago. Very cool! Hard to say what the problem is without looking at the code but I wonder if the playback speed has to do with framerate at all?
Thanks Dave. It’s not framerate dependent – it just uses the SampleDataEvent to play back a generated bytearray (which is saved when you save the file). May have something to do with the sample rate and/or bit rate of the generated wav (I’m using 16 and 44.1k).
Since audio in Flash is stereo, 44.1kHz and 32 bit float and your wav is mono, 44.1kHz and 16 bit fixed I would have guessed that the issue is not to do with samplerate as such.
What’s happening is that in effect you get double the samplerate in the Flash Player or half the samplerate in the wav, but that is probably because of samples going missing or doubling somewhere. Either in the routine to convert from 32 bit stereo to 16 bit mono, or when filling the output buffer.
Thanks for ideas Leo (definitely not much of a sound programmer). I’ll make checking that out today’s lunch hour project.
A little simplistic compared to SFXR (also available as a Flash version, with open source AS3 code), but still fun