Audio Analysis

I started looking at the old manual about .VOC files. Its for making PC speaker sounds, but all 30 sounds are saved as one .VOC file that is compatible with the Sound Blaster. My assumption is that the “VOC” extension stands for “Voice”, and is simply an audio buffer that isn’t specific to wave forms. I couldn’t find any additional details in the manual regarding the frequency values, duration, or wave form.

I went back to the DOSBox website to create a sample pattern of audio to record an analyze, altering between high and low frequencies. This was done to give me some markers to evaluate the duration of each marker.

Creating an audio sample in RDS Game Maker that can be captured easier.

From here, I was able to recode the audio with Audacity. Zooming in fairly close, I saw that it generated sine wave forms. I honed in on the duration between two of the alternating bars. Selecting an area starting at a high peak, and ending at the end of the low frequency resulted in 0.014 seconds – indicating that each bar represents 0.007 seconds.

Audacity: Selecting the beginning of two wave forms gives me the Length of 0.014 seconds.

The next task was to determine the value of the higher frequency. I analyzed the audio with a plot spectrum set to graph the frequencies. It looked like the loudest part of the sound was around 4070 Hz

Using Audacities Plot Spectrum to identify frequencies
Plotting Standard Autocorrelation in Audacity

From this point, I have collected enough data to start implementing it within the experimental audio api app.

PropertyValue
Bar Duration0.007 seconds
Bar Count36
Total duration0.252 seconds
Max Frequency4070 Hz
Wave FormSine
Data collected from RDS Game Maker Sound Editor

After making a few changes to the audio-fx project to inject sign waves for each bar in the audio buffer, I was able to get it to react similar to the sound editor in RDS Game Maker. Just click and drag your mouse to change the frequency!

Drawing Sound Effects with HTML Canvas element and Web Audio API

So what was this all for? I want players to have the ability to get creative. Not with just textures alone, but also to create their own sound effects. With just 36 numbers, I can create a very lightweight audio format using 36 bytes of data, where each value is multiplied by 16 to get the frequency. It would bump the maximum frequency to 4,080 Hz. One caveat is that people generally can’t hear below 20 Hz. Should I modify the frequency mapping so that “1” can be heard, or just leave it as-is.

Byte ValueFrequency
00 Hz
116 Hz
232 Hz
2554,080 Hz
Mapping 36 bytes to frequencies

I could also make it so that the file indicates how many “bars” there are (36), and another value representing the duration of each bar. Allowing control over the duration and number of bars would pave way for also storing simple songs in addition to short sound effects.

DataData TypeHexDecimalValue
Bar CountUInt1600 363636 Bars
Bar Duration MillisecondsUInt1600 0770.007 seconds
Bar 1Byte04464 Hz
Bar …Byte… Hz
Bar [Bar Count]Byte3B59944 Hz
Sample file format of a sound effect

The code is on GitHub: CodeJamboree/audio-fx 00f6f84362e7dcc6697d4c9ddeb271a386e28792

2 responses to “Audio Analysis”

  1. […] had experimented a little bit with the Web Audio API by making a synthesizer and a way to create custom Sound FX similar to Recreational Software Designs: Game Maker. My new focus is on short-range data transfer […]

  2. […] store a small amount of data that instructs us as to how to build the sound effect. I can currently make sound effects with 36 bytes of data letting users draw their sound effects similar to what the old RDS Game Maker […]

Discover more from Lewis Moten

Subscribe now to keep reading and get access to the full archive.

Continue reading