Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

We know that usually sound that is perceptible by humans has frequencies from about 20 Hz to 20,000 Hz, but as the title said, I can still hear the sound of the outputs of the following code:

(* The following sound won't cause discomfort… I think. *)
Play[Sin[1000000 2 Pi t], {t, 0, 1}, SampleRate -> 10000000]

After asking some of my friends to hear them, I'm sure I don't have clairaudience. I think it's probably not the fault of Mathematica, it might be an issue for loudspeaker, but I failed to find an answer by myself and I think it's worth posting a question for this.

share|improve this question
25  
I was similarly disappointed when GrayLevel[10^50] failed to produce a gigawatt laser cannon. –  Simon Woods Nov 6 '13 at 10:09
4  
@SimonWoods Tell me about it. I have been trying to heat my food with Plot[Sin[2 π 2.45 10^9 t], {t, 0, 60}]. Food still cold. –  gpap Nov 6 '13 at 10:24
3  
@gpap Probably an experimental setup problem. You've to stuff the processor inside the poultry, not the other way around –  belisarius Nov 6 '13 at 11:30
2  
@gpap On the other hand, you could easily do it with Inverse[RandomInteger[1000, {1000, 1000}]] :P –  rm -rf Nov 6 '13 at 13:18
2  
There is something you should know, Kal El... –  Peltio Nov 6 '13 at 14:34

4 Answers 4

up vote 11 down vote accepted

Just saying SampleRate -> 10000000 does not mean that the hardware is capable of playing samples at that rate. (Most modern devices can do 192 kHz; but it's likely you're running at 48 kHz.)

Mathematica or the OS or the sound driver or the hardware will resample the data to something that is supported. Depending on how well the resampling is implemented, the 1 MHz signal will either vanish or be folded back to a lower frequency.

To avoid resampling, you should use SampleRate -> 48000 (or any other rate supported by your hardware).

share|improve this answer

Along with the fact that the hardware is incapable of very high sampling rates (as described CL), this is an example of a generic effect called aliasing that happens whenever the sampling frequency is less than half the frequency of the signal (this is called the Nyquist frequency). Here is a Wolfram demonstration about this effect and Wikipedia has a good article called aliasing. Here also is a previous StackExchange question that addresses the issue.

share|improve this answer

When I tried this once, I used:

Play[Sin[12000*2 Pi*t], {t, 0, 1}, SampleRate -> 44000]

which is near the top end for most adults. To annoy any teenagers in the same room, I tried:

Play[Sin[15000*2 Pi*t], {t, 0, 1}, SampleRate -> 44000]

and I know that worked, if only because I could hear the speaker starting and stopping.

share|improve this answer
    
I can hear these two, but these are not that kind of sound I mentioned in the question, the sound of the high-frequency code in my question is much lower than these two. –  xzczd Nov 6 '13 at 10:02
5  
+1 for annoying teenagers –  Simon Woods Nov 6 '13 at 10:10

The membrane may resonate on a lower frequency than what is actually played, fooling you with an audible pitch.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.