Reply by robert bristow-johnson April 29, 20062006-04-29
Michel Rouzic wrote:
> Rune Allnor wrote:
...
> > A popular model for the human vocal system, is that the vocal cords > > act like a "repeated pulse source" that feed a pulse train into > > the vocal tract, which in turn acts as a filter to shape the sound. > > The period between the pulses emitted by the vocal cords determine > > the pitch. > > > > You can (formally) separate the pulses and the filter response by using > > a cepstrum. If you manage to do that, you can impose a different pitch, > > and then re-synthesize the signal.
another way is to run a pitch detector (so you know how long a period is) and window off a cycle into an overlapping "wavelet" or "grain". then to resynthesize, you output those grains at the rate of the output fundamental frequency (and overlap). the changes the pitch, but preserves the formants or the spectral envelope. this was first described by Keith Lent in 1989 and i did a paper about it in JAES in '95. (i lost my original manuscript in machine readable form, but i have a PDF of the journal paper if you want it.)
> > Actually, this just might work with musical instruments as well.
usually sounds like dog feces compared to a regular old pitch shifter (below). ...
> that may be slightly over simplistic but my basic idea is there, such > "slices" would be easy to be made longer, by for example taking each > wave and repeating it twice (or even better trying to interpolate new > waves by measuring the height of the wave on the left and the height of > the wave on the right). in this example then you'd have each slice > successfully pitch-shifted right? (or rather time-stretched) and since > adding all the original slices together would bring you back to the > original signal, adding all the time-stretched slices together would > get you to a nicely time-streched signal > > is there a major flaw in my idea or is it worth exploring/testing?
this is the quite common time-domain method of time-scaling audio and works very well (as long as you have a decent pitch or period detector) for monophonic (more accurately quasi-periodic) sounds. like a single tone. if you take your time-stretched result and speed it up (using resampling) so that it is back to the original tempo, that pitch-shifting *up*. you can time-compress it and slow it down to down shift. works good for single note instruments. pitch shifting a human voice this way "munchkinizes" it or "chipmunkizes" it if you upshift a lot (it turns your voice into that of Satan from Hell if you downshift sufficiently). but if you're just time-scaling your voice (not pitch-shifting), this method is good. have fun with the project. r b-j
Reply by Michel Rouzic April 28, 20062006-04-28
Rune Allnor wrote:
> Michel Rouzic skrev: > > Rune Allnor wrote: > > > Michel Rouzic skrev: > > > > > sure, but in the first place I had some trouble seeing how it could be > > > > performed in the linear scale, and actually, I have quite some trouble > > > > successfully implementing it. > > > > > > Sure. But doing these things in logarithmic scale don't make > > > it easier. > > > > not only it wouldn't be easier, but i would get quite the same result, > > right? > > I have never tried these things, neither in linear or log scale. > The naive answer would be "yes, both approaches should give > similar answers", but there might be some detail that changes that. > > ... > > > > let's see, > > > > if i want to move everything up by one octave, it must i must multiply > > > > every frequency by two, frequency 0.01 becomes 0.02, frequency 0.1 > > > > becomes 0.2 etc... so basically, it's all about interpolating the > > > > signal in the frequency domain by a factor of 2, which is zero-padding > > > > in the time domain, and then get rid of the upper half of the spectrum > > > > so that I get my frequency multiplication right. > > > > > > Aha... you want to do a frequency shift? > > > > Can't be called that I think. IIRC, frequency shift is when you add a > > certain amount of Hz to every frequency, as what i'm looking for is > > pitch shift, which is multiplying every frequency by a certain ratio. > > Yep, you are right. Now it all makes sense. > > Well, we are back to these questions about the application. I don't > know > howa pitch shifting device to "tune" a recording of a musical > instrument > would work, but to "tune" the human voice, there is a different > approach > that might be easier to implement. > > A popular model for the human vocal system, is that the vocal cords > act like a "repeated pulse source" that feed a pulse train into > the vocal tract, which in turn acts as a filter to shape the sound. > The period between the pulses emitted by the vocal cords determine > the pitch. > > You can (formally) separate the pulses and the filter response by using > a > cepstrum. If you manage to do that, you can impose a different pitch, > and then re-synthesize the signal. Actually, this just might work with > musical instruments as well. > > Now, before you start fiddling with the cepstrum, be warned that the > cepstrum is a numerical nightmare, that is far from stable and not > anywhere near guaranteed to work. > > ... > > > > yeah, i'm definitly confused, and right now I have no idea on how to > > > > obtain something different than zeropading and decimation in the time > > > > domain out of frequency-domain interpolation. > > > > > > The zero padding is as expected, the resampling... well, I don't know. > > > > well the resampling is because i did it. and the reason i did it was to > > make sure what making it in a way so that every frequency is multiplied > > by 2.0 was getting me to. > > If pitch shifts was your objective, that seems sensible. > > > sounds like there is no way you can possibly get to pitch shift no > > matter what you do with a simple FFT, logarithmic scaling or not. my > > idea for logarithmic scaling and then shifting came from some program I > > did that consists of making a log-scaled spectrogram and turning it > > back into a sound, shifting the spectrogram vertically would result in > > pitch shifting, only, due to the great loss of information during the > > spectrogram analysis, it's not a viable way to obtain a high quality > > pitch shifting. > > OK... did you use the spectrogram as the starting point for this > excercise? Did you compute it yourself or did you use a canned > routine to do that? > > There are at least two potential problems with the spectrogram. > First, spectrogramsdon't contain phase information. So they are > no exact representation of the signal. Second, it is not obvious > how to mount all the shifted spectra back together even if you > managed to do things correctly with each individual spectrum. > > > fortunatly, i have a new idea to test. it consists this time of > > analyzing the sounds into a bi-dimensional complex array (in the > > rectangular form, not polar) obtained by STFT, based on the idea that > > you can get back to the exact original signal from what's stored in > > that array, interpolating in either axis might give interesting > > results. i guess i'll try that idea tomorrow, it musn't be too hard to > > implement, it's quite the same principle as STFT-based spectrography, > > the main difference being keeping the whole complex information instead > > of just computing the magnitude. > > Sounds like a nice project. > > Rune
Well I just had a new idea and I'd appreciate criticism before I'd start implementing it. There it is. One thing about phase vocoding (i think), if I got it right, is that it tries to determine something like the best window size matching to something like a repetitive pattern in the signal in order to diminish the "smearing" or something like this. well I hardly manage to explain it, plus I forgot where I read about it, but anyways, that made me think, if you "cut" the signal into slim slices, I mean if you use a filter bank with filters with quite a narrow bandwidth, basically each "slice" looks like a bunch of waves all of the same length but not the same height. that may be slightly over simplistic but my basic idea is there, such "slices" would be easy to be made longer, by for example taking each wave and repeating it twice (or even better trying to interpolate new waves by measuring the height of the wave on the left and the height of the wave on the right). in this example then you'd have each slice successfully pitch-shifted right? (or rather time-stretched) and since adding all the original slices together would bring you back to the original signal, adding all the time-stretched slices together would get you to a nicely time-streched signal is there a major flaw in my idea or is it worth exploring/testing?
Reply by Rune Allnor April 24, 20062006-04-24
Michel Rouzic skrev:
> Rune Allnor wrote: > > Michel Rouzic skrev: > > > Rune Allnor wrote: > > > > Sounds like a nice project. > > > > > > > > Rune > > > > > > Nope. Turns out that it really sucks. Sounds just like the way Adobe > > > Audition does it. > > > > What happened? > > you know, that's just not what I wanted, that was just as bad as every > other pitch shifting I ever heard before. the worse is that now that > i've done that my first approach (that I imagined before I even started > DSP...) which was to use a log-scaled spectrogram doesn't seem that > ridiculous anymore (althought totally unsuitable for what I want to do)
OK. So you haven't kicked the feet away under your idea, but discovered there is a lot more work to be done. That sort of conclusion isn't all that uncommon.
> > The thing blew up? If so, that's life. Not every idea turns out to be > > a good one. In 15 years I have had two - 2 - ideas dealing with DSP > > that could not be shot down withing a couple of hours. Neither > > was useful. > > Don't worry, I wasn't making myself too many illusions about my idea. > It only made me realize better how that pitch shifting problem was far > from as simple as I could imagine. So far I treated the problem quite > lightly, like, I just wanted to give it a try, but if I want to go any > further with that problem I'll have to pay attention to any approach > that has done before.
That's one of my hobby horses. Check out what other people tried, see how well they did, and see in anythng can be improved. For some reason, lots of people dont do that.
> > You did something right but somebody else had already done it? > > Been there, done that. Five or 10 times or so, during the last 15 > > years. While it may be frustrating at first, you at least came up > > with a solution that some smart guy already came up with and that > > has stood the test of time. > > Yeah, but I'm still wondering how such an ugly sounding algorithm like > that could stand the test of time.
I don't know, but there are several possibilities. Maybe somebody just had a limited amount of time and $$ to implement something, got something that worked "sufficiently" well, and left it at that. If so, ther eought to be room for improvment by somebody who is willing and able to do the job. The second possible explanation is that there is some fundamental problem with some detail. My field ow work is seismics and sonar. I use to say that those techniques are in use not because they are particularly good or efficient, because they are not, but because they are the only ones that are not unconditional faliures. Some times one have to settle for whatever little one can get.
> > Don't underestimate that. The people who dominated the electronics > > and DSP 25 years ago, where the same generation that put people > > on the moon using more slide rules than transistors for design > > and computations. > > > > While people in earlier times might not have had access to 1 GB > > RAM and matlab, they had their wits about them. > > 1 GB RAM and matlab? Only 768 MB for me and homemade C functions ;-)
You have the advantage. Implementing your own stuff instead of relying on canned routines... Rune
Reply by Michel Rouzic April 23, 20062006-04-23
Rune Allnor wrote:
> Michel Rouzic skrev: > > Rune Allnor wrote: > > > Sounds like a nice project. > > > > > > Rune > > > > Nope. Turns out that it really sucks. Sounds just like the way Adobe > > Audition does it. > > What happened?
you know, that's just not what I wanted, that was just as bad as every other pitch shifting I ever heard before. the worse is that now that i've done that my first approach (that I imagined before I even started DSP...) which was to use a log-scaled spectrogram doesn't seem that ridiculous anymore (althought totally unsuitable for what I want to do)
> The thing blew up? If so, that's life. Not every idea turns out to be > a good one. In 15 years I have had two - 2 - ideas dealing with DSP > that could not be shot down withing a couple of hours. Neither > was useful.
Don't worry, I wasn't making myself too many illusions about my idea. It only made me realize better how that pitch shifting problem was far from as simple as I could imagine. So far I treated the problem quite lightly, like, I just wanted to give it a try, but if I want to go any further with that problem I'll have to pay attention to any approach that has done before.
> You did something right but somebody else had already done it? > Been there, done that. Five or 10 times or so, during the last 15 > years. While it may be frustrating at first, you at least came up > with a solution that some smart guy already came up with and that > has stood the test of time.
Yeah, but I'm still wondering how such an ugly sounding algorithm like that could stand the test of time.
> Don't underestimate that. The people who dominated the electronics > and DSP 25 years ago, where the same generation that put people > on the moon using more slide rules than transistors for design > and computations. > > While people in earlier times might not have had access to 1 GB > RAM and matlab, they had their wits about them.
1 GB RAM and matlab? Only 768 MB for me and homemade C functions ;-)
Reply by Rune Allnor April 23, 20062006-04-23
Michel Rouzic skrev:
> Rune Allnor wrote: > > Sounds like a nice project. > > > > Rune > > Nope. Turns out that it really sucks. Sounds just like the way Adobe > Audition does it.
What happened? The thing blew up? If so, that's life. Not every idea turns out to be a good one. In 15 years I have had two - 2 - ideas dealing with DSP that could not be shot down withing a couple of hours. Neither was useful. You did something right but somebody else had already done it? Been there, done that. Five or 10 times or so, during the last 15 years. While it may be frustrating at first, you at least came up with a solution that some smart guy already came up with and that has stood the test of time. Don't underestimate that. The people who dominated the electronics and DSP 25 years ago, where the same generation that put people on the moon using more slide rules than transistors for design and computations. While people in earlier times might not have had access to 1 GB RAM and matlab, they had their wits about them. Rune
Reply by Michel Rouzic April 23, 20062006-04-23
Rune Allnor wrote:
> Sounds like a nice project. > > Rune
Nope. Turns out that it really sucks. Sounds just like the way Adobe Audition does it.
Reply by Jerry Avins April 18, 20062006-04-18
Michel Rouzic wrote:
> Jerry Avins wrote: > >>Rune Allnor wrote: >> >> ... >> >> >>>Sounds like a nice project. >> >>It would seem so to me too if it weren't already a standard part of the >>audiodiddler's repertoire. With so many wonderful techniques left to be >>invented, the only reason I can see for revisiting old ones is improving >>them. "I can to it better" is a fine motivation, but it implies that the >>old inferior way is known. Even the best see further by standing on the >>shoulders of giants. One who is too proud to climb doesn't get much of a >>view. > > > I will gladly enjoy the previous experience of others, but i tried > googling "audiodiddler" and it returned 0 results. can you link please?
A word I coined. It means one who diddles with audio, either by changing tempo without shifting pitch, shifting pitch without changing tempo, altering frequency response, and other techniques collectively known as audio FX. Stephan Bernsee (who will show up in Google) source code and has an excellent pitch-shifting tutorial on dspdimension.com, his website, (which will also show up in Google), and to which I earlier referred you. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Reply by Rune Allnor April 18, 20062006-04-18
Michel Rouzic skrev:

