# notes related to digital sound creation # digital sound representation a common format for storing signals digitally is sample values of the distance magnitude of a vibration over time, like positions of a membrane between two bounding values ## sampling rate * also called sample rate * describes how many samples represent one second of sound * with a higher sampling rate, more and higher frequencies can be represented * the maximum representable frequency in hertz is half the sampling rate, as any higher frequency than that would be spaced in a smaller duration than two subsequent sample values # algorithms * stateless: have only parameter values that need not be kept * stateful: have parameters for values that need to be kept between function calls. for example, carryover values that fall outside the currently processed range and are used in the next one * processing one input sample at a time: can affect multiple samples only with state and delay after accumulating samples * segment to segment: processors might depend on preceding or following values * one to many: output creates a longer signal * many to one: a longer signal becomes a shorter one # digital music making tools * analog hardware devices for synthesizers with keyboards or sequencing * software sequencers where instruments, synthesizer sounds, recordings and effects can be layed out and played back * software environments like fruity loops, reaktor, reason and others * lv2 or vst plugins as effects and synthesizers * taking audio recordings and prepare their ordered playback in a program like ardour or cubase * connecting hardware devices with midi and puredata and the user interfaces that it can create * preparing sample arrays using a general purpose programming language and writing to sound files # various * [harmonic](https://en.wikipedia.org/wiki/Harmonic): a harmonic is a wave with a frequency that is a positive integer multiple of the frequency of the original wave * [time series](https://en.wikipedia.org/wiki/Time_series): a series of data points indexed (or listed or graphed) in time order. most commonly, a time series is a sequence taken at successive equally spaced points in time * a sound program is a potential for sounds to occur. elements can appear and disappear like entering and exiting a dimension. there is always some kind of seed, for example the literal arguments in program code * amplitude: the magnitude of the difference between a variables extreme values. the amplitude of a periodic variable is a measure of its change over a single period * [scales](https://ianring.com/musictheory/scales/), a comprehensive study * clipping: limiting values to a maximum * digital image processing is a subcategory of digital signal processing * envelope: a path of loudness transition * every linear time-invariant system can be represented by a convolution * frequency: number of occurrences of a repeating event per unit time * low frequency: less rapid change between sample values * phase: relative shift or progression of a repeating event * sequencer: configures the starting points and durations of sounds * vocoder: splits into frequency bands and removes bands * wave < instrument < composition * more links * [amplitude](https://en.wikipedia.org/wiki/Amplitude) * [artificial reverberation](https://ccrma.stanford.edu/~jos/pasp/Artificial_Reverberation.html) * [beat](https://en.wikipedia.org/wiki/Beat_(acoustics)) interference pattern between two sounds of slightly different frequencies * [negative frequency](https://en.wikipedia.org/wiki/Negative_frequency) * [phase](https://en.wikipedia.org/wiki/Phase_(waves)) * [rhythm](https://en.wikipedia.org/wiki/Rhythm) * data types * continuous: sample -1..1; amplitude: 0..1 * discrete: sampling-time * one can imagine a spectrum between harmonicity and noise, where harmonic sounds dissolve into noise * real human-like complexity in patterns is a variety of, and layers of, modifications over time. it is not the number of unique subsequences * panning effects can be left to right then again left to right, or left to right then back from right to left * to share parameter values, sound generators do not need to somehow trigger other sound generators (inefficient, possibly cylic). instead the values can be shared from a parent context * partials can be more causative/dependent/similar or more correlative/independent/dissimilar # instruments * model * instrument * cluster ... * envelope ... * sine(amp, frq, phs) / filtered_noise(amp, frq_start, frq_end) ... * notes * partials summed make complex wave shapes * using clusters to build instruments works, because even instruments are made of some distinguishable objects * partials in a cluster should be similar enough to each other so they are not recognised as separate sounds, but different enough that they arent recognized as mere amplification # choosing partial frequencies * "The relative amplitudes (strengths) of the various harmonics primarily determine the timbre of different instruments and sounds, though onset transients, formants, noises, and inharmonicities also play a role." * harmonics are multiples of the fundamental (pitch) frequency. the fundamental is the frequency at which the entire wave vibrates * multiples and added divisions can be used * variables to select a partial: fundamental + divisions + shift * irrational frequencies have their period never restart at the same time as the fundamental again * mixing odd and even divisions is less harmonic * examples of subdivisions, times frequency: * 1/1, 1/1 + 1/2, 2/1 * 1/1, 1/1 + 1/3, 1/1 + 2/3, 2/1 * 1/1, 1/1 + 1/4, 1/1 + 2/4, 1/1 + 3/4, 2/1 * relations to music theory * an octave is a doubling in frequency * a perfect fifth is a combination that is periodic on two periods of the lower note, a 2:3 frequency relation. the beginning of the second repetition of the fundamental is at the center of the second repetition of the other tone * some possible partial frequency relations * equidistant * increasing distance * decreasing distance * varying distance * sparse * dense # statistics to guide the automatic generation of data arrays for sound parameters * statistics are a digest/abstraction of the actual details of a pattern * they can be used to compare or generate patterns (monte carlo method) * statistics can be a target for a generator * it can also be used as an analysis step to make parts of patterns more similar or to blend them together * note that pointwise interpolation is another method to create similar patterns * statistics on the differences between values can also be useful * some interesting statistical methods * standard deviation: the variation from the mean (variance) with reduced bias to extremes * arithmetic mean: one share of the total sum equally distributed. the point where the sum of smaller values matches the sum of larger values * median: the center between higher and lower values. the point where the count of smaller values matches the count of larger values * range: the difference between the maximum and minimum * minimum: the minimum value in the dataset * maximum: the maximum value in the dataset * kurtosis * describes the distribution of numbers. for example, if values are spread out and more equally likely, or if there are peaks in the distribution, which would mean that a range of values appears in the dataset more often * mean((x - mean(data)) ** 4) / (mean((x - mean(data)) ** 2) ** 2) * skewness * describes the distribution of numbers. gives an indication about if there are more low or more high numbers * mean((x - mean(data)) ** 3) / (mean((x - mean(data)) ** 2) ** 3/2) * center of mass * the distribution of mass is balanced around the center of mass, and the average of the weighted position coordinates of the distributed mass defines its coordinates. * sum(n x(n)) / sum(x(n)) * the number of unique subsequences as a potential statistic * the count of repetitions of overlapping subsequences of length 0..n * can find the subpattern lengths with the highest proportion of unique subpatterns relative to the possible unique subpatterns * examples * low: 11111 112112 * high: 12345 112212 # autocorrelation vs absolute differences * autocorrelation gives a degree of difference with large local difference being pronounced to differentiate it from many small differences. * correlation is -1 to 1 * correlation only tests linear dependence. (1 2 3) and (4 5 6) are 1 * mean absolute difference goes to infinity