Live data from Hacker News

Python, Pitch Shifting, and the Pianoputer

zulko.github.io

1–10 of 32 posts

Re: Python, Pitch Shifting, and the Pianoputer

#2
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

#6
post #3

I 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 information for debugging.

Re: Python, Pitch Shifting, and the Pianoputer

#8
post #2

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 lo…

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

#9
post #2

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 lo…

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!
Post reply on HN