Java Code Examples for javax.sound.midi.Sequence#getMicrosecondLength()

The following examples show how to use javax.sound.midi.Sequence#getMicrosecondLength() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SoftMidiAudioFileReader.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public AudioFileFormat getAudioFileFormat(Sequence seq)
        throws UnsupportedAudioFileException, IOException {

    long totallen = seq.getMicrosecondLength() / 1000000;
    long len = (long) (format.getFrameRate() * (totallen + 4));
    return new AudioFileFormat(MIDI, format, (int) len);
}
 
Example 2
Source File: SoftMidiAudioFileReader.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public AudioFileFormat getAudioFileFormat(Sequence seq)
        throws UnsupportedAudioFileException, IOException {

    long totallen = seq.getMicrosecondLength() / 1000000;
    long len = (long) (format.getFrameRate() * (totallen + 4));
    return new AudioFileFormat(MIDI, format, (int) len);
}
 
Example 3
Source File: SoftMidiAudioFileReader.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public AudioFileFormat getAudioFileFormat(Sequence seq)
        throws UnsupportedAudioFileException, IOException {

    long totallen = seq.getMicrosecondLength() / 1000000;
    long len = (long) (format.getFrameRate() * (totallen + 4));
    return new AudioFileFormat(MIDI, format, (int) len);
}
 
Example 4
Source File: SoftMidiAudioFileReader.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public AudioFileFormat getAudioFileFormat(Sequence seq)
        throws UnsupportedAudioFileException, IOException {

    long totallen = seq.getMicrosecondLength() / 1000000;
    long len = (long) (format.getFrameRate() * (totallen + 4));
    return new AudioFileFormat(MIDI, format, (int) len);
}
 
Example 5
Source File: SoftMidiAudioFileReader.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public AudioFileFormat getAudioFileFormat(Sequence seq)
        throws UnsupportedAudioFileException, IOException {

    long totallen = seq.getMicrosecondLength() / 1000000;
    long len = (long) (format.getFrameRate() * (totallen + 4));
    return new AudioFileFormat(MIDI, format, (int) len);
}
 
Example 6
Source File: MidiSMPTE.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    Sequence s = null;
    //File midiFile = new File("outsmpte.mid");
    //InputStream is = new FileInputStream(midiFile);
    //is = new BufferedInputStream(is);
    InputStream is = new ByteArrayInputStream(smptemidifile);
    s = MidiSystem.getSequence(is);
    long duration = s.getMicrosecondLength() / 1000000;
    System.out.println("Duration: "+duration+" seconds ");
    if (duration > 14) {
        throw new Exception("SMPTE time reader is broken! Test FAILED");
    }
    System.out.println("Test passed");
}
 
Example 7
Source File: SMFParserBreak.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {

        InputStream is = new ByteArrayInputStream(midifile);
        // create a buffered input stream that seems
        // to be on an unfortunate boundary for the
        // 1.4.2 SMF parser implementation
        is = new ChunkInputStream(is, 32);
        Sequence sequence = MidiSystem.getSequence(is);

        long duration = sequence.getMicrosecondLength() / 10000;
        System.out.println("Duration: "+duration+" deciseconds ");

        // the test is passed if no exception thrown
        System.out.println("Test passed");
    }
 
Example 8
Source File: SoftMidiAudioFileReader.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public AudioFileFormat getAudioFileFormat(Sequence seq)
        throws UnsupportedAudioFileException, IOException {

    long totallen = seq.getMicrosecondLength() / 1000000;
    long len = (long) (format.getFrameRate() * (totallen + 4));
    return new AudioFileFormat(MIDI, format, (int) len);
}
 
Example 9
Source File: SoftMidiAudioFileReader.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public AudioFileFormat getAudioFileFormat(Sequence seq)
        throws UnsupportedAudioFileException, IOException {

    long totallen = seq.getMicrosecondLength() / 1000000;
    long len = (long) (format.getFrameRate() * (totallen + 4));
    return new AudioFileFormat(MIDI, format, (int) len);
}
 
Example 10
Source File: SoftMidiAudioFileReader.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public AudioFileFormat getAudioFileFormat(Sequence seq)
        throws UnsupportedAudioFileException, IOException {

    long totallen = seq.getMicrosecondLength() / 1000000;
    long len = (long) (format.getFrameRate() * (totallen + 4));
    return new AudioFileFormat(MIDI, format, (int) len);
}
 
Example 11
Source File: SoftMidiAudioFileReader.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public AudioFileFormat getAudioFileFormat(Sequence seq)
        throws UnsupportedAudioFileException, IOException {

    long totallen = seq.getMicrosecondLength() / 1000000;
    long len = (long) (format.getFrameRate() * (totallen + 4));
    return new AudioFileFormat(MIDI, format, (int) len);
}
 
Example 12
Source File: SoftMidiAudioFileReader.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public AudioFileFormat getAudioFileFormat(Sequence seq)
        throws UnsupportedAudioFileException, IOException {

    long totallen = seq.getMicrosecondLength() / 1000000;
    long len = (long) (format.getFrameRate() * (totallen + 4));
    return new AudioFileFormat(MIDI, format, (int) len);
}
 
Example 13
Source File: SoftMidiAudioFileReader.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public AudioFileFormat getAudioFileFormat(Sequence seq)
        throws UnsupportedAudioFileException, IOException {

    long totallen = seq.getMicrosecondLength() / 1000000;
    long len = (long) (format.getFrameRate() * (totallen + 4));
    return new AudioFileFormat(MIDI, format, (int) len);
}
 
Example 14
Source File: SoftMidiAudioFileReader.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public AudioFileFormat getAudioFileFormat(Sequence seq)
        throws UnsupportedAudioFileException, IOException {

    long totallen = seq.getMicrosecondLength() / 1000000;
    long len = (long) (format.getFrameRate() * (totallen + 4));
    return new AudioFileFormat(MIDI, format, (int) len);
}
 
Example 15
Source File: SoftMidiAudioFileReader.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
private static StandardFileFormat getAudioFileFormat(final Sequence seq) {
    long totallen = seq.getMicrosecondLength() / 1000000;
    long len = (long) (format.getFrameRate() * (totallen + 4));
    return new StandardFileFormat(MIDI, format, len);
}
 
Example 16
Source File: SoftMidiAudioFileReader.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private static StandardFileFormat getAudioFileFormat(final Sequence seq) {
    long totallen = seq.getMicrosecondLength() / 1000000;
    long len = (long) (format.getFrameRate() * (totallen + 4));
    return new StandardFileFormat(MIDI, format, len);
}