# Make "Violin" sound come out upon entering Emit Sound

How do I make this sound like a violin instead of a beep?

EmitSound[ Play[   Sin[600 π t], {t, 0, 1}]]


Use Sound[SoundNote[...]] to create the violin sound and EmitSound will play it on evaluation:

EmitSound[Sound[SoundNote["D4", 1, "Violin"]]]

Sin[600\[Pi]] corresponds to 300Hz. If you want the same pitch as your question, you need to start with a note close to 300Hz and shift the pitch up. By using a close note we minimize distortions.

From here https://pages.mtu.edu/~suits/notefreqs.html we can tell D4 is pretty close at 293.66Hz. To get 300Hz we just need to pitch shift D4 by $$300/293.66$$.

EmitSound[AudioPitchShift[Sound[SoundNote["D4", 1, "Violin"]], 300/293.66]]

• By the way - you may notice there is a bug in Mathematica where if you EmitSound and then run a different EmitSound while the first one is still playing, the sample rate can change and the second sound will be played at a very high or very low pitch. Jun 1, 2020 at 16:54