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
0
Question by Xalemich · Jan 08, 2015 at 11:13 PM · soundsound on keysound-overlapping

Multiple sound sources of the same sound file

Hello Unity Answers

In what I am certain is a less than optimal way to go about playing multiple instances of the same sound, I have created a metric ton of different empty Game Objects that functions as Sound Sources.

The problem I am working on is this: I want to be able to play a tone repeatedly and possibly overlapping. My program is a basic "create some notes and play music" kind of setup, where the user has to be able to start a tone when desired. There seems to be a fairly large problem in the way I (or Unity?) grasps this task. When the user activates a Sound Source NOTE, let us call it SS-A-NOTE-1, and activates the same note through a different Sound Source, SS-B-NOTE-1, it cuts SS-A-NOTE-1 off in order to play the newly requested note, even though the same Sound Source Object is not invoked. I am using a simple SoundSource.Play() function to get it to start each note.

As far as I have been able to tell, this is caused by the actual audio-file being the same, since the problem does not occur in any configuration of non-identical notes. Is there an option that allows me to play the same notes without cutting the previous one short, and without adding what would be a ridiculous amount of audio-files to the build?

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
0

Answer by Juice-Tin · Jan 08, 2015 at 11:39 PM

http://docs.unity3d.com/ScriptReference/AudioSource.PlayOneShot.html Play a any sound from a single sound source as often or overlapping as needed.

Comment
Add comment · Show 2 · 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
avatar image Xalemich · Jan 11, 2015 at 09:29 PM 0
Share

That does seem to have been a major improvement, thank you =D

avatar image Xalemich · Jan 11, 2015 at 09:45 PM 0
Share

Hmmm, it seems like the cut-off is still present now that I have listened a little closer. I was apparently listening to the tones with a markedly shorter tail-fade, while the longer lasting tones still seem to get interrupted by the repeat audio.PlayOneShot(---) calls.

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

how to have multiple game objects play a single looping sound 2 Answers

synchronized sound on collision script 1 Answer

Morse - beeps not clear 0 Answers

How to stop a sound from overlapping itself? 0 Answers

Hearing all distant audio sources (loud!!) on play (solved) 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