generate sound by formula

thank you. that's work.
please tell me how can I add 7 numbers of KIO4_Tone to my project?
and another question? Is it possible to change the sounds amplitude separately?
for example : 2sin(220t) + 0.5sin(261t) + 0.1*sin(330t) + ...

I do not know. The amplitude appears to be built in the the calculation?

What I do know is that this maths generates the sound wave sample in the extension:

(Math.sin(2 * Math.PI * i / (44100.0 / freqHz)) * 0x7FFF)

If you can provide an equivalent, based upon your requirements, it should be possible to come up with something:

2sin(220t) + 0.5sin(261t) + 0.1*sin(330t) + ...

Amplitude is volume of the Tone. I would like to play each tone with difference volume.
for example 220Hz with 100% volume, 261Hz with 70%volume , ...

can you tell me how can I do this?

I understand that :wink:

But you appear to understand a lot more about the maths behind generating sine waves than I do :slight_smile:

As it stands, you have to drag out 7 instances of the extension

1 Like

Once you uploaded the extension drag and drop it to mockup phone 7 times. Then you will have KIO4_Tone1,KIO4_Tone2,....KIO4_Tone7

1 Like

TIMAI2, You are perfect :upside_down_face:

Oh my GOD, sorry for this question :face_with_hand_over_mouth:

Thank you dora_paz

1 Like

Do you have any suggestion for this reason?

1 Like

I would have to do some rewriting of code, and testing

thanks a lot sir

1 Like

Don't seem to be able to apply an amplitude to the formula :frowning:
Trying another method...

Try this extension (replace the KIO4_Tone extension)

uk.co.metricrat.tones.aix (4.9 KB)

Set the volume between 0 and 1, e.g 0.5 will give half the volume, 0 = silence, 1 = maxVolume.
Values over 1 will be set to the maxVolume of 1

image

1 Like

I have also found a way to combine several frequencies together in one output, but it is not possible to set the volume for each frequency, therefore you are probably better off using multiple instances of above.

I think in the formula , if you add a variable such as AMP, it works
AMP*(Math.sin(2 * Math.PI * i / (44100.0 / freqHz)) * 0x7FFF)`

can you check it?

very good. I check it now for multi extension with variable volume

I did, it didn't work.

Thank you for your attention. :disappointed_relieved: