Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

racing sound

Discussion in 'Scripting' started by slashdotray, Dec 3, 2006.

  1. slashdotray

    slashdotray

    Joined:
    Dec 3, 2006
    Posts:
    77
    hi folks,

    im a new member of the totally crazy unity engine.
    i started a project and i now have a question.

    in the 1.6 version unity supports audio.pitch.
    i tried to add a sound to my racing car, and it works.
    now i have a problem. if the car is moving faster, it should pitch the sound variable from .5 to 2.0.

    i tried to add audio.pitch to the tutorial car script.
    it looks like audio.pitch = 1.0 * rpm.
    the rpm is computed in the tutorial car script...

    no error message, but nothing happens.

    could someone please help me?
    i am not a freakin coder, but i want to become one.

    thanks all in advance
     
  2. AaronC

    AaronC

    Joined:
    Mar 6, 2006
    Posts:
    3,553
    The doppler doesnt work on ppcs if thats a help
    AC
     
  3. CoherentInk

    CoherentInk

    Joined:
    Jul 16, 2006
    Posts:
    216
    I understand that the Doppler Effect doesn't work on OS X PPC machines, but I didn't realise that AudioSource.pitch doesn't work either.

    That sucks.
     
  4. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Ack; I hadn't tried the new sound stuff yet so I didn't know that. Is that going to be fixed I hope?

    --Eric
     
  5. antenna-tree

    antenna-tree

    Joined:
    Oct 30, 2005
    Posts:
    5,324
    Ouch, I didn't realize this either. Is this fixable or just a sign of the times of starting to leave the PPC architecture behind?
     
  6. Cav

    Cav

    Joined:
    Aug 2, 2006
    Posts:
    93
    yea, i hadnt realised this yet either...is there going to be a ppc fix?
     
  7. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,777
    I would imagine that the Doppler effect is created *using* audioSource.pitch, so their fates are probably intertwined.

    I personally doubt PPC will be supported for this in the future, but I can't speak for OTEE.
     
  8. AaronC

    AaronC

    Joined:
    Mar 6, 2006
    Posts:
    3,553
    Its on the cards I thought. Unity2 I think. google doppler on the docs
    AC
     
  9. slashdotray

    slashdotray

    Joined:
    Dec 3, 2006
    Posts:
    77
    Sorry, i don´t understand.

    if an audiosource has got the parameter .pitch it works if i modify this.

    but doing audio.pitch in the car script, it doesnt work.
    is there sombody out there who can tell me how to do audio pitching with my car?

    is there some other solution around?

    thanks you

    ps. i got an intel mac
     
  10. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    Doppler and pitch does work on several PPC machines we have here. For anyone that has it not working, please run Report Bug.app, write like "doppler does not work, ppc" and send it to us. Hopefully that will give us some insight why it's not working.
     
  11. slashdotray

    slashdotray

    Joined:
    Dec 3, 2006
    Posts:
    77
    hopefully i don´t be misunderstand.
    my problem is a personal one, i dont know how to script a changing sound for my race car.

    it isn´t not a unity one, or am i wrong?

    if somebody created a race game, he must have the same problem.
    how to modify the race sound ?
    sorry for my bad english, its not my mother tongue.....
     
  12. Cav

    Cav

    Joined:
    Aug 2, 2006
    Posts:
    93
    i'll stop bitching as im only going on what i've read here!....I will get around to actually testing out the new audio stuff myself on the powerbook G4 here at some point soon and see how it goes.
     
  13. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    in theory,

    audio.pitch = 1.0 * rpm

    is what about you want, but if you just take the rpm parameter from the car example, you'd have a range from ~800 to 6000, which will give you pitches way out of reach for OpenAL.
    Also, I wouldn't scale engine pitch proportionally with RPM (doesn't sound realistic). Try something like this instead:

    audio.pitch = 0.5+0.9*rpm/maxRPM

    you might also want to make the volume correspond to throttle input.
     
  14. slashdotray

    slashdotray

    Joined:
    Dec 3, 2006
    Posts:
    77
    ok, thanks jonas, i will try this @ home.

    to put this to the controller-input is a good idea.



    but anymore, are there no questions about doing engine sound in racing games?

    thanks again
     
  15. David-Helgason

    David-Helgason

    Moderator

    Joined:
    Mar 29, 2005
    Posts:
    1,104
    Just to put it firmly: we are not dropping PPC support anytime soon. There seem to be some problems with pitch on some PPCs and we'll work on that.

    d.
     
  16. slashdotray

    slashdotray

    Joined:
    Dec 3, 2006
    Posts:
    77
    thanx to all.

    it works :)

    great community i love unity thank u ottee
     
  17. AaronC

    AaronC

    Joined:
    Mar 6, 2006
    Posts:
    3,553
    great
    just for the record, I wasnt complaining. I dont understang doppler carry-on yet, but I did search the docs and found this, so I was making my statement based on that
    AC
     

    Attached Files:

  18. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    That documentation is outdated :)
    Doppler works on ppc and intel (I realise that there are some bugs with this in the different implementations, the ppc should be fine now, looking into intel later).
     
  19. AaronC

    AaronC

    Joined:
    Mar 6, 2006
    Posts:
    3,553
    I've had quite a bit of audio experience, but a doppler is a new concept to me. Is there a good example of using this anywhere? Maybe someone from OTEE could knock up a wee package? Prudy Please?
    AC
     
  20. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    Doppler is mostly interesting if you have objects with high velocities relative to each other. Like a car or plane passing by. Just try setting up a looping sound source attached to an object which is passing the camera at a high speed to get an impression of the effect.