Re: [PD] a little pitchshifter
Somebody, please give me a job. I have nothing to do at the machine shop except analyze math problems while running the CNC. Well, later, shouldn't you be in a university with that kind of maths? you might hurt someone. ___ PD-list@iem.at mailing list UNSUBSCRIBE and account-management - http://lists.puredata.info/listinfo/pd-list
Re: [PD] a little pitchshifter
more errors whoops! sinc(t)=sin(pi*t)/t sinc(t)=sin(pi*t)/(pi*t) (2/N)*[1+sum{ j=1:N/2 ; cos(pi*t*fs*j) } (2/N)*[0.5+sum{ j=1:N/2 ; cos(pi*t*fs*j) } ] ___ PD-list@iem.at mailing list UNSUBSCRIBE and account-management - http://lists.puredata.info/listinfo/pd-list
Re: [PD] a little pitchshifter
You can however upsample your signal first, then use a lowpass filter, then downsample again. See this chapter in The Book for more info: http://crca.ucsd.edu/~msp/techniques/latest/book-html/node194.html and J07.oversampling.pd i kind of hoped that tabread4 would do some kind of interpolation which might magically stop aliasing.. ___ PD-list@iem.at mailing list UNSUBSCRIBE and account-management - http://lists.puredata.info/listinfo/pd-list
Re: [PD] a little pitchshifter
2007/3/6, Peter Worth [EMAIL PROTECTED]: i kind of hoped that tabread4 would do some kind of interpolation which might magically stop aliasing.. As Frank mentioned, it does, but interpolation in itself is a heavily overloaded word. Consider linear interpolation: it is, it is done, but during upsampling, sine wave at Nyquist transforms into triangular and sub-Nyquist sines are high-freq distorted, too... :( Interpolation is the field, where the question of how is, IMO, of even greater importance than that of if. ___ PD-list@iem.at mailing list UNSUBSCRIBE and account-management - http://lists.puredata.info/listinfo/pd-list
Re: [PD] a little pitchshifter
2007/3/6, Peter Worth [EMAIL PROTECTED]: i kind of hoped that tabread4 would do some kind of interpolation which might magically stop aliasing.. hmmm could we have some way of interpolating, just short of magic, that would stop aliasing during downsampling? tabread4~ takes an input of the integer/non-integer value to look up in the table. What if, as a function of the derivative of this signal input, we could adjust the interpolating function to eliminate high frequencies that would be aliased? first off, any interpolating polynomial causes distortion. First place to start is with the sinc function, which is not a polynomial. sinc(t)=sin(pi*t)/t It is the optimal interpolating function for band-limited signals, and is valid when the signals are infinitely long. Over all frequencies less than the Nyquist frequency, the continuous signal is exactly as it was before sampling. There is some funkiness at exactly the Nyquist frequency, because only the cosine component (using real-valued signals) is left after sampling. (This is always a good case to consider first) sinc(fs*t) has a spectrum of unity for frequencies between -fs/2 and fs/2. Now suppose we want to use the sinc as an interpolating function, where the playback speed is increased. Then we get rid of the excess spectrum, to eliminate aliasing. Where we have a playback speed of k (where k1) we can modify our interpolating function to sinc(fs*t/k), changing the spectrum to -fs/(2k) to fs/(2k), preventing aliasing. So, there's a lesson to be learned from the sinc function. If we wanted to interpolate values at a higher speed that normal, we would stretch our interpolating function out over a longer time. If we take Lagrange interpolating polynomials and continue to increase the degree, we will get successively better approximations to the sinc function. *But* the polynomials will always have infinite frequency content--They are not band-limited, but they are compact. Possibly, we could take these polynomials, and just stretch them out, like the sinc, to get comparable performance (not perfect, but quick) There's another way to interpolate values that is based on Fourier Transforms. Taking our signal, we compute a discrete fourier transform, and replace the discrete vectors of the inverse transform with continuous functions. Then, we have a continuous signal that interpolates in between samples, and to play at higher speeds, we would throw away the higher frequencies, to prevent aliasing. Using this method, our interpolating function of order N becomes (2/N)*[1+sum{ j=1:N/2 ; cos(pi*t*fs*j) } We could limit the number N to say, 4 or 8, and throw away some of the cosines as needed. The fourier method, I just mentioned, is not in fact a good interpolator, but if you were playing back at higher speeds than normal, I don't think it should matter. Somebody, please give me a job. I have nothing to do at the machine shop except analyze math problems while running the CNC. Well, later, Chuck ___ PD-list@iem.at mailing list UNSUBSCRIBE and account-management - http://lists.puredata.info/listinfo/pd-list
Re: [PD] a little pitchshifter
2007/3/2, hard off [EMAIL PROTECTED]: peter, use this construction: [phasor~] | | [r arraylength] | | [*~ ] | [tabread4~ arrayname] where, arraylength is the value obtained from the outlet of [soundfiler] when you load your sample. the speed of the phasor should be set at ( 44100 / arraylength ) to play at a normal pitch (assuming your samplerate is 44100hz)..and multiplying or dividing this value by a scalar you can change the pplayback speed What about aliasing? ___ PD-list@iem.at mailing list UNSUBSCRIBE and account-management - http://lists.puredata.info/listinfo/pd-list
Re: [PD] a little pitchshifter
Hallo, Denis Trapeznikoff hat gesagt: // Denis Trapeznikoff wrote: 2007/3/2, hard off [EMAIL PROTECTED]: use this construction: [phasor~] | | [r arraylength] | | [*~ ] | [tabread4~ arrayname] where, arraylength is the value obtained from the outlet of [soundfiler] when you load your sample. What about aliasing? Aliasing will happen as usual. Now it depends on the content of the arrayname table. If arrayname is const 0, you get no aliasing of course, if it contains one period of a sine wave, you have a construct like [osc~] and you will get aliasiang starting at phasor~ frequency = Nyquist = SR/2. If arrayname contains two periods of a sine, it's like playing an [osc~] with two times the [phasor~] frequency so you start to alias at a phasor~ frequency of 0.5 Nyquist and so on for arbitrary signals. Ciao -- Frank Barknecht _ __footils.org_ __goto10.org__ ___ PD-list@iem.at mailing list UNSUBSCRIBE and account-management - http://lists.puredata.info/listinfo/pd-list
Re: [PD] a little pitchshifter
Could aliasing be avoided by using a multi-pole low pass filter at nyquist before sending the signal to the dac? ~Kyle On 3/5/07, Frank Barknecht [EMAIL PROTECTED] wrote: Hallo, Denis Trapeznikoff hat gesagt: // Denis Trapeznikoff wrote: 2007/3/2, hard off [EMAIL PROTECTED]: use this construction: [phasor~] | | [r arraylength] | | [*~ ] | [tabread4~ arrayname] where, arraylength is the value obtained from the outlet of [soundfiler] when you load your sample. What about aliasing? Aliasing will happen as usual. Now it depends on the content of the arrayname table. If arrayname is const 0, you get no aliasing of course, if it contains one period of a sine wave, you have a construct like [osc~] and you will get aliasiang starting at phasor~ frequency = Nyquist = SR/2. If arrayname contains two periods of a sine, it's like playing an [osc~] with two times the [phasor~] frequency so you start to alias at a phasor~ frequency of 0.5 Nyquist and so on for arbitrary signals. Ciao -- Frank Barknecht _ __footils.org_ __goto10.org__ ___ PD-list@iem.at mailing list UNSUBSCRIBE and account-management - http://lists.puredata.info/listinfo/pd-list -- http://theradioproject.com http://perhapsidid.blogspot.com (()()()(()))()()())( (())(())()((( ))(__ _())(()))___ (((000)))oOO ___ PD-list@iem.at mailing list UNSUBSCRIBE and account-management - http://lists.puredata.info/listinfo/pd-list
Re: [PD] a little pitchshifter
Hallo, Kyle Klipowicz hat gesagt: // Kyle Klipowicz wrote: Could aliasing be avoided by using a multi-pole low pass filter at nyquist before sending the signal to the dac? No: Alias frequencies aren't too high, they are wrong frequencies, that have been mirrored at the Nyquist border. As soon as you try to play a sinewave at Nyquist + x, what you get is a sine at Nyquist - x, and you cannot lowpass out this frequency after it has been introduced. You can however upsample your signal first, then use a lowpass filter, then downsample again. See this chapter in The Book for more info: http://crca.ucsd.edu/~msp/techniques/latest/book-html/node194.html and J07.oversampling.pd Ciao -- Frank Barknecht _ __footils.org_ __goto10.org__ ___ PD-list@iem.at mailing list UNSUBSCRIBE and account-management - http://lists.puredata.info/listinfo/pd-list
Re: [PD] a little pitchshifter
I don't want to change the subject (and if needed, we can start a new thread), but as this might be a related topic, here it is... What would it take to turn this into a Slowdown abstraction? Basically, I am interested in slowing down the tempo of a sound, but NOT changing the pitch... Am I off-base on this? Or can this be used as the starting point for what I described? Thanks, Mike On 3/5/07, Frank Barknecht [EMAIL PROTECTED] wrote: Hallo, Kyle Klipowicz hat gesagt: // Kyle Klipowicz wrote: Could aliasing be avoided by using a multi-pole low pass filter at nyquist before sending the signal to the dac? No: Alias frequencies aren't too high, they are wrong frequencies, that have been mirrored at the Nyquist border. As soon as you try to play a sinewave at Nyquist + x, what you get is a sine at Nyquist - x, and you cannot lowpass out this frequency after it has been introduced. You can however upsample your signal first, then use a lowpass filter, then downsample again. See this chapter in The Book for more info: http://crca.ucsd.edu/~msp/techniques/latest/book-html/node194.html and J07.oversampling.pd Ciao -- Frank Barknecht _ __footils.org_ __goto10.org__ ___ PD-list@iem.at mailing list UNSUBSCRIBE and account-management - http://lists.puredata.info/listinfo/pd-list -- Help the Environment, Plant a Bush back in Texas! I place economy among the first and most important republican virtues, and public debt as the greatest of the dangers to be feared. To preserve our independence, we must not let our rulers load us with perpetual debt. -- Thomas Jefferson, third US president, architect and author (1743-1826) Give Peace a Chance -- John Lennon (9 October 1940 – 8 December 1980) Peace may sound simple—one beautiful word— but it requires everything we have, every quality, every strength, every dream, every high ideal. —Yehudi Menuhin (1916–1999), musician ___ PD-list@iem.at mailing list UNSUBSCRIBE and account-management - http://lists.puredata.info/listinfo/pd-list
Re: [PD] a little pitchshifter
Helpfile B.14.sampler.rockafella may be a good place to start. On Mon, 5 Mar 2007 14:15:26 -0600 Mike McGonagle [EMAIL PROTECTED] wrote: I don't want to change the subject (and if needed, we can start a new thread), but as this might be a related topic, here it is... What would it take to turn this into a Slowdown abstraction? Basically, I am interested in slowing down the tempo of a sound, but NOT changing the pitch... Am I off-base on this? Or can this be used as the starting point for what I described? Thanks, Mike On 3/5/07, Frank Barknecht [EMAIL PROTECTED] wrote: Hallo, Kyle Klipowicz hat gesagt: // Kyle Klipowicz wrote: Could aliasing be avoided by using a multi-pole low pass filter at nyquist before sending the signal to the dac? No: Alias frequencies aren't too high, they are wrong frequencies, that have been mirrored at the Nyquist border. As soon as you try to play a sinewave at Nyquist + x, what you get is a sine at Nyquist - x, and you cannot lowpass out this frequency after it has been introduced. You can however upsample your signal first, then use a lowpass filter, then downsample again. See this chapter in The Book for more info: http://crca.ucsd.edu/~msp/techniques/latest/book-html/node194.html and J07.oversampling.pd Ciao -- Frank Barknecht _ __footils.org_ __goto10.org__ ___ PD-list@iem.at mailing list UNSUBSCRIBE and account-management - http://lists.puredata.info/listinfo/pd-list -- Help the Environment, Plant a Bush back in Texas! I place economy among the first and most important republican virtues, and public debt as the greatest of the dangers to be feared. To preserve our independence, we must not let our rulers load us with perpetual debt. -- Thomas Jefferson, third US president, architect and author (1743-1826) Give Peace a Chance -- John Lennon (9 October 1940 _ 8 December 1980) Peace may sound simple_one beautiful word_ but it requires everything we have, every quality, every strength, every dream, every high ideal. _Yehudi Menuhin (1916_1999), musician ___ PD-list@iem.at mailing list UNSUBSCRIBE and account-management - http://lists.puredata.info/listinfo/pd-list ___ PD-list@iem.at mailing list UNSUBSCRIBE and account-management - http://lists.puredata.info/listinfo/pd-list
Re: [PD] a little pitchshifter
there's also G09.pitchshift.pd, which i've not looked at beyond simply triggering it. not fft but two playheads. drumloop timing is a bit messy and it looks different in construction than your patch (though i don't know what happens inside [susloop~]). i'm looking forward to getting on with miller's book and actually understand what this is all about... Thomas Mayer [EMAIL PROTECTED] wrote: The patch is just a little dirty hack with looping a 10 ms long sample (or cutting off a bit when pitching down). It would be better to do that with Fourier transformation, but I am too stupid^H^H^H^H^H^H^inexperienced to do that in Pd ;) ___ PD-list@iem.at mailing list UNSUBSCRIBE and account-management - http://lists.puredata.info/listinfo/pd-list
Re: [PD] a little pitchshifter
on a related note, could someone answer a very basic question for me? what's the cheapest (in my effort and cpu effort) way to simply change the playback speed of some audio in an array? i.e. changing pitch and speed. at the moment i'm looping something with tabplay, but want to make a slider that adjusts the speed like a turntable. does it end up requiring fiddly interpolating or anything? thanks, pete. ___ PD-list@iem.at mailing list UNSUBSCRIBE and account-management - http://lists.puredata.info/listinfo/pd-list
Re: [PD] a little pitchshifter
robbert van hulzen wrote: well then, thanks for doing my homework! ;) nice one. (i like how it gives a kind of flanger effect on the drum loop i tried it with, almost more like a filter, because of the high noise portion of the signal, i suppose.) cheers, robbert The patch is just a little dirty hack with looping a 10 ms long sample (or cutting off a bit when pitching down). It would be better to do that with Fourier transformation, but I am too stupid^H^H^H^H^H^H^inexperienced to do that in Pd ;) cu Thomas -- Prisons are needed only to provide the illusion that courts and police are effective. They're a kind of job insurance. (Leto II. in: Frank Herbert, God Emperor of Dune) http://thomas.dergrossebruder.org/ ___ PD-list@iem.at mailing list UNSUBSCRIBE and account-management - http://lists.puredata.info/listinfo/pd-list
re: [PD] a little pitchshifter
well then, thanks for doing my homework! ;) nice one. (i like how it gives a kind of flanger effect on the drum loop i tried it with, almost more like a filter, because of the high noise portion of the signal, i suppose.) cheers, robbert Thomas Mayer [EMAIL PROTECTED] wrote: Hello, after all the discussion about looping samplers etc., I have made a small abstraction patch that does pitchshifting. It uses susloop~ and the higher math externals, and I don't know if standard Pd has all those installed. Left input takes the sound, right input transposion in halftones. It is designed for a sample rate of 44100 Hz, but you can change that with a little editing. So, yet another thing, anyone should have patched in Pd accomplished ;) cu Thomas ___ PD-list@iem.at mailing list UNSUBSCRIBE and account-management - http://lists.puredata.info/listinfo/pd-list