Problems using the function audiowrite (2024)

19 views (last 30 days)

Show older comments

Hello, I'm working with Matlab R2014b and trying to create a wav file. I tried two posibilities:

- wavwrite(int32(signal),Fs,24,['test2.wav'])

- audiowrite(['test.wav'],int32(signal),Fs,'BitsPerSample',24)

But when I try to heard both files, I can only heard the first one created with the old function wavwrite.

In both case is the same signal.

any help?

0 Comments

Show -2 older commentsHide -2 older comments

Sign in to comment.

Accepted Answer

Problems using the function audiowrite (2)

Nick Haddad on 13 Nov 2015

There is one subtle difference between writing 24-bit audio with audiowrite vs. wavwrite.

When writing int32 as 24-bit audio in wavwrite, the data range in y is interpreted as:

2^23 y ≤ 2^23–1

When writing an int32 as 24-bit audio in audiowrite, the data range in y is interpreted as:

-2^32 y ≤ 2^32–1

So your data is still being written but slightly quieter. If your 'signal' variable is in the 24-bit range you will need to rescale it to the 32-bit range to get the same results as using wavwrite. If 'signal' is just a normalized double (-1 ≤ y ≤ 1), the you can simply supply the double value and audiowrite will scale it for you properly:

audiowrite(['test.wav'],signal,Fs,'BitsPerSample',24)

1 Comment

Show -1 older commentsHide -1 older comments

Sign in to comment.

More Answers (0)

See Also

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

An Error Occurred

Unable to complete the action because of changes made to the page. Reload the page to see its updated state.


Problems using the function audiowrite (4)

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list

Americas

Europe

Asia Pacific

Contact your local office

Problems using the function audiowrite (2024)
Top Articles
Latest Posts
Article information

Author: Francesca Jacobs Ret

Last Updated:

Views: 6612

Rating: 4.8 / 5 (68 voted)

Reviews: 91% of readers found this page helpful

Author information

Name: Francesca Jacobs Ret

Birthday: 1996-12-09

Address: Apt. 141 1406 Mitch Summit, New Teganshire, UT 82655-0699

Phone: +2296092334654

Job: Technology Architect

Hobby: Snowboarding, Scouting, Foreign language learning, Dowsing, Baton twirling, Sculpting, Cabaret

Introduction: My name is Francesca Jacobs Ret, I am a innocent, super, beautiful, charming, lucky, gentle, clever person who loves writing and wants to share my knowledge and understanding with you.