AlgoSim
Homepage | Screenshots | Gallery of Visualisation | User's Guide | Function Reference | Download | FAQ | Support | Bugs and Solutions | Donate

Reference: sndMatrixToSound

sndMatrixToSound(M, n) returns the sound with the matrix representation M (one column per channel, one row per sample, and each element f(t) is the displacement of the speaker's membrane normalized to lie within [-2^31, 2^31]) and n samples per second.

Example: A pure 400 Hz sine tone
         A ≔ 2^31
         ω ≔ 2⋅π⋅400
         set ≔ createImage("A⋅sin(ω⋅t)", "t", [0, 2, 0.0001])
         snd ≔ sndMatrixToSound(setToMat(set), 10000)

         A frequency-modulated 400 Hz sine tone
         set ≔ createImage("A⋅sin(ω⋅(sin(t)⋅t))", "t", [0, 4⋅π, 0.0001])
         snd ≔ sndMatrixToSound(setToMat(set), 10000)