List of usage examples for javax.sound.midi MidiSystem getSoundbank
public static Soundbank getSoundbank(final File file) throws InvalidMidiDataException, IOException
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(); }