Techniques called upsampling and downsampling can be used to get a “mosaic-like effect.” This effect is achieved by reducing the resolution – via changing the frames-per-second and pixel size – as shown in the example.
This example shows how to draw a circumference with the lcd object, and how to draw N evenly spaced dots along that same circumferece. Knowing the center and radius of the circle, the number of possible dot locations, and the index number of the particular dot, you can calculate the location of the dot using cosine and sine functions.
To better understand the function of a mtof object, it can be recreated with an expr object. There are very slight differences between the output of mtof and expr. The differences are pretty minuscule and should not be a problem in most cases, as they are on the order of a few 1/10,000ths of a Hz.
The canonical way to get cyclic "oscillator" behavior is, for every sample number (n), take a step of a certain size (increment) at a certain rate of speed (sample rate) wrapping around to stay within a specific range (length) such that you complete a certain number of cycles (frequency). What you get is an index (x) that you can use to look up values in a table, or as input to an equation, to get a result (y). What should the step size (the increment) be? It’s determined by the formula “increment = n * frequency * length/sample rate”.
Is it possible to see decibel values that start at 0 dB so that the values are all positive? Yes, you just need to decide what you want to use as your 0 dB reference amplitude. In digital audio, an amplitude of 1 is used as the 0 dB reference. In measuring real-world sound, the human threshold of hearing at 1 KHz (something like .0002 microbar) is usually used as the 0 dB reference value. Here’s an example using (roughly) the smallest obtainable nonzero amplitude in a 16-bit signal as the reference value, yielding a scale from about 0 to 90 dB.
Question: How does one fill a multislider of 512 sliders (range -1. to 1.) with a sine wave?
This example shows how to use pow in expr. In this case we are trying to calculate: sqrt (a^2 + b^2 + c^2)
For producing a score out of time and then saving as a standard MIDI file, detonate is the best way to go, and it can save in either format 0 or format 1. Admittedly, you could save a format 0 MIDI file with text and seq by writing the text file, reading it back into seq, then writing that as MIDI, and it could all happen in a few milliseconds.
The cycle~ object allows you to read from a stored cosine function (use a phase offset of 0.75 to get a sine phase), and does high-quality interpolation to give you excellent resolution even though it only uses a 512-sample table. (See MSP Tutorial chapters 1-3).
But if you want to put a sine wave into a buffer~, here’s a way:
You can calculate the desired acceleration/deceleration curve using expr. The smoothest acceleration/deceleration is exhibited by simple harmonic motion (like the swinging of a pendulum), which would be a sinusoidal curve rather than a sigmoid curve (and a sigmoid is theoretically asymptotic, i.e. never truly reaches its goal). You can calculate either with expr. Here’s an example comparing the two.