• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
AhmedSaleh

Implementing bicycle audio

10 posts in this topic

Hi All,

 

I have a bicycle, and a sound that's "clicking" simulation of the freewheel. How would you implement that clicking noise ?

Would you change the pitch of the sound?

0

Share this post


Link to post
Share on other sites

The pitch should not change, the speed of the clicks should change, according to the speed of the bike.  I think if you change the speed of the sample, the pitch would change too much, but you may want to experiment and confirm that.  Alternatively you could have several samples of a wheel spinning at different speeds?

1

Share this post


Link to post
Share on other sites

It depends on the platform you are running on.

 

In the general case you would create a new instance of the sound effect every time you want a click, but in practice this often sounds crap.

 

The best way I have found to do similar things is to create 3 or 4 sound effects for the click, each very slightly different.

 

Then randomly choose one of them and create a new instance of that when you want a click.

 

I honestly cannot tell you why this works better than just using one sound effect, but it does.

1

Share this post


Link to post
Share on other sites

I'm currently doing the following code, but I'm not sure of it

// in game loop

if (currentSate == RunnerBase.BikerStates.RUNNING)
        {
            if (!mRunningSound.IsPlaying)
            {
                mRunningSound.Play();
            }
          //  clickCounter++;
           // if (clickCounter > 15)
          //  {
                mRunningSound.AudioSource.pitch =(mBiker.BikeRunner.Speed/30.0f);
          //      clickCounter = 0;
           // }

        }
0

Share this post


Link to post
Share on other sites

That just won't work I'm afraid

 

Start off by trying this (pseudo code)

 

     LoadSoundEffectIntoMemory(CLICK);

     Update()

     {

           accumulator += mBiker.BikeRunner.Speed;

           if (accumulator>CLICK_RATE)

           {

                PlayNewInstanceOfSOund(CLICK);

                accumulator-=CLICK_RATE;

           }

     }

 

The problem is that a click from the bike doesn't stop in real life when another click starts. You get a new sound every time a click happens. So the sound overlaps, interferes with itself, sounds completely different. It doesn't go up in pitch.

 

You need to have a sound manager that supports instances and keep the click sound effect short so that the number of sound effects playing doesn't explode.

1

Share this post


Link to post
Share on other sites

would you tell me the idea in plain example ? the maths ?

 

I wanted to do if ( counter++>period) play, then make counter = 0;  is that wrong ?  why did you accumulate the speed then you subtract the rate from it ? 

this is not linear operation correct?

0

Share this post


Link to post
Share on other sites

okay consider a wheel with 36 spokes.

 

You have a clicker on one spoke.

 

So every time the wheel rotates one revolution, you get one click.

 

Say you start off slow, you only move the wheel 10 degrees in the first pass, that is one spoke moving past the reference point. So you don't make a click sound.

 

The next pass you accelerate and the wheel turns 370 degrees, that's 37 spokes passing the reference point, the accumulator is now at 38 so you make a click sound.

 

38 - 36 means that the clicker is 20 degrees past the reference point.

 

Zeroing the counter would put the clicker at the reference point, so you have lost 20 degrees of rotation and delayed the next click.

 

If you want a really good effect you will have to do a lot more work, but this simple technique will give you a starting point.

Edited by Stainless
1

Share this post


Link to post
Share on other sites

That's really the idea of a basic wheel encoder, where you count the ticks of the wheel, correct?

 

What are your suggestions to make it better?

Edited by AhmedSaleh
0

Share this post


Link to post
Share on other sites

Once you get up to a speed where you are generating a lot of clicks, it will start to sound a bit weird.

 

It's due to the nature of sampled sound, analogue signals combine in a different way than digital signals.

 

Also the clicker does not return to a stable state between clicks. It doesn't have time to settle down to a stable state. So the sound it creates changes.

 

Think of a guitar string, pluck it when it is stationary and you get one sound, pluck it several times in a row and you get a more complex sound.

 

To emulate this I would have several click sound effects in memory and select one at random each time you play one. 

 

The end result should sound a lot better than the simple case.

1

Share this post


Link to post
Share on other sites

How about getting the reverse ? when the bike settles or decelerating? it should clicks in reverse ?
doesn't hear nice :/

   clickCounter += mBiker.BikeRunner.Speed;
            
            if (clickCounter < clickRate)
            {
                if (!mRunningSound.IsPlaying)
                {
                    mRunningSound.Play();
                }

                clickCounter -= clickRate;
            }
0

Share this post


Link to post
Share on other sites

Because you are only playing one sound effect and if it is already playing, you don't play it at all.

 

You have to play multiple sound effects.

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0