File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other JSE/JEE APIs and the fly likes Java Midi Synthesizer API Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Java Midi Synthesizer API" Watch "Java Midi Synthesizer API" New topic

Java Midi Synthesizer API

Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3753

Hi All,

Is it possible to use the Java Midi Synthesizer API to get a glissando (ascending set of notes) effect? On some instruments this is thought of as a slurring of notes.

An example of what I'd like to do is play a scale (8 notes) fast (1-2 second), probably using noteOn()/noteOff(). Some instruments that require notes to be played long to sound properly (violin) sound very akward when they are played in short bursts. I'd like to know if there is a way to continue the sound of the instrument while switching notes as is done in a glissando.

[ October 23, 2007: Message edited by: Scott Selikoff ]

[OCA 8 Book] [Blog]
Marc Peabody
pie sneak

Joined: Feb 05, 2003
Posts: 4727

Your violin samples, are they samples from the Java API or are you playing the sounds through a peripheral device (like a Yamaha keyboard)?

I'd hate to get something working at home only to have it not work for you because you're using a different setup.

A good workman is known by his tools.
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3753

Just sounds generated through the API (such as using noteOn and noteOff) and played through the sound card.
Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
One possibility is to make the notes overlap - call noteOff() on the first note only after calling noteOn() on the previous note. For some instruments this may help blend the notes together more smoothly.

Another possibility is to use MidiChannel's setPitchBend() to gradually increase or decrease the pitch. Unfortunately there are limitations:
  • It affects the whole channel at once, so if you want any polyphony (as in my above suggestion) you'll need to play different notes on different channels
  • It's not clear how far up or down the different settings modulate the tone; you may need to experiment.
  • There's a maximum range you can bend up or down - typically two semitones. For a glissando across a larger range, you'd need to mix with other notes and channels.

  • Still, it might be worth trying this as one way to help smooth out the glissando.

    I'll be interested to hear what works for you, if anything.
    [ October 23, 2007: Message edited by: Jim Yingst ]

    "I'm not back." - Bill Harding, Twister
    I agree. Here's the link:
    subject: Java Midi Synthesizer API
    It's not a secret anymore!