Very basic macro to play sounds

49 views
Skip to first unread message

Charlie Veniot

unread,
Jan 5, 2022, 11:16:49 PM1/5/22
to TiddlyWiki
G'day,

Download the attached and drag into tiddlywiki.com to import the 3 tiddlers.

"I Play Sound on Render" tiddler references the sound macro, playing a tone upon render of the tiddler.

The related macro is in the "Macro" tiddler.

The "HTML Sound Player" tiddler is fed by the Macro into an iframe to execute the javascript that creates the sound.

Because sounds at higher frequencies sound obnoxiously loud, I've set things up to make the higher frequencies less loud and the lower frequencies louder.

Kind of an easy way to generate simple beeps and boops and bell sounds without much fuss.


TW_SoundMacro.json

Charlie Veniot

unread,
Jan 5, 2022, 11:33:57 PM1/5/22
to TiddlyWiki
For the giggles (a "bonking one's head on a metal pipe" sound), put the following in a tiddler:

<<sound "200" "2" "exponentialRampToValueAtTime">>

<<sound "500" "5" "exponentialRampToValueAtTime">>


So a way to simultaneously play multiple sounds for some goofy effects.

paulgilbert2000

unread,
Jan 11, 2022, 6:33:45 PM1/11/22
to TiddlyWiki
Hi,

sorry for the ignorant question , but what format are these sounds ,midi ?

Charlie Veniot

unread,
Jan 11, 2022, 8:54:32 PM1/11/22
to TiddlyWiki
Strangely enough, I've seen the word MIDI for ages, but never looked it up.  MIDI is a standard communication protocol for electronic music instruments/equipment.

The generation of sounds in what I've done is just generation of frequencies using the web audio api.

I had to do a lot of digging, putting together bits and pieces from all over the place, to get a very rudimentary understanding of it all.

Reply all
Reply to author
Forward
0 new messages