Package com.sun.media.sound

Examples of com.sun.media.sound.AudioSynthesizer.openStream()


                logger.warn("No AudioSynhtesizer was found!");
                return;
            }

            // Open AudioStream from AudioSynthesizer.
            AudioInputStream stream = synth.openStream(null, null);

            Generator.loadSoundbankInstruments(synth);
            // Play Sequence into AudioSynthesizer Receiver.
            double total = send(sequence, synth.getReceiver());


    public static void main(String[] args) throws Exception
    {       
        AudioSynthesizer synth = new SoftSynthesizer();
        AudioFormat format = new AudioFormat(44100, 16, 2, true, false);
        AudioInputStream stream = synth.openStream(format, null);
                       
        // Make all voices busy, e.g.
        // send midi on and midi off on all available voices       
        MidiChannel ch1 = synth.getChannels()[0];
        ch1.programChange(48); // Use contionus instrument like string ensemble

    public static void test(Soundbank soundbank) throws Exception {

        // Create instance of synthesizer using the testing soundbank above
        AudioSynthesizer synth = new SoftSynthesizer();
        AudioInputStream stream = synth.openStream(format, null);
        synth.unloadAllInstruments(synth.getDefaultSoundbank());
        synth.loadAllInstruments(soundbank);
        Receiver recv = synth.getReceiver();

        // Set volume to max and turn reverb off

public class GetMidiDevice {

    public static void main(String[] args) throws Exception {

        AudioSynthesizer synth = new SoftSynthesizer();
        synth.openStream(null, null);
        Receiver recv = synth.getReceiver();
        if (((SoftReceiver) recv).getMidiDevice() != synth) {
            throw new Exception("SoftReceiver.getMidiDevice() doesn't return "
                    + "instance of the synthesizer");
        }

        // Create instance of the synthesizer with very low polyphony
        AudioSynthesizer synth = new SoftSynthesizer();
        AudioFormat format = new AudioFormat(44100, 16, 2, true, false);
        Map<String, Object> p = new HashMap<String, Object>();
        p.put("max polyphony", new Integer(5));
        AudioInputStream stream = synth.openStream(format, p);
                       
        // Create instrument with too many regions (more than max polyphony)
        SF2Soundbank sf2 = new SF2Soundbank();
       
        SF2Sample sample = new SF2Sample(sf2);

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.