Invert polarity of sampler
-
@Christoph-Hart Thanks!!! was trying to do it with Delay in SimpleGain FX.
Start offset should be calculated for every note then? due offset will be different for every frequency (note) right? or there's a simple way to do it? -
Yes, but you just feed the frequency into your formula and it spits out a sample value that you need. I‘ll write a example when I get back in a few hours.
-
@Christoph-Hart AWESOME!!!!! I'll be picking frequencies from a pitch table with some breakpoints, Can you do your example using this snippet? Otherwise I will figure it out later
HiseSnippet 849.3oc6WsrSaCDEcbRbEn1hnUn1tzK5NTQXBuxJxCRPARfn3DnkMzA6IIiX7Lt1iC0e.8CpK5+Q+T3OncF6DrSqUTRePQU3EV9buy09L2mia4xLQddLWfxhcBbP.kmnZDP4CpL.hof56CTVRsIziib0hDUNvA54gr.JJYOPJPYwbfvqa1qLj.olnXQ.voLrIpA1Fyik1p3QXBoFzB0AamX0aVrtIiVgQX9B9jUccfCz7JXezwP4xxnBTdTUKLm4ZvgbjGPIWYlUfw.10zn0eJ1CeIAIA5.CwKJRbMFwRxX4yfJCvDqVi22d.fhZqXuP1HuvJpMwV3akG6MVNTgVrEI8GJYlF8zSRu0Skd5oPOPB1kKhcBRvr7IP9jLSFNFo.ylLRUmxQTOLOHY35eJcelZKL2bP57MSJ7UDn9ay2QA+mpVsWOjIOlr4Tq8161H8RQT4wpFXJJrhLjHuHDqcFbHR6.DE4Jcp5Son7qyZQoyLWTdhIW7463BodNLuIdwFHabGFU5QhE10CUyE8g1xnbR4UXP2TUcyd0DaxTsw.x8cCSWJYy7o7IROxNywjjMGlrpIw5SoSQtG5TDR2ryFcSwCpz5ml3rrHm11gfpRGhHLgDIGet59ndPeBerzISxaxnLmALJ1LYFPaD2E2uOxMI2ScCUhyEiVhkrRw1HBBlLa90EaHxBgtB+D5WzWnO69hoEudkZDc0jUlZ+ezgO6uaG94X9dR+7Bi6qdDJ3Xe6KE4JRt9R0iYB9DJP618h9TY76618K6UF6vHPW4LqeLQQV92AJn69PNDn7I0BauV3k6oz01oh3ggmbN4cGVHAVb67B85XVeDNnQvUE5cc8Jw50KjuD+vX7AqNbil6rcDtYPitql2gZFqu2p818rKGgAhscLmx74LpaouwZgqRdufbU4O4A7C36oXver1u2mN3WalOGS62DJle8QwOjH5LYHNukIRvDJEQDeHUkLxyLEgWWhiNvE0JD7Mw0Hk5RrxHk5iUdm7MrgltrKDmWj6xHxVuKDJQruog+B2hh+kTf0zACgD+QdIaQexKLMkN62H7NoawFysE4maK1btsXq41hsmaK1YtsX2oXgbnTIeNyNZhrPPqpQymTpRkCFByxAeGfUFCgZ
-
@Christoph-Hart tell me you did it (praying emoji)
-
There you go:
HiseSnippet 1094.3oc6X0saaTDEdV6rTrKopEUg3xUQbgMpDrSCkJUghyO1UVsIwxaZJ2UMY2yZOJ6NyxryFhAgDuFvSQuEtrWwc7JviPeCfyLqc10ESvtpMf.uJWj47yLey47cNyIomT3AIIBIwpxQihAh06Y6NhqFt6PJiS5tGw551cR4mN5HHQQ1YTLMIA7IVVken1.qJqPLeubqcngTtGjKhPNVv7fGyhXpbo8Z8HVXXGpObDKpf0a1pqmfuqHTjhforcCRL06T5.3.p1rR1Dq2osOSIjtJpBRHVqrivej6PwWyyr+XVB6jPPunIwE2nLwcDg9ZDqkR1cHKzu2jKcBA2zd4gfxYgfaauOymcg77PwMMJbx8nX7vpzkAulEgWi4FdjBnakLzgfP3mFRUSiLc5XrBlfOEx5xU.OgoFULc8OJbukcOlxa3rwaoYfWLQ81FuiS9qZ2NH.7T4fcE6Ne4Ual9FYP451tLNXJGM.4CLqcdJ8Lv4g.Gj5fZy+phxe6m+kecdKJim6hxC8T3wejjxShEISswtPD6HAWGQxE9jDniD9p95rbQ46JnxYp5ka0AujyzGWpJUZnKaGIR4ponGkm6bxBzbXkkMGLvs77A2YDAs58mdg4lHMNJNDZyOCBEnDMFee68f.ZZnZhzo406K3h3gBNyqXRuOnjrAC.YQrOyKz1JE9ZRtja2pODBzhD3Op0iQhGUhwI30LVzb9iEWV95CsyfqitXz4+FM0K++yl58EoJFev9TjndNwx9fzHWrWpGfHgygP7frsJo6GlstgdcVyTtuYwuieiU1Tu1ZrxlST959vwFKe33MxCGMtRe33MZ2maY65IYwpbMY0wZ1RugX2QWPofoATlGjRAV1XFNQ4bFU5DqM14Kb1UnqxUqS88eDWbRs0L6xZ2woA9S8GrZUigqm.p9T9.nFJ9t2Sqa8lSos1ZIoAAryQOW6EOeMstUqFjx8z4PGA+.gBNjWqd0usZkPgGMzQDDf9gPHaOF.piogoPs5Nep9Hb9XmMZr48w8wA+1Gur3eYg9jv3pTcnw4ZwZlE1mpV1lUu9Cp9cUcd0iMHH6beEc5qtTDFBxYpVWdHuLGqwSiNAj2AimHtuvPLWMMAn57Q.7xxDELTv6xYpCigKVmEEmHoA4hKXQQ42qhRMWmYXVtnYzLbL6PyEGaNZpxvDuwXlnaHyGIbLjpcMaC4gXhGWTw98AsHOo6dTEcx1f6HdJwfTwzwGq8fyv9TYD7J3TEImpDwFaihwlL5p+q82dnmOoO7nI+RhBhcYeiAI+3On+9oshnmmCryZkwY0us7hm+uigyZ9VZ3rMVNb1xgyVNb1bLb1UwYDQ8jhm4k0RUykeWiD7dyM+uypXuudsSyI8R0wlHblim44oC1eBFclsGarvdb2E1iMWXO9rE1i6svd74KrG2+R7POf21oJQTVoGJnWayaXVVs4Tj4ZX4j+.3oh2ZM
This is the most boring example you'll ever get - if it works correctly, you should hear nothing, because the two sine waves cancel each other out :)
The interesting part is this script:
const var phase = Content.addKnob("Phase", 0, 0); phase.setRange(0, 360, 0.1); phase.set("suffix", "°"); function onNoteOn() { local offset = phase.getValue() / 360 * 2048; Message.setStartOffset(parseInt(offset)); } function onNoteOff() { } function onController() { } function onTimer() { } function onControl(number, value) { }
Just drop it on every sine generator where you want to adjust the phase and set the phase knob to your likings (you might run into performance issues if you use 100 of these modules though).
The formula is even easier than I thought - the reason is that the sine wave generator internally uses a look up table with linear interpolation and a fixed "wavetable" size of 2048, so you even don't need the exact frequency for it. -
@Christoph-Hart AWESOME!!!!!!!!!!!!!!!
Will be awake all the night I guess!!!! -
@Christoph-Hart works absolutely fine!!!!. You just made the perfect additive synth :)
A question: This script takes sine frequency after or before a pitch modulator? I do use pitch tables on every sinewave module -
@hisefilo ok now you are going to have to define how I might make an additive synth using this...
-
Same, I don't understand where you need this in additive synthesis?
-
@Lindon LOL nah is just a part of it. You need to add a bunch of sinewaves by yourself. But now with this you can control phase on those sinewaves adding this script to each one of them
-
@ustk AFAIK additive synthesis is the summation of pure sinewaves. Displacing them over Y axis (phase) will affect the generated waveform. I use it to get timbres cannot be done without displacing phase (phase shift). To be honest don't know if it's a feature a real additive synth comes with
-
@hisefilo I got it
A real synth is a synth you make
-
The phase is independant from the frequency because they all use the fixed wavetable length of 2048 samples.
But to be honest the experiments I made with additive synthesis lead me to discard any efforts of reproducing the phase of harmonics because you simply don‘t hear it - but I am curious about your findings ;)
-
@Christoph-Hart I can hear the difference, but is much more obvious looking at the waveform. These are the 16 same sinewaves played together.
No phase:
Phase shifted:
I guess nature planed the waveform to look like last one :)
-
Yes, that the waveforms look different is obvious, but as far as I know, human ears have a very hard time to distinguish phases between harmonics.
I found an interesting read about this subject here:
-
@Christoph-Hart Excellent paper! Will read it carefully at bed! My guess is phase is audible when it contributes to create a "recognizable" waveform (as in the images I posted. Here are 2 examples, same harmonics, with and without phase shift.
My theory is that partials phase should be placed to contribute to a major simple waveform (I mean a waveform you can visually remember or recognize), shaping the final waveform by adding small variations of a major curve to make it look smooth. Just flip any of the partials on a additive sawtooth waveform and you'll see ramp to be distorted. (maybe Im crazy, but this is what I suppose)
-
I haven't read the paper yet, but for what I know, the phase is important when two or more sources are reproducing the same frequency, as the crossover frequency in a 2-way speaker for instance, where alignment is crucial... But if you take two frequencies far away enough below and above the crossover freq, the ear cannot notice a poor alignment (except if you change it in real time).
-
@ustk my post is related to phases within harmonics on the same sound. I guess phase alignment on speakers is kind of different stuff I can't understand yet
-
It was an image, but the behaviour is approximately the same if your harmonics are not identical, and the phase will automatically move in relation anyway
-
@ustk oh I got it :)