Message Boards Message Boards

0
|
7371 Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Play function & Frequency for making a Bell sound?

Posted 8 years ago

Hello,

In trying to find the waveform of lightsaber noise, I tried out:

Play[2*Pi*f*t]

I was wondering why this behaves weird as f becomes too high. I know that I shouldn't be able to hear above 20,000 Hz, yet the computer still plays sound fine after this point. Further, at 60,000 Hz and above, the function starts making really pretty chime/bell noises. What is going on? Why is it behaving like this?

POSTED BY: George Aguirre
2 Replies
Posted 8 years ago

Yes, that would be aliasing. Default sample rate for Play is 8000 Hz, I believe. You can set another one with option SampleRate->44100, e.g.

As a side note, totally irrelevant to you question but some fun, here is a way to generate a very simple bell sound.

Module[{f = 650., op, env},
 env = Interpolation[{{0, 0.}, {0.01, 1}, {0.05, 0.3}, {0.4, 
     0.1}, {1.5, 0.01}, {1.8, 0}, {2, 0}}, InterpolationOrder -> 1];
 op[f1_, f2_, gain2_] = env[t] Sin[2. Pi f1 t + gain2 Sin[2. Pi f2 t]];
 Play[{
   op[f, 3.5 f, 2.],
   op[f + 5., (3.5 + 0.1) f, 2.3]
   }, {t, 0, 2}, SampleRate -> 22050.]]

enter image description here

Attachments:
POSTED BY: Peter Sjogren

Probably due to Aliasing you hear strange stuff for high frequencies. Check the sampling frequency. (SampleRate).

POSTED BY: Sander Huisman
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract