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 werbnm · May 02, 2012 at 10:24 AM · audioaudiocliprecording

How to edit audioclip?

Is there a way to merge two clip into one or replace part of clip? ex. replace 9~10 seconds sound for another short clip ...

BTW should I use GetData() and SetData() ?

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 gregzo · May 02, 2012 at 10:54 AM

Yes, you should use GetData and SetData, as well as AudioClip.Create

Look it up in the docs, it's all there!

Do ask again if you can't manage.

Tips: -GetData() will fill the float array you feed it. If your array is longer than the clip's samples, expect a crash.

-Same applies to SetData: the float array needs to be shorter or equal to the number of samples in your clip.

-You can offset both with set and get data. Handy in many cases.

Comment
Add comment · Show 7 · 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 werbnm · May 03, 2012 at 07:24 AM 0
Share

Actually, I followed the doc, but I got an error "Cannot get data from streamed sample"

I still can't figure out why....

avatar image gregzo · May 03, 2012 at 07:47 AM 0
Share

In your assets, select your clip, and set LoadType to Load in $$anonymous$$emory. I've never tried GetData with mp3's, so if that's your format it might be a problem too.

avatar image werbnm · May 03, 2012 at 08:05 AM 0
Share

Yes, I chose Compressed in memory, hmm..

what kind of audio clip type could be used??

avatar image gregzo · May 03, 2012 at 08:23 AM 0
Share

native (wav) if you want to do any kind of real time manipulation

avatar image werbnm · May 03, 2012 at 08:55 AM 0
Share

what's the offset meaning? Does it decide where the start pos?

I use it

int middle = audio.clip.samples * audio.clip.channel / 2;

audio.clip.SetData(samples, middle);

but it crashed...

Show more comments

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Record and play audio-edits in-game 1 Answer

Recorded Audio empty when used in app 0 Answers

Microphone capture different channels 0 Answers

Screenshot Movie with Audio Capture 1 Answer

Breathing volume increases as player gets more tired 0 Answers


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