News for hackers. Stuff that matters.
Re:Python, Pitch Shifting, and the Pianoputer by exDM69 on Tuesday June 10, 2014 @09:37AM (#7872354)
Writing 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 lower 16 bit part (AX) of a 32 bit register (EAX) uses very short instruction encoding. The old assembler synth was under 1k in size, uncompressed.

This version is written with floats and is written in easy-to-read C code, but it's essentially the same logic.

I also enjoy using the keyboard as a piano-like control device, like tracker software back in the day. Here's an excellent example of playing music using the qwerty keyboard: https://www.youtube.com/watch?v=3JQkW6BgUYU

Re:Python, Pitch Shifting, and the Pianoputer by dekhn on Tuesday June 10, 2014 @11:26AM (#7873055)
To teach mysefl a bit more about x86 assembly I once wrote a speaker-clicking loop. It was very educational: when I first played A440, a person in the room spoke up and said "I have perfect pitch. That's 438Hz".

he was right. I had a delay bug.

Re:Python, Pitch Shifting, and the Pianoputer by lifeformed on Tuesday June 10, 2014 @12:52PM (#7873699)
That's crazy, can someone with perfect pitch really be that accurate?
Re:Python, Pitch Shifting, and the Pianoputer by kencausey on Tuesday June 10, 2014 @01:36PM (#7874030)
Actually, it might not be as difficult as you think. Someone with a good knowledge of music theory and some ability with perfect pitch may well be able to recognize the difference with current A440 tuning and A435. Given that ability being able to recognize that it is between either and then guessing 438hz (and being lucky) doesn't seem too hard to believe to me. That said, I'm sure I couldn't manage to even guess within 100hz.
Re:Python, Pitch Shifting, and the Pianoputer by dekhn on Tuesday June 10, 2014 @03:39PM (#7874834)
Yes. I later tested and he had 1hz resolution in that range(!!!)
Re:Python, Pitch Shifting, and the Pianoputer by m-photonic on Thursday June 12, 2014 @01:23AM (#7881927)
That's about four cents, or a twenty-fifth of a semitone. I don't think I can even distinguish relative pitch at that level (although 15 cents I can do easily -- roughly the difference between a just major third and an equal-tempered one).
Re:Python, Pitch Shifting, and the Pianoputer by strags on Tuesday June 10, 2014 @11:35AM (#7873120)
A MOD player was my first ever real x86 asm program - I remember discovering that trick too - store the 16.16 value rotated by 16 bits, then use ADD and ADC to increment it according to frequency. Good times!
Re:Python, Pitch Shifting, and the Pianoputer by zenojevski on Wednesday June 11, 2014 @05:50AM (#7877143)
Not remotely as cool, but I was working on a modular synthesizer lib [1] based on the js node audio API.

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/