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?
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
and amplitude
, 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 :)