Generate a nice sounding sine curve in a narray

I would like to play a simple pure sound of a single sine curve by generating values into a list variable

If I generate the values in the list this way:

It is somewhat noisy. What is the good way to generate the list, that sounds basically the same as the play frequency block when played?

what's with the overly complicated list generating code? all you need is this for a 440 hz tone:
untitled script pic
and it sounds fine.

i'm guessing your issue is in some way related to the extra math you're doing

if by "noisy" you mean distorted it's almost definetly because of the x4000 after the sin, audio range should be -1 to 1 and sin already does that, if anything you should divide it to make it quieter

The faster versions are:

Also with square wave:

:cool: !. Loud noise warning.

Whoa,hyperblocks pls!


makes coding faster and the code as well

Do you need to change the 360 input depending on if you change the 440 input?

No.It would be better if you used pi and radians

snap uses degrees, i don't think it even has an option to use radians

360 comes from degrees, it doesn't change

Okay, thanks.

Thanks for all answers. I was making a sawtooth wave as I was simply using mod. Yes, scaling the whole range to 0 to 1 first, and then multiply that by a frequency of my choice, and then apply sin to it makes sense, and using hyperblock is more convenient.

I have the block that looks like in ten_6044 (somehow I cannot put the image here):

and it generates a tone about 404Hz. The play frequency block on the right does generate 440Hz sound. I cannot figure out why.

It is Chrome on macOS.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.