factor = 2**(1.0 * n / 12.0) Aargh, equal temperament! b^)
You were hoping for just intonation?
Python, Pitch Shifting, and the Pianoputer
21–30 of 32 posts
Re: Python, Pitch Shifting, and the Pianoputer
#22I checked out the solution on github, but my results were not like advertised in the video. On my laptop it sounded like a dying cat of some sort.
It would be more helpful if you could describe the results more accurately. The most common reasons in audio problems I've found are mismatching sample rates and a failure to meet the deadline of the audio interrupt, causing choppy or distorted audio. A mismatched audio format (ie. number of channels or bits per sample) might also cause problems. Also, knowing what OS/Audio api backend is being used is vital informat…
I can't affort to "nerd into" the actual problem right now. Hence the whitty and non constructive comment. Apologies.
Re: Python, Pitch Shifting, and the Pianoputer
#23Re: Python, Pitch Shifting, and the Pianoputer
#24Earlier quoted context omitted.
You were hoping for just intonation?
Funny you should ask. I spent a while a few years ago messing around with csound, synthesizing Bach chorales in a number of tuning systems. You could tell a difference, IIRC, even with kind-of-unpleasant synthesized tones. I'd have to go back and look up what I did, but I must have done both equal temperament and (some kind of) just intonation.
Re: Python, Pitch Shifting, and the Pianoputer
#25Cool, but seems a bit hackish to me. Wouldn't the "proper" way to pitch shift involve taking a Fourier transform of the sound and simply shifting all the frequencies by some factor? Wouldn't this result in better quality, or are there aliasing issues or something I'm not aware of?
The phase vocoder does use an FFT on each window internally, so that it can ensure the phases remain continuous when everything is merged back together. There are variants that let you monkey around with the FFT coefficients before the merge, so you can pitch-shift that way, but I believe when you stitch it back together you end with with the exact same artifacts as the two-step way. I think people have concentrated on perfecting time-stretching since pitch-shifting can be derived from it.
The problem with doing an FFT on the entire length of the sample is that shifting all frequencies would then simply speed it up as well as changing the pitch ;) Chopping it up into bits is key to separating the fundamental frequencies that we percieve as the general "pitch" and all the time-varying harmonics that we percieve as "timbre".
edit: what is maybe a bit hackish is the crude resampling here - when going to the trouble of building a phase vocoder at least some linear interpolation might be appropriate rather than just dropping/repeating samples ;)
Re: Python, Pitch Shifting, and the Pianoputer
#26Earlier quoted context omitted.
Funny you should ask. I spent a while a few years ago messing around with csound, synthesizing Bach chorales in a number of tuning systems. You could tell a difference, IIRC, even with kind-of-unpleasant synthesized tones. I'd have to go back and look up what I did, but I must have done both equal temperament and (some kind of) just intonation.
You can absolutely tell a difference! Probably more so with synthesized sounds, which don't have natural pitch deviations or complex harmonics. The beating you hear in any even-tempered dyad other than an octave is really obvious with sine or square waves, presumably especially so with the sustained notes in a chorale :)
Re: Python, Pitch Shifting, and the Pianoputer
#27FL Studio (a so-called digital audio workstation) has an option for using the typing keyboard as a piano keyboard. The layout looks like this: http://www.image-line.com/support/FLHelp/html/img_glob/qwert... I'll definitely try the layout as mentioned in the article, the playing looks very natural. Not very hacky, but you can download the free demo of FL and have a go at playing with many synthesizers and audio sample…
Anyone who hasn't tried it should give it a whirl - it's got the hexadecimal-happy vertical sequencing of a tracker, combined with an insanely flexible modular sound workspace. I switched to FL 'full time' eight or so years ago, but I've never found anything as intuitive for sound design as Buzz.
Re: Python, Pitch Shifting, and the Pianoputer
#28Earlier quoted context omitted.
It would be more helpful if you could describe the results more accurately. The most common reasons in audio problems I've found are mismatching sample rates and a failure to meet the deadline of the audio interrupt, causing choppy or distorted audio. A mismatched audio format (ie. number of channels or bits per sample) might also cause problems. Also, knowing what OS/Audio api backend is being used is vital informat…
You are right, feedback should contain constructive comments, but I couldn't be bothered to go into further details when I wrote my response. Here is a short video that I made showing what it really sounds like on my machine: https://vimeo.com/97857232 I can't affort to "nerd into" the actual problem right now. Hence the whitty and non constructive comment. Apologies.
Re: Python, Pitch Shifting, and the Pianoputer
#29Writing sound/music-generating applications is one of the most fun things you can do with your computer! Here's a simple synth I wrote some years ago. https://github.com/rikusalminen/jamtoysynth/blob/master/src/... It was originally intended for a 4k intro (ie. demoscene) which I never finished. The synth was written in x86 assembler using 16.16 fixed point algebra because the instruction encoding for grabbing the lo…
There's a small demo [2], based on an older version of the lib, which can be played using the keyboard.
[1]: https://github.com/zenoamaro/audiokit [2]: http://zenoamaro.github.io/audiokit/
Re: Python, Pitch Shifting, and the Pianoputer
#30Cool, but seems a bit hackish to me. Wouldn't the "proper" way to pitch shift involve taking a Fourier transform of the sound and simply shifting all the frequencies by some factor? Wouldn't this result in better quality, or are there aliasing issues or something I'm not aware of?
Furthermore, the "proper" way would pass the sound through an anti-alaising filter before creating a higher pitch tone. However, at 48kHz (as in the post), this isn't really an issue for audio.