In my never-ending quest of looking for fashionable improvements (believe me, it can entertain me for ages 🙂 ) I found out a cute thing about some fancy shoes: they have nice, realistic-sounding, heel-clicking sounds.
Sure, I know it’s a “novelty” item — it scares people off the first time you start nagging them with the clicking sounds, then they begin to make silly comments, so it’s also a great way to break some ice!
In any case, this was one of the many things that I imagined that would be immensely popular, and that after a few months, every shoe I bought had heel sounds.
Alas, it didn’t happen. Only a few designers give that as an option! Why? I investigated…
Well, what are “clicking heel sounds” anyway? Avatars already do a soft “bumping” sound when they walk on top of prims. This sometimes happens, sometimes not; I have never figured out when these sounds are called or not. It might also depend on the version of SL — like the foot shadows, this could be one of those things that get deleted by mistake on some versions, then appear again later, to disappear mysteriously again on subsequent versions. So, you can’t rely on them.
In any case, although you can change the sounds for “bumping” into items, feet attachments (also known as “prim shoes”) don’t seem to use these library sounds. For some reason. Perhaps they would be too annoying, I don’t know! In any case, the default ones are a “soft bump”, not sexy heel sounds. So… scripting to the rescue!
As I’m not a professional programmer, I hate to “reinvent the wheel”, and looked for something available on the LSL Wiki’s public function/script library. There was nothing there.
Well, this should be something easy to make, and thus also cheap to buy. I looked at the usual places, namely, SL Exchange. What was my surprise to see that the cheapest script doing exactly this costed L$4000! Four thousand Linden dollars! People must be insane! You can get Francis Chung’s incredibly detailed car — thousands of lines of code, awesome prim work, incredible textures — for far less than that!
This shocked me so much — like the “sitting down” modification for flexiprims that I posted earlier, heel-clicking sounds should be part of the “default” package of scripts for all clothes! — that I rolled up my sleeves, and after a discussion on the Mental Mentors group where Data Linden suggested that this was quite easy to accomplish, it was back to Gwyn’s Lab to throw some lines of code together.
First, the sounds. Observing what happened with one pair of shoes I’ve got, it was clear that you need two sounds: one for walking, and, for added realism, one for stopping (two short heel clicks as the feet come together). I had no patience to do my own sounds (I’m planning to do them soon!), so I just grabbed a sound bit from a public sound library (I used something from the Freesound Project). Since I’m also not a professional sound engineer, this took me way more time to cut just the bits I wanted and filter them out; the results are not good, but recognisable as “heel-clicking sounds”. I’ll do better with my own sounds in the future and upload them to the Freesound Project one day 🙂
The next thing was timing the walk. What you need is just to measure how many steps your avatar takes during a normal walk (my not-so-precise calculations using one of my sexy walk anims gave me very roughly 2 steps per second). Then all you need it to run a timer that is called every 0.5 seconds and plays the clicking sound. That’s it!
Ok, so, for added realism, it’s nice to check if you’re avatar is actually walking or not, and also check when you change from “walking” to “standing” so that you can play the “double-heel-clicking” sound. I guess that you could go insane with this and use a “grating sound” when turning around on your heels. Also, to make this work perfectly, you should have two scripts, each running for 1 second, and playing the heel sound for each shoe independently — that would be hyper-realism (sounds are emitted from the place they’re played), and you could even have a sound for the right shoe and the left shoe! That’s all left as an exercise for the reader.
// Gwyneth Llewelyn’s Heel Clicking Sound
key oneClickHeel = "d9297660-23d0-e56c-a740-e36a7354ae8b"; // normal walking
key twoClickHeels = "2944ac79-24d2-5728-1c0a-ac2d47fcaa05"; // when stopping
integer walking = FALSE; // to check for transition — walk-to-stop
key avatar; // avatar using these shoes
default
{
state_entry()
{
llCollisionSound(oneClickHeel, 0.5); // it doesn't hurt...
}
attach(key avatarID)
{
if (avatarID)
{
avatar = avatarID;
// Set up walking timer
llSetTimerEvent(0.5); // apparently you take a step every half second
}
else
{
// NULL means object detached
llSetTimerEvent(0.0);
}
}
timer()
{
// Check if we're walking; if yes, play sound
if (llGetAgentInfo(avatar) & AGENT_WALKING) // this should catch running, too!
{
llPlaySound(oneClickHeel, 0.5);
walking = TRUE;
}
else
{
if (walking) // were we walking and just stopped?
{
llPlaySound(twoClickHeels, 0.5);
walking = FALSE; // ok, transition finished for this loop.
}
}
}
}
Code language: LSL (Linden Scripting Language) (lsl)
To use it, just drop it into a shoe, detach the shoe, and attach it again! That’s all. If your shoe is non-modify, you can still enjoy the clicking sounds: just attach an invisible prim to your lower leg, adjust it to be as low as you can (so that the sound comes from as near to the shoe as possible), and that should work… for any shoe, even ugly Linden shoes (does anyone still use these??).
I’m actually being a bit pedantic here. You can leave out the llCollisionSound()
call if you wish.
So what do you get for L$4000 beyond the above lines of code? Well, for starters, you get better sounds, of course. Probably some are even professionally made by sound engineers. The scripts I’ve seen also allow you to switch between different sound sets (ie. heels on stone, concrete, gravel, wood, etc.) as well as the volume (I’ve opted for a 50% volume by default). But… that’s basically all you get! For L$4000!
I think that’s pretty outrageous, even if you’re paying basically for licensing the sounds done by a professional engineer! If the sounds are an issue, just record them yourself 😛