I've been looking at people's Java synth but can't make out how to produce a simple version of their program. My goal is to create a simple test tone in java, which the user will be able to alter by pressing certain keys. For example pressing "r" will raise the amplitude, or "f" will increase the frequency. I would just like to know: where to get started on creating this?
Java Synth: Making a Test Tone
397 views Asked by Fred V At
3
There are 3 answers
0
On
I have a Theremin that runs via Java:
http://www.adonax.com/blog/?p=187 http://www.hexara.com/VSL/JTheremin.htm
Since I'm using a wavetable to generate the data, the pitch is determined by the rate at which the cursor progresses through the table. I use linear interpolation when the cursor lands between table elements. Thus, if a 1024 element table describes a single sine wave, going through it one element at a time is one speed, going through it 1.2 elements at ta time (with linear interpolation to get the intermediate values) is a bit faster and a higher pitch.
Well, it would be unpleasant, but the simplest approach would be to create a square wave.
Depending on whether you're creating a file with signed or unsigned amplitudes, you'll need to work out whether to oscillate between
0
andamplitude
, or-amplitude
and+amplitude
.The frequency will determine how many samples to create at each value before switching.
It's hard to hlep more without any more details about what output format you're trying to create, etc - but that may help you to start with. Create a sine wave for a rather nicer tone :)