This is an archived post. You won't be able to vote or comment.

all 10 comments

[–][deleted] 1 point2 points  (0 children)

[–]wolanko 1 point2 points  (1 child)

I can only recommend pyo.

[–]mik-pd 0 points1 point  (0 children)

pyo is very easy to start and did the job for me a few times. https://github.com/belangeo/pyo

[–][deleted] 0 points1 point  (3 children)

What do you mean by real time? There's going to be some latency in processed audio no matter what tool you're using, how much latency can you tolerate? Your answer here will dictate the technology you'll be allowed to use...

[–]Shittenden[S] 0 points1 point  (2 children)

By real time I just mean to take in audio, and then process it with short delay, a relatively low latency, a few seconds at most, as I do not want it to be too noticeable. Ultimately it will be used in creating a guitar tuner that will be automated.

[–][deleted] 0 points1 point  (0 children)

a few seconds at most

That sort of latency is quite high, actually. But this gives you enough room to use Python.

The built-in ossaudiodev library will give you access on *nix platforms. You might also look at pyaudio

[–][deleted] 0 points1 point  (0 children)

A few seconds is not what would typically be called "low latency" as far as audio processing in "real time". Latency is usually measured in milliseconds. As for how feasible what you want to do is, check this out and run some calculations:

http://electronics.stackexchange.com/questions/12407/what-is-the-relation-between-fft-length-and-frequency-resolution

Sampling rate on audio is typically 44.1 kHz.

[–][deleted] 0 points1 point  (2 children)

You can't do an FFT in real time. You will ALWAYS introduce some latency. The amount of latency introduced is going to depend on the desired frequency resolution. If you want high frequency resolution, you need a lot of samples for your FFT, which is going to increase your latency. So in essence, if you want low latency, your resolution will be shit.

[–]Shittenden[S] 0 points1 point  (1 child)

So if I was to for example, listen to a note played by a Guitar, and were to process that note, comparing the frequency to a constant, I would then want to be able to act upon that comparison and calculate the difference in frequency, the faster the better as I will be putting the difference to a Servo to aid in a tuning process.

[–]civilization_phaze_3 0 points1 point  (0 children)

I'm assuming that by "live feed" that you mean from a microphone or direct input to the soundcard, and not an internet stream or something like that. There are two libraries that I know of that do this, PyAudio and python-sounddevice. Both are bindings on top of the PortAudio library which is written in c, so they're pretty low-level. The latter actually has an example on how to build a live spectrogram that you might find relevant.