Fun with frequency modulation

BlitzMax Forums/BlitzMax Programming/Fun with frequency modulation

Taron(Posted 2016) [#1]
Ok, this is not really real time synthesis, but a little FM experiment I just did today and it turned out unexpectedly spooky and somehow so cool.


It's kind of like cosmic wind chimes... :o)))

...have fun!


dw817(Posted 2016) [#2]
Outstanding, I like how you can add one sound directly over another, Taron !

Could you make a kind of library, w arguments to introduce to the function ?

And perhaps a few others to create simple pitch say 0-255 where 0 is very low, almost inaudible, and 65535 is very high, almost inaudible ?

Function tone(pitch{0-65535},duration{0-65535},channel{0-7},volume{0-255},attack{0-65535},decay{0-65535})
Where all arguments are optional, pitch defaults to say 32768 for a medium tone, duration defaults to 256, short beep, channel defaults to zero, if in use, choose next channel, Volume defaults to 127, middle, attack defaults to 65535, immediate, and decay defaults to 65535, immediate.

Also a white noise generator:

function wnoise(pitch{0-65535},duration{0-65535},channel{0-7},volume{0-255},attack{0-65535},decay{0-65535})

I think these 2 (or more) audio functions would help a lot of people and I certainly would make use of this w full credit to you.


Taron(Posted 2016) [#3]
hehehe, white noise has no pitch, really, but yeah, I think I hold up until I make the real time synthesis tutorial for you guys!
This was just a fun experiment with wicked result that I just couldn't keep from you! ;)

Thanks, of course! I'm happy you like it and apparently are so beautifully inspired! That's fantastic!


BlitzSupport(Posted 2016) [#4]
Awesome noise!


Taron(Posted 2016) [#5]
Hehehe, thanks! My favorite aspect of it is the reverb sensation, totally just comes with it's nature. I mean, even if you were not to "fade" the sound... fascinating. 8D


dw817(Posted 2016) [#6]
Hi Taron, by White Noise w pitch I mean the ability to raise and lower the tone of it. Here are some examples.

https://www.youtube.com/watch?v=3vEDZ-_iLNU

So White Noise would be close to top pitch and brown noise close to bottom pitch.

You should be able to create a function where 65535 is a barely audible and very high-pitched sound whereas 1 would be a barely audible very low-pitched sound (deep rumble).


BlitzSupport(Posted 2016) [#7]
White noise is all frequencies by my understanding, so pitch doesn't apply -- I think it's the pink/brown noise areas where you get into specific ranges of frequencies.

BTW, dw, have a look at Taron's earlier realtime synthesis stuff -- it was fantastic, but the early demo code in particular was pretty easy to understand.


GW(Posted 2016) [#8]
In terms of computer generated music (including the old consoles), the noise channel does have a frequency component. In the good ol' days, music was made with all the drum instruments using the single noise channel at different frequencies; snare,highhat, bass ect.
Example:Here (Press 'play')


BlitzSupport(Posted 2016) [#9]
Of course... it's not white noise, that's all.


dw817(Posted 2016) [#10]
Hi GW & BS:

By pitch I mean low noise would be the sound of a space engine.

Higher might be the thrum you hear from factory machinery.

Higher might be applause.

Higher still might be rain.

Higher than that might be a waterfall.

Higher than that might be steam coming out of a pipe.

All of these examples application should be possible with a well-developed sound library.

Tried your PLAY example, GW. Pretty slick ! Reminds me of building instruments from scratch in SONIX, a music player for Commodore Amiga. I made one called Aura that was just heavenly. :)


Taron(Posted 2016) [#11]
Uh, wow, you guys have been busy! 8D
No, no, I understood what he meant with white noise, basically quantizing it to alter the rate, which is the traditional SID like noise sound or NES. Simply call it "noise", which is what that might be.
I would prefer to filter it instead, but it wouldn't have the same charm.

I might play with that a little. I just hooked up some rudimentary filter to the cosmic demon chimes up there, hahaha, it's so hypnotic. I'm thinking about aiming for some healing frequencies, hehehehe...Solfeggio scales.

Anyway, jokes aside, this is really fascinating, but I should try to make a proper threaded real time synthesis with this. Might be fun to have a proper FM synth via BlitzMax, hehehe! :o} ...odd thing, though, I don't like FM sounds that much. xD


dw817(Posted 2016) [#12]
Taron, if it's easier for you, you are more than welcome to make a MOD of it with your stamp of approval.

Function tone(pitch{0-65535},duration{0-65535},channel{0-8},volume{0-255},attack{0-255},decay{0-255})

noise(pitch{0-65535},duration{0-65535},variance{0-255},channel{0-8},volume{0-255},attack{0-255},decay{0-255})


if pitch is zero, it is the same as volume 0, no sound. If channel is chosen that sound is silenced immediately.

If Channel is zero then it will pick the first free and available channel.

Variance, only seen for noise is a value from 0-255. If it is zero, it makes the same sound as tone. If it is 255, then it is pure noise. Values between make it sound like a combination of the two. For instance, a lower number might sound like a raspy klaxon alarm. You can hear the pitch of the alarm but it is also staggered with noise.

This functions really would be most helpful to ALL game writers, including me !


dw817(Posted 2016) [#13]
Taron (or somebody ?), are you still working on this ? I hope you are as it will finally give BlitzMAX the ability to create useful sound on the fly.


skidracer(Posted May) [#14]
For lower concious-ness-niceness (and less harmful frequencies) mod line 23 like so:


sample =CreateAudioSample( length ,2000,SF_MONO16BE )




Taron(Posted May) [#15]
Hahaha, you dug this one up!? 8D
...Bmax is surprisingly fun for audio, that's for sure!


skidracer(Posted May) [#16]
That sound, you hear? That is the sound of thread necromancy.

Also, I slept like a lamb after 50 minutes at 2KHz.


GW(Posted May) [#17]
...Bmax is surprisingly fun for audio, that's for sure!

I wrote a chiptune tracker in bmax. The audio streaming part was the easiest part of it.

Btw: Taron, are you ever going to publish the improvements you made to Musagi?