ValueAt
Sometimes it can be handy to find the numeric value of an audio signal at a point in time. Bells Of Time uses this technique to get timing from sin waves to produce complex and non repeating sequences of pitch, timbre, volume and timing. Visualisation is another area where this technique is very important. ValueAt provides the signal value at a point in milliseconds.
(1000,1)SinWave !signal
Bunch !samples
(
1,100,
{
!x
(?signal,(?x,10)*)ValueAt !s
(>s,>samples)AddEnd !samples
}
)Repeat
>samples ToJson Println
The patch above produces this:
[0.06279052048921585,0.12533323466777802,0.187381312251091,0.24868988990783691,0.30901700258255005,0.3681245446205139,0.4257792830467224,0.4817536771297455,0.5358268022537231,0.5877852439880371,0.6374239921569824,0.6845471262931824,0.728968620300293,0.7705132365226746,0.80901700258255,0.8443279266357422,0.8763066530227661,0.9048270583152771,0.9297764897346497,0.9510565400123596,0.9685831665992737,0.9822872281074524,0.9921147227287292,0.9980267286300659,1.0,0.9980267286300659,0.9921147227287292,0.9822872281074524,0.9685831665992737,0.9510565400123596,0.9297764897346497,0.9048270583152771,0.8763066530227661,0.8443279266357422,0.80901700258255,0.7705132365226746,0.728968620300293,0.6845471262931824,0.6374239921569824,0.5877852439880371,0.5358268022537231,0.4817536771297455,0.4257792830467224,0.3681245446205139,0.30901700258255005,0.24868988990783691,0.187381312251091,0.12533323466777802,0.06279052048921585,1.2246468525851679E-16,-0.06279052048921585,-0.12533323466777802,-0.187381312251091,-0.24868988990783691,-0.30901700258255005,-0.3681245446205139,-0.4257792830467224,-0.4817536771297455,-0.5358268022537231,-0.5877852439880371,-0.6374239921569824,-0.6845471262931824,-0.728968620300293,-0.7705132365226746,-0.80901700258255,-0.8443279266357422,-0.8763066530227661,-0.9048270583152771,-0.9297764897346497,-0.9510565400123596,-0.9685831665992737,-0.9822872281074524,-0.9921147227287292,-0.9980267286300659,-1.0,-0.9980267286300659,-0.9921147227287292,-0.9822872281074524,-0.9685831665992737,-0.9510565400123596,-0.9297764897346497,-0.9048270583152771,-0.8763066530227661,-0.8443279266357422,-0.80901700258255,-0.7705132365226746,-0.728968620300293,-0.6845471262931824,-0.6374239921569824,-0.5877852439880371,-0.5358268022537231,-0.4817536771297455,-0.4257792830467224,-0.3681245446205139,-0.30901700258255005,-0.24868988990783691,-0.187381312251091,-0.12533323466777802,-0.06279052048921585,0.0]
Which is a full cycle of a 1Hz sin wave sampled every 10 milliseconds represented as a JSON (a useful format for communicating between systems) list.
No comments:
Post a Comment