Clear Filters
Clear Filters

How do i get the sound of a cosine signal

8 views (last 30 days)
I am trying to get the sound of a signal with different phases where its frequency is a frequency of a musical note. f=493.88. My code is below.
soundsc(xc1, 1000)
When i try to run the sound i just get a tapping sound for 1 milisecond and then it stops. How do get the sound of the signal? Thank you in advance.

Accepted Answer

Scott MacKenzie
Scott MacKenzie on 12 Jun 2021
You've only got 100 sample points and the sampling rate is too low. Try this...
soundsc(xc1, 8000)
Scott MacKenzie
Scott MacKenzie on 12 Jun 2021
Edited: Scott MacKenzie on 12 Jun 2021
I'm not sure what you mean by "the sound would be the same for all signals right?". If the signals you are referring to are xc1, xc12, xc13, and xc14, then yes, the sound will be the same. The waveforms in these vectors are identical except you've added a bit of a phase shift (e.g., "+pi/2"). The phase shift does not affect the sound.
Deniz Bozdogan
Deniz Bozdogan on 12 Jun 2021
That's what i was asking for thank you.

Sign in to comment.

More Answers (1)

Image Analyst
Image Analyst on 12 Jun 2021
Scott is right on.
For what it's worth, I'm attaching my demo for making a warbling, decaying chirp sound:




Community Treasure Hunt

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

Start Hunting!