Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
5
Question by Mifuyne · Mar 29, 2011 at 02:33 AM · musicpitchfrequency

How does AudioSource.pitch changes pitch?

I looked for this on Google and here and I can't seem to find an answer. There was an idea bouncing around about a music-based portion to our game (possibly in a form of a musical grid). I thought it would be more efficient to just have one audio file and simply change the pitch of it according to which grid cell is pressed/triggered.

I looked it up in the Script Reference and it doesn't say how it changes the pitch. There are many ways I can see it changing:

  • Frequency
  • Cent
  • Semitones
  • Percentage

Does anyone know how this is handled? Would it be accurate enough to do it this way or I should just save myself the trouble and create multiple sound files for each pitch. I'm guessing octaves can be done through changing this variable, but I would still need to know how Unity changes it.

Thanks!

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
2

Answer by Jessy · Mar 29, 2011 at 12:37 PM

Pitch is just a linear playback speed multiplier. Here's a project that uses that principle, to make an equal temperament musical instrument, using only one audio clip, at one pitch.

(If you don't know what equal temperament is, the basic idea is that there are 12 notes to an octave, and an octave is a doubling of frequency, so the frequency ratio of any note to the note below it is the 12th root of 2. There are many other forms of temperament, of course, but this one is probably easiest to implement.)

Also, because of what "pitch" is, You can play sounds in reverse by using negative numbers.

Keep in mind, though, that changing pitch also changes formants. That means that if you're dealing with voices, you'll get the Alvin & the Chipmunks effect if you pitch things up, and The Knife effect if you pitch things down. Non-human voice sounds won't sound noticeably as messed up, but this is not a modern way of using a sampler. Most samplers today use several samples for every note, for various velocity levels. There are a lot of tricks these days, to change pitch without changing formants, but none of them sound as real as getting a good recording.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

Generating an Exact Muscial Note 1 Answer

Read the pitch frequency of a audio clip 2 Answers

Getting beats from a song using frequency range 1 Answer

getting pitch 1 Answer

Forming chords & playing multiple sounds simultaneously 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges