victorio
victorio

Reputation: 6636

How to generate sounds by frequency in Java?

How do I generate my own sound by frequency in Java?

I can play WAV files or MIDI files, but now I don't need this. I want to create a simple guitar program, and I want to play chords with this program. But I don't know how to make the sounds to the chords. I can record them with my own guitar, but this is not what I want, I want to generate the sounds!

What would some example code look like?

Upvotes: 7

Views: 5445

Answers (1)

Matthew Gilliard
Matthew Gilliard

Reputation: 9498

Guitar sounds are usually synthesized in software using some variant of the Karplus-Strong algorithm. There are numerous libraries for audio output depending on your requirements, but you could start with javax.sound.sampled.

Upvotes: 6

Related Questions