provide-free-support Ujjwal's Blog: Fun with music in Java

Friday, June 1, 2012

Fun with music in Java

Music programming in Java is now easy with jfugue.

Step 1. Download

Go to jfugue.org → Download → jfugue-4.0.3.jar

Step 2. Place it in the classpath

Eclipse: Project > Java Build Path > Libraries > Add External JARs…
Netbeans: File > “Project” Properties > Libraries > Add JAR/Folder
JDeveloper: Tools > Project Properties… > Libraries and Classpath > Add JAR/Directory…

Step 3. Have fun

Play a note

new Player().play("C");

Play a note on a different octave

// 7th octave of the piano
new Player().play("C7");

Play a note with different duration

// w means whole = 4/4
new Player().play("Cw");

Play two notes

new Player().play("C D");

Use a rest

new Player().play("C R D");

Play some notes together

// h means half = 2/4
new Player().play("C5h+E5h+G5h+C6h");

Pick a different instrument

new Player().play("I[HARMONICA] C D E");

Play a simple song

new Player().play("I[BLOWN_BOTTLE] Gh Eq Cq | Gw | Gh Eq Cq | Gw");

Play a simple song with different tempo

new Player().play("T[220] I[KALIMBA] Gh Eq Cq | Gw | Gh Eq Cq | Gw");

Create a rythm!

Rhythm rhythm = new Rhythm();
rhythm.setLayer(1, "...*...*...*...*");
rhythm.setLayer(2, "----------------");
rhythm.addSubstitution('.', "Ri");
rhythm.addSubstitution('*', "[SKAKUHACHI]i");
rhythm.addSubstitution('-', "[PEDAL_HI_HAT]s Rs");
new Player().play(rhythm.getPattern());

Conclusion

At last, it’s easy to program some music for our games and create sounds for our applications.
The sound API of JDK really needed this comfortable boost. Congratulations to David Koelle for creating this tool!




No comments:

best-it-exam-    | for-our-work-    | hottst-on-sale-    | it-sale-    | tast-dumps-us-    | test-king-number-    | pass-do-it-    | just-do-it-    | pass-with-us-    | passresults-everything-    | passtutor-our-dumps-    | realtests-us-exam-    | latest-update-source-for-    | cbtnuggets-sale-exam    | experts-revised-exam    | certguide-sale-exam    | test4-sale-exam    | get-well-prepared-    | certkiller-sale-exam    | buy-discount-dumps    | how-to-get-prepared-for-the    | in-an-easy-way    | brain-dumps-sale    | with-pass-exam-guarantee    | accurate-study-material    | at-first-try    | 100%-successful-rate    | get-certification-easily    | material-provider-exam    | real-exam-practice    | with-pass-score-guarantee    | certification-material-provider    | for-certification-professionals    | get-your-certification-successfully    | 100%-Pass-Rate    | in-pdf-file    | practice-exam-for    | it-study-guides    | study-material-sku    | study-guide-pdf    | prep-guide-demo    | certification-material-id    | actual-tests-demo    | brain-demos-test    | best-pdf-download    | our-certification-material    | best-practice-test    | leading-provider-on    | this-course-is-about    | the-most-reliable    | high-pass-rate-of    | high-pass-rate-demo    | recenty-updated-key    | only-for-students-free-download    | courseware-plus-kit-for    | accurate-answers-of    | the-most-reliable-id    | provide-training-for    | welcome-to-buy    | material-for-success-pass    | provide-free-support    | best-book-for-pass    | accuracy-of-the-answers    | pass-guarantee-id    | pass-exam-key    | pass-sku-id    | study-for-exid    | pdf-sku-exid    | sku-pdf-id    | pdf-demo-key    | exam-demo-ske    | pass-it-dump    |
http://www.menuiserie-dauvergne.com/    | http://www.menuiserie-dauvergne.com/    |