Hi list,
I was searching through the archives and the help files but I couldn't find a way to set explicity the values of an array in a specific range. What I'm trying to do is to mute a wav file loaded to an array, in a specific range, lets say from the 44100th sample to the 66050th, leaving the rest of the sample intact.
Another question that I have is this: If you read the text file that an array (loaded with audio) exported, can you read the clicks?
Cheers,
Tasos
ΓñçóéìïðïéΓ₯ΓΓ΄Γ₯ Yahoo! ΓÑñΓ₯Γ¨ΓΓͺÑôΓ₯ ôÑ Γ₯Γï÷ëçôéΓͺà ìçΓΓ½ ìÑôÑ (spam); ΓΓ― Yahoo! Mail ÀéÑèΓΓ΄Γ₯Γ© ôçà ΓͺÑëýôΓ₯Γ±Γ§ ÀáΓÑôà ðñïóôÑóΓΓ‘ ΓͺÑôà ôùà Γ₯Γï÷ëçôéΓͺþà ìçΓáìΓôùà http://login.yahoo.com/config/mail?.intl=gr
Tas Pas wrote:
Hi list,
I was searching through the archives and the help files but I couldn't find a way to set explicity the values of an array in a specific range. What I'm trying to do is to mute a wav file loaded to an array, in a specific range, lets say from the 44100th sample to the 66050th, leaving the rest of the sample intact.
[22050( | [until] | [i 44100]X[+ 1] | [0 $1( | [tabwrite array]
Another question that I have is this: If you read the text file that an array (loaded with audio) exported, can you read the clicks?
i am not sure whether i understand your question. which "clicks" do you have in an array? if you have a (preferrably: mathematical) definition of "click", then i am sure you can read the clicks.
mfg.asdr IOhannes
As "clicks" I mean what in the pd/doc/B09.loop.smooth.pd we try to avoid when the phase wraps around.
I noticed in a wave file with a "click", that we have a steep drop of the ampitude. The amplitude of each sample is near (in amplitude value) to the one before and next to it, but the sample that produces the click has an amplitude that is not near to the preceeding sample's amplitude value.
Maybe that is what produces the clicks...
So new questions may rise (if I am correct in my speculations)...
Is there a "safe" amount of amplitude change in a sample comparably to the amplitude of the previous and the next sample's amplitude, in order to avoid "clicks"? Is there a way to prevent clicks when a wave loops in an arbitrary range?
Please forgive me If I am not coherent and/or if I'm asking things that have already been discussed ( although I searched in the list archives and the internet about what I'm asking). I reckon that is stupid to say that I'm a newbie for two reasons: One, it is boring for everyone to read self-denotations. Two, as Socrates said "One one thing, that I know nothing". :P
Thanx
Tasos
IOhannes m zmoelnig zmoelnig@iem.at ΓãñÑøΓ₯: Tas Pas wrote:
Hi list,
I was searching through the archives and the help files but I couldn't find a way to set explicity the values of an array in a specific range. What I'm trying to do is to mute a wav file loaded to an array, in a specific range, lets say from the 44100th sample to the 66050th, leaving the rest of the sample intact.
[22050( | [until] | [i 44100]X[+ 1] | [0 $1( | [tabwrite array]
Another question that I have is this: If you read the text file that an array (loaded with audio) exported, can you read the clicks?
i am not sure whether i understand your question. which "clicks" do you have in an array? if you have a (preferrably: mathematical) definition of "click", then i am sure you can read the clicks.
mfg.asdr IOhannes
ΓñçóéìïðïéΓ₯ΓΓ΄Γ₯ Yahoo! ΓÑñΓ₯Γ¨ΓΓͺÑôΓ₯ ôÑ Γ₯Γï÷ëçôéΓͺà ìçΓΓ½ ìÑôÑ (spam); ΓΓ― Yahoo! Mail ÀéÑèΓΓ΄Γ₯Γ© ôçà ΓͺÑëýôΓ₯Γ±Γ§ ÀáΓÑôà ðñïóôÑóΓΓ‘ ΓͺÑôà ôùà Γ₯Γï÷ëçôéΓͺþà ìçΓáìΓôùà http://login.yahoo.com/config/mail?.intl=gr
On Wed, 27 Sep 2006 23:14:54 +0100 (BST) Tas Pas tprotopgr@yahoo.gr wrote:
As "clicks" I mean what in the pd/doc/B09.loop.smooth.pd we try to avoid when the phase wraps around.
I noticed in a wave file with a "click", that we have a steep drop of the ampitude. The amplitude of each sample is near (in amplitude value) to the one before and next to it, but the sample that produces the click has an amplitude that is not near to the preceeding sample's amplitude value.
That's a pretty good definition of a click. It's a discontinuity in the signal.
Maybe that is what produces the clicks...
So new questions may rise (if I am correct in my speculations)...
Is there a "safe" amount of amplitude change in a sample comparably to the amplitude of the previous and the next sample's amplitude, in order to avoid "clicks"?
Is there a way to prevent clicks when a wave loops in an arbitrary range?
It depends very much on the source signal you loop, some noisy sounds that are already very full of buzz and clicks can be looped easily and the click doesn't matter. Whether you hear the click depends on the size of the jump compared to the dynamic range of the rest of the signal. It will sound worse on pure tones. It sounds worse on low frequency sounds or ones with a strong low fundamental. It can happen even when the sound is apparently silent if you have a DC offset. The oldest trick is to crossfade the end and start points, a la early samplers like the Fairlight, Mirage, and Akai which introduced crossfade looping. You could work out some magic number for the least audiable click sound using psychoacoustic metrics, but from experience it's about 2 or 3 hundred in 65536 (for 16 bits) or about 0.25% fsd, anything above that you can usually hear. If you think about why it happens it is obvious - the chances of the end of a loop finishing on the exact value the loop starts with is small. For most musical applications you can just cut the loop visually, start on a rising positive phase (crossing zero going up) and end on the zero of a negative, rising cycle (so they wrap round nicely). Just getting the zeros isn't enough, if you are out of phase it will still click like a bastard. The perfect loop length then is an integer multiple of the period of one cycle. In theory, once you've got that size you can move it about over the sample with impunity. In practice, with real recorded sounds, that doesn't happen but you can find sweet spots by hand where it does work. If you need exactly sized tables for a wavetable synth or something then you will probably have to use timestretching too, because there is probably no solution of two correct zeros that just happen to be a perfect block size. What are you looping? Beats or musical tones, it makes a difference to which technique is best.
Just getting the zeros isn't enough, if you are out of phase it will still click like a bastard.
I just thought I'd submit my half-formed analysis idea for this.... We can use the Hilbert transform to capture the instanteous phase of the signal, so we might could use it to detect phase discontinuities. If so, the phase could be smoothed out by using a running average filter over the location of the discontinuity, and then the signal could be reconstructed.
Chuck
Remind me again what Hilbert does for us Chuck, shifts all the "negative" frequencies relative to its application by -pi and all the "positive" frequecies by +pi so sin(t) -> -cos(t) and cos(t) -> -sin(t) ?? How does that give us a measure of phase change?
Any reconstruction has to be of the entire sample afaics. But if you think of an efficient way to work locally on a small part of a file (specifically the ending) and operating backwards samplewise turn a small time error into a frequency error spread out to be imperceivable you have a useful piece of software. The use would be to simply make the signal end (and start) on a zero of known phase. Do that and editing jobs that has to be done by hand on cut and spliced musical clips get more fun :) But anything like that would have application in a sampler as "automatic best loop" finder. A Roland I used to have did an autocorrelation type thing to blend out of phase loops nicely, if I remember it worked ok for long windows of about 2 seconds, but was rubbish for short loops.
I always wanted to see a feature in protools, hey maybe Ardour will have it one day... where you are trying to align two clips and you want it to snap to the phase of the signal above (which a human can obviously see when zoomed in enough), it just has to look at the a little bit of the audio in each section and line them up for the most coherency at the start of the block, right?
I digress, so Hilbert can be a phase comparator (or can be used as one)?
On Wed, 27 Sep 2006 20:26:08 -0500 "Charles Henry" czhenry@gmail.com wrote:
Just getting the zeros isn't enough, if you are out of phase it will still click like a bastard.
I just thought I'd submit my half-formed analysis idea for this.... We can use the Hilbert transform to capture the instanteous phase of the signal, so we might could use it to detect phase discontinuities. If so, the phase could be smoothed out by using a running average filter over the location of the discontinuity, and then the signal could be reconstructed.
Chuck
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Remind me again what Hilbert does for us Chuck, shifts all the "negative" frequencies relative to its application by -pi and all the "positive" frequecies by +pi so sin(t) -> -cos(t) and cos(t) -> -sin(t) ?? How does that give us a measure of phase change?
The hilbert transform takes the second half of the fft (which is the conjugate of the first half...the negative frequencies, if you will) and sets them to zero. The ifft of this (multiplied by two) is a complex signal, z(t) where the real part is exactly the original signal and the imaginary part is 90 degrees out of phase.
this signal can be decomposed into amplitude and phase as a continuous signal: A(t)=sqrt(Real(z(t))^2+Imag(z(t))^2) phase(t)=arctan(Imag(z(t))/Real(z(t))
I tried to implement this so I could show ya.... it doesn't work but I'll post it anyway. It uses ==~ from zexy. Use the hilbert_test patch and Open up the grapher subpatch to see what happens.... Maybe it's just a lousy algorithm....but I've actually used this once before to decompose phase and amplitude for other types of signals, and it seemed to work fine then... Chuck
Yeah, I'm not getting much joy from that either :/ But it's still instructive to follow your implementation from fft. There is actually a [hilbert~] unit available, which is why I am interested.
I'm somewhat familiar with the principle I think, at least in practice as a "phase shifter" for removing sidebands with a quadrature mixer etc, but even though I understand Hilbert is fundamental there's a big hole in my maths in that subject, around about the point I fell asleep in engineering maths lectures.
Can you give a description, in words rather than equations if possible please, how Hilbert arises and why its central to complex signals. Maybe with another example of why you would use the transform for a practical purpose.
One thing that confuses me right now is how you can have a phase signal? Relative to what? That is why I said phase comparator, it kinda doesn;t make sense to me to have absolute phase, it must be relative to something. ??
Cheers Chuck,
ANdy
On Thu, 28 Sep 2006 00:23:36 -0500 "Charles Henry" czhenry@gmail.com wrote:
Remind me again what Hilbert does for us Chuck, shifts all the "negative" frequencies relative to its application by -pi and all the "positive" frequecies by +pi so sin(t) -> -cos(t) and cos(t) -> -sin(t) ?? How does that give us a measure of phase change?
The hilbert transform takes the second half of the fft (which is the conjugate of the first half...the negative frequencies, if you will) and sets them to zero. The ifft of this (multiplied by two) is a complex signal, z(t) where the real part is exactly the original signal and the imaginary part is 90 degrees out of phase.
this signal can be decomposed into amplitude and phase as a continuous signal: A(t)=sqrt(Real(z(t))^2+Imag(z(t))^2) phase(t)=arctan(Imag(z(t))/Real(z(t))
I tried to implement this so I could show ya.... it doesn't work but I'll post it anyway. It uses ==~ from zexy. Use the hilbert_test patch and Open up the grapher subpatch to see what happens.... Maybe it's just a lousy algorithm....but I've actually used this once before to decompose phase and amplitude for other types of signals, and it seemed to work fine then... Chuck
Yeah, I'm not getting much joy from that either :/
I'm still working on it....I've had some luck at improving it, but I've managed to show there's some pesky effects from the windowed short time fourier transform business. The time I made it work for some force control signals in the lab, I used the fourier transform of the whole signal.
I'm somewhat familiar with the principle I think, at least in practice as a "phase shifter" for removing sidebands with a quadrature mixer etc, but even though I understand Hilbert is fundamental there's a big hole in my maths in that subject, around about the point I fell asleep in engineering maths lectures.
We all fell asleep in engineering math lectures. I just make it up as I go along. (My brother looks at me sideways as I do this, all the time)
Can you give a description, in words rather than equations if possible please, how Hilbert arises and why its central to complex signals. Maybe with another example of why you would use the transform for a practical purpose.
I don't really have a text on this subject any more....so the details are a little fuzzy where the hilbert transform comes from.....I can tell you this, it's a funky integral equation with some kernel, that has do to with the eigenvectors/eigenvalues of some linear operator...but then, that's generally what all transforms are about....I'll have to look it up again, just to make sure I have the right idea.
for signal analysis, the whole idea is this: we can take any signal , that has any number of frequencies, and transform it into a joint amplitude/frequency modulation of a single frequency described by amplitude and phase separately as functions of time.
In the lab, I was working on using this for analyzing force control data, which showed a kind of damped resonance. But it was a natural signal so there was no clearly defined resonance. Instead there were several damped resonances of different frequencies. When you plot the hilbert tranform in the complex plane, you get a "phase plane" (is that what it's called?) portrait of the signal. There were decaying slow frequencies of high amplitude, with some smaller higher frequencies added in, which showed up as epicycles in the graph. Ultimately, we scrapped the analysis, since it didn't seem like I could make any significant conclusions.
One thing that confuses me right now is how you can have a phase signal? Relative to what? That is why I said phase comparator, it kinda doesn;t make sense to me to have absolute phase, it must be relative to something.
To me, the phase is absolute. It describes a relationship, at a certain point in time, between the signal's value and it's rate of change.
........ for improvement, maybe I should try doing it on the whole signal....This sounds like a job for the script function. I haven't tried it yet, but this would be a good chance to learn. I could make a little script with octave that would take the hilbert transform of the whole signal, and smoothly match the phase at the end of the file to the beginning and return it....then the signal could be loaded as an array, and could try looping it to see if it works. sounds a little ambitious at the moment.... 's getting late tonight
Have a good weekend! Chuck