Tell me more ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'd like to write a simple keyboard program that plays in Just Intonation. I'm an experienced programmer, but I've never delved into writing an instrument before. In my (admittedly naive) thinking, one way to do this is to record my own sounds at a set of frequencies, and then trigger them when different keys are struck.

However, I am wondering what tools/apis/languages are out there that will let me programmatically generate and play tones, at any given frequency?

I'm language agnostic, but something that I could use on OSX or ubuntu would be ideal.

share|improve this question

4 Answers

up vote 3 down vote accepted

Csound, without a doubt. Perhaps C (which is what Csound is written in). Python for use as a scripting language with Csound. Csound has been around for many years and is the industry standard for doing exactly what you described.

Potentially ChucK, which is a newer real-time sound synthesis language.

Just Google "Csound just intonation", and you'll come up with many results of others who have done this already.

Then it's trivial just to either hook up your MIDI controller or even use your computer's keyboard for the MIDI controller.

Both Csound and ChucK are open source.

share|improve this answer

Try out ChuCK, it's wicked fast to do what you want with that language:

http://chuck.cs.princeton.edu/

share|improve this answer

Realtime, performance critical audio/music programs (e.g. your VST/AU/LADSPA synths) are typically written in C++. If that's what you mean by write - then that's the language most use these days. For API, the VST SDK may be a good starting point for you.

Some programs also provide higher level abstractions. I suppose you may want to decide which route you want to take. (other answers provide some starting points, but you may also be interested in PD, Max/MSP, Reaktor, or SuperCollider).

share|improve this answer

Here's a small program in Matlab to do that exactly.

sampleRange = 0:10000;
targetFrequencyInHz = 1000;
samplingFrequencyInHz = 8000;
signal = sin(2 * pi * targetFrequencyInHz * sampleRange / samplingFrequencyInHz);
sound(signal, samplingFrequencyInHz); % play the sound
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.