/** Sets the tempo used to play the tune. N.B: This is real time tempo change : * the tempo will change even if a tune is playing. * @param tempo the tempo used to play the tune. */ public void setTempo(int tempo) { m_tempo = tempo; seq.setTempoInBPM(m_tempo); notifyForTempoChange(tempo); }
/** Plays the given tune. * @param tune The tune to be played. * @exception IllegalStateException Thrown if the player hasn't been started * before. */ public void play(Tune tune) throws IllegalStateException { if (m_isStarted) { try { m_tune = tune; Sequence sequence = m_converter.toMidiSequence(m_tune); seq.setSequence(sequence); seq.setTempoInBPM(m_tempo); seq.start(); } catch (Exception e) { e.printStackTrace(); } } else throw new IllegalStateException("The player hasn't been started yet !"); }
/** * @param key is the note that this starts with. 60 is middle C. * @param tempo is measured in beats per second */ public OldSong(int key, int tempo, int resolution) throws MidiUnavailableException, InvalidMidiDataException { this.resolution = resolution; Sequence sequence = new Sequence(Sequence.PPQ, resolution); track = sequence.createTrack(); makeSong(key); sequencer = MidiSystem.getSequencer(); sequencer.open(); sequencer.setSequence(sequence); sequencer.setTempoInBPM(tempo); }
sequencer.setTempoInBPM(120); } catch (Exception ex) { ex.printStackTrace();
sequencer.open(); sequence=new Sequence(Sequence.PPQ,4); track=sequence.createTrack();sequencer.setTempoInBPM(120); sequencer.setLoopCount(sequencer.LOOP_CONTINUOUSLY); sequencer.start(); sequencer.setTempoInBPM(120); }catch(Exception e){e.printStackTrace();}
seqr.setLoopEndPoint((long) (seqr.getLoopEndPoint()*lengthCoeff)); seqr.setTempoInBPM(bpm);
seq.setTempoInBPM(expectdNotesNbPerMn); notifyForTempoChange((int)seq.getTempoInBPM());