Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (120)
games submitted by our members
Games in WIP (577)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Using hold pedal with midi  (Read 1527 times)
0 Members and 1 Guest are viewing this topic.
Offline jessedeming

Junior Newbie




Java games rock!


« Posted 2003-10-02 16:45:49 »

How can I make a midi note continue for a set amount of time?  I would like to use the acoustic nylon guitar (25) instrument, but rather than fading out I would like it to continue playing the note for 10 or 15 seconds and modify the pitch myself to simulate a person changing finger position in slow motion.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
  
//Initializing the synthesizer
try {
  m_Synth = MidiSystem.getSynthesizer();
  m_Synth.open();
  m_MidiChannel = m_Synth.getChannels();
  m_Instrument = m_Synth.getDefaultSoundbank().getInstruments();            
  m_Synth.loadInstrument(m_Instrument[GUITAR]);  
  m_MidiChannel[DEFAULT_CHANNEL].programChange(GUITAR);
  m_wCurNote=60;
} catch (Exception ex) {
  return;
}


I've tried controllers 64 - 69 and they don't appear to change anything.

1  
2  
3  
4  
5  
 
// Use soft pedal to sustain note
m_MidiChannel[DEFAULT_CHANNEL].controlChange(67,127);
m_MidiChannel[DEFAULT_CHANNEL].noteOn(m_wCurNote,67);
 

Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #1 - Posted 2003-11-30 06:56:56 »

When you send a note-on event to a MIDI channel, the note is played until you send a note-off event to the same channel with the same note number (or a note-on with velocity 0).
Don't use the sustain pedal controller (64) for this (remember the sustain controller is global over the whole midi channel so *all* playing notes on that channel with hold until the sustain pedal is released *and* the playing notes are released with note-offs or note-ons with velocity 0).
The soft pedal is something completely different and is not even implemented in many synths (so probably not in the javasound too, although I'm not sure).
If the sound still does not sustain, I'd say the sound itself may be the problem (it's probably not a sustained sound which makes sense for a guitar).
Did you test with for example a strings sound or any other sustained sound?
If you have a sustained sound playing, send pitch bender events to the MIDI channel to do what you want.

I must confess I haven't done any MIDI stuff in java yet so this is just MIDI theory.

Erik

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Longarmx (52 views)
2014-10-17 03:59:02

Norakomi (43 views)
2014-10-16 15:22:06

Norakomi (33 views)
2014-10-16 15:20:20

lcass (37 views)
2014-10-15 16:18:58

TehJavaDev (68 views)
2014-10-14 00:39:48

TehJavaDev (67 views)
2014-10-14 00:35:47

TehJavaDev (60 views)
2014-10-14 00:32:37

BurntPizza (73 views)
2014-10-11 23:24:42

BurntPizza (45 views)
2014-10-11 23:10:45

BurntPizza (86 views)
2014-10-11 22:30:10
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!