> doing all that also makes me understand better the underlying > principles, because I'm still often confused when it comes to thinking > of things in the frequency domain, and everyday through the stuff i try > my vision and understanding of it all changes quickly.
Just a word of caution: You should allow for the possibility that your idea somehow is flawed, that your particular approach for some reason does not work. As somebody else said, understanding why something does *not* work is as valuable as understanding why something else does. Rune
Reply by Michel Rouzic April 17, 20062006-04-17
Jerry Avins wrote:
> Ron N. wrote: > > Jerry Avins wrote: > > > >>Rune Allnor wrote: > >> ... > >> > >>>Sounds like a nice project. > >> > >>It would seem so to me too if it weren't already a standard part of the > >>audiodiddler's repertoire. With so many wonderful techniques left to be > >>invented, the only reason I can see for revisiting old ones is improving > >>them. > > > > > > Some of the most interesting educational projects (self > > or class assigned) are to try and (re)invent something not > > previously described in the textbook. They might be best > > considered as "finger exercises". One tests ones knowledge > > and creativity by seeing how close ones solutions are to the > > existing generic methods. It's like closing the textbook > > halfway through a proof or description and seeing if you > > can finish it yourself, rather than just memorizing the text > > so you can regurgitate it upon stimulus. > > > > I like this practice because it often helps me learn to recognize > > by experience which kinds of solutions techniques won't work > > (e.g. often the first few I try... :) , as well as alternative > > methods which sometimes actually do work in some limited > > problem domains. > > I agree. But there is usually the goal of doing it > more cleverly; > at lower cost; > in a more readily understandable or explainable way; > in a way that fits better than what can be bought; > in a way that embodies a sentiment; > OR > without the hassle of having to look it up. > > I've infringed more patents than I know (and lost opportunities to > patent things) because it's often easier to just do something than it is > to research how it's normally done. I have made my own toys and > artifacts, from a string-pulled dump truck made from wooden cheese boxes > and checkers, through a Hi-Fi system that I wanted but couldn't afford > (my introduction to electronics), a pair of silver earrings for a > friend's sweet-sixteen party gift and years later a ring for our > wedding, to custom furniture for our home. My daughter has the > plush-lined cedar jewelry box I made for my mother one rainy day in the > country. Believe me, I understand pride of authorship. Michel seems to > be on a different track. Maybe I'm wrong.
I don't know. I like to do things by myself, even if they have been implemented a thousand times before. by that I mean all the code I work with I made it myself, from the .wav and .bmp i/o functions to well anything else I use, except the FFT. not only do you learn very well by doing everything by yourself, but it's quite satisfying to do it all, and thus to make sure you understood it all. but right now, on that pitch shifting thing, i'm doing it without a precise goal, i barely even know why i'm doing it, but i know that i've always been intrigued by that precise problem and now that i'm able to come up with my own solution, even if it has already been done before, i just want to try and solve the problem the best way i can, and while i'll be trying to do it the way i talked about, i'll try to think of all the ways to do it i can, and eventually try to implement them if i find any interesting ones. doing all that also makes me understand better the underlying principles, because I'm still often confused when it comes to thinking of things in the frequency domain, and everyday through the stuff i try my vision and understanding of it all changes quickly. i might not come up right now with the best pitch shifting solution, but this is not the primary goal.
Reply by Jerry Avins April 17, 20062006-04-17
Ron N. wrote:
> Jerry Avins wrote: > >>Rune Allnor wrote: >> ... >> >>>Sounds like a nice project. >> >>It would seem so to me too if it weren't already a standard part of the >>audiodiddler's repertoire. With so many wonderful techniques left to be >>invented, the only reason I can see for revisiting old ones is improving >>them. > > > Some of the most interesting educational projects (self > or class assigned) are to try and (re)invent something not > previously described in the textbook. They might be best > considered as "finger exercises". One tests ones knowledge > and creativity by seeing how close ones solutions are to the > existing generic methods. It's like closing the textbook > halfway through a proof or description and seeing if you > can finish it yourself, rather than just memorizing the text > so you can regurgitate it upon stimulus. > > I like this practice because it often helps me learn to recognize > by experience which kinds of solutions techniques won't work > (e.g. often the first few I try... :) , as well as alternative > methods which sometimes actually do work in some limited > problem domains.
I agree. But there is usually the goal of doing it more cleverly; at lower cost; in a more readily understandable or explainable way; in a way that fits better than what can be bought; in a way that embodies a sentiment; OR without the hassle of having to look it up. I've infringed more patents than I know (and lost opportunities to patent things) because it's often easier to just do something than it is to research how it's normally done. I have made my own toys and artifacts, from a string-pulled dump truck made from wooden cheese boxes and checkers, through a Hi-Fi system that I wanted but couldn't afford (my introduction to electronics), a pair of silver earrings for a friend's sweet-sixteen party gift and years later a ring for our wedding, to custom furniture for our home. My daughter has the plush-lined cedar jewelry box I made for my mother one rainy day in the country. Believe me, I understand pride of authorship. Michel seems to be on a different track. Maybe I'm wrong. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������