Example usage for javax.sound.midi MidiSystem getSoundbank

List of usage examples for javax.sound.midi MidiSystem getSoundbank

Introduction

In this page you can find the example usage for javax.sound.midi MidiSystem getSoundbank.

Prototype

public static Soundbank getSoundbank(final File file) throws InvalidMidiDataException, IOException 

Source Link

Document

Constructs a Soundbank by reading it from the specified File .

Usage

From source file:com.music.Generator.java

@PostConstruct
public void init() throws MidiUnavailableException, IOException, InvalidMidiDataException {
    //TODO http://marsyas.info/ when input signal processing is needed

    semaphore = new Semaphore(maxConcurrentGenerations);

    manipulators.add(new MetreConfigurer());
    manipulators.add(new PartConfigurer());
    manipulators.add(new ScaleConfigurer());
    manipulators.add(new MainPartGenerator());
    manipulators.add(new AccompanimentPartGenerator());
    manipulators.add(new Arpeggiator());
    manipulators.add(new PercussionGenerator());
    manipulators.add(new SimpleBeatGenerator());
    manipulators.add(new BassPartGenerator());
    manipulators.add(new DroneGenerator());
    manipulators.add(new EffectsGenerator());
    manipulators.add(new PadsGenerator());
    manipulators.add(new TimpaniPartGenerator());
    manipulators.add(new TitleGenerator());

    try {//from  www  . j a v  a2  s.c  o m
        Collection<File> files = FileUtils.listFiles(new File(configLocation + "/soundbanks/"),
                new String[] { "sf2" }, false);
        for (File file : files) {
            InputStream is = new BufferedInputStream(new FileInputStream(file));
            soundbanks.add(MidiSystem.getSoundbank(is));
        }
    } catch (IOException ex) {
        logger.warn("Problem loading soundbank: " + ex.getMessage());
        // ignore
    }

    //initJMusicSynthesizer();
}