- Home /
Problem is not reproducible or outdated
Help adjusting Audio script settings to a specific sound
using UnityEngine; using System.Collections; public class PitchChange : MonoBehaviour { public AudioSource Audio; public float StartingPitch = 1.0f; public float EndingPitch = 2.0f; public float PitchUpScaleFactor = 3.0f; public float PitchDownScaleFactor = 2.0f; bool isMousePressed = false; void OnMouseDown() { isMousePressed=true; } void OnMouseUp() { isMousePressed=false; } // Update is called once per frame void Update () { //If mouse is pressed, increase pitch if(isMousePressed == true) { if(Audio.pitch <= StartingPitch) { Audio.Play(); } //Only increase pitch if "EndingPitch" value has not been reached if(Audio.pitch <= EndingPitch) { Audio.pitch += ((Time.deltaTime * StartingPitch) / PitchUpScaleFactor); } } //Otherwise, decrease pitch back to normal, until we reach starting pitch else { if(Audio.pitch > StartingPitch) { Audio.pitch -= ((Time.deltaTime * StartingPitch) / PitchDownScaleFactor); } else { Audio.Stop(); } } Debug.Log(Audio.pitch); } }
Below Ive attached a link to a project Ive been working on. The script was created by someone in the community who was really generous to help me come up with something like this. Basically is a PA300/EQ2B Siren Simulator. These are both widely used sirens in the world but Im going for the FDNY PA300 Model however the EQ2B Is an overall general Siren no different sound on any model. The project has a simple button that winds up and winds down a certain audio you put on the audio source itself. Now what Ive been trying to accomplish for the last 6 hours is to get the closest I can to the real sirens by editing the parameters of the script. Now if ANYONE could even try to help achieve the sound and feel Im looking for it would help ALOT. Here are examples of the sirens Im trying to make.
FDNY PA300: http://www.youtube.com/watch?v=rg7tdrS06M8
and an EQ2B (Electronic Q Siren) : http://youtu.be/ntSjxlpI-nI?t=1m40s watch 4:16 for a windup of the siren (This is a minor response so not much siren use)
Now feel free to edit the audio, the script and the parameters to try to get closer. I really need anyones help. Ive been trying for 6 hours and havent been able to come up with anything close. Thank you!
PA300: https://soundcloud.com/user851264436/fdny-pa300-in-action & https://soundcloud.com/user851264436/fdny-eng-309-reported-manhole
Rafael, this is UnityAnswers. The format of this forum, unfortunately, is not suited to simply posting a zip file, and expecting a discussion where people try to edit/write/experiment with your code for you. For that, you should post in the Unity Forums.
Here, what you need to do is post code, and ask a very specific question related to that code.
Thats much better.
Youtube is disable where I am at, so perhaps you can upload the audio of the siren elsewhere?
sure If you give me your email I can send you two samples of audio?
Done check the edit, im uploading another example of the PA300 now and an example of the EQ2b All are up
Follow this Question
Related Questions
Audio Listener not working. 1 Answer
How to change priority of audio clips 2 Answers
Footsteps Sound Effect causing other Audio Clipping or no sound at all. 1 Answer
Play Audio Specific Speakers 0 Answers
Audio Sounds Blurring Together 0 Answers