Package vavi.sound.mobile

Examples of vavi.sound.mobile.AudioEngine.encode()


        // ainf
        events.add(new MfiEvent(new AinfMessage(false, 1), 0l));

        // audio data
        AudioEngine audioEngine = Factory.getAudioEngine(0x80); // TODO 0x80 is not defined in spec
        byte[] adpcm = audioEngine.encode(bits, channels, data);
        AdpmMessage adpmMessage = new AdpmMessage(sampleRate / 1000, bits, false, channels);
        AudioDataMessage audioData = new AudioDataMessage(0x80, 0x00, adpmMessage); // TODO 0x80 is not defined in spec
        audioData.setData(adpcm);
        events.add(new MfiEvent(audioData, 0l));
View Full Code Here


        // ainf
        events.add(new MfiEvent(new AinfMessage(false, 1, new AinfMessage.AudioInfo(0x81, new byte[] { 0x10, 0x08, 0x10, 0x10, 0x08, 0x10 })), 0l));

        // audio data
        AudioEngine audioEngine = Factory.getAudioEngine(0x81);
        byte[] adpcm = audioEngine.encode(bits, channels, data);
        AdpmMessage adpmMessage = new AdpmMessage(sampleRate / 1000, bits, false, channels);
        AudioDataMessage audioData = new AudioDataMessage(AudioDataMessage.FORMAT_ADPCM_TYPE2, 0x00, adpmMessage);
        audioData.setData(adpcm);
        events.add(new MfiEvent(audioData, 0l));
View Full Code Here

     */
    public static List<MfiEvent> getAdpcmEvents(byte[] pcm, float time, int sampleRate, int bits, int channels) throws InvalidMfiDataException {
        int delta = getDelta(time);
Debug.println("delta: " + delta);
        AudioEngine audioEngine = MitsubishiSequencer.getAudioEngine();
        byte[] adpcm = audioEngine.encode(bits, channels, pcm);
Debug.println("adpcm mono length: " + adpcm.length);
        List<MfiEvent> events = new ArrayList<MfiEvent>();
        if (channels == 1) {
Debug.println("adpcm length: " + adpcm.length);
            events.addAll(getAdpcmEventsSub(L, 0, sampleRate, bits, adpcm));
View Full Code Here

        // 1. data
        int streamNumber = 0;
        for (int i = 0; i < numberOfChunks; i++) {
            byte[] temp = new byte[PCM_MAX_BLOCK * channels];
            System.arraycopy(pcm, (PCM_MAX_BLOCK * channels) * i, temp, 0, PCM_MAX_BLOCK * channels);
            byte[] chunk = audioEngine.encode(4, channels, temp);
            if (channels == 1) {
Debug.println("wave chunk(" + i + "): " + chunk.length);
       
                // adpcm data
                events.add(getVoiceEvent(streamNumber++, channels, sampleRate, chunk));
View Full Code Here

            }
        }
        if (moduloOfChunks != 0) {
            byte[] temp = new byte[moduloOfChunks];
            System.arraycopy(pcm, (PCM_MAX_BLOCK * channels) * numberOfChunks, temp, 0, moduloOfChunks);
            byte[] chunk = audioEngine.encode(4, channels, temp);
            if (channels == 1) {
Debug.println("wave chunk(" + numberOfChunks + "): " + chunk.length);
           
                // adpcm data
                events.add(getVoiceEvent(streamNumber++, channels, sampleRate, chunk));
View Full Code Here

Debug.println("delta: " + delta + ", time: " + time);
        int velocity = (int) (adpcmVolume * maxVelocity / 100f);

        AudioEngine audioEngine = NecSequencer.getAudioEngine();

        byte[] adpcm = audioEngine.encode(4, channels, pcm);
Debug.println("adpcm length: " + adpcm.length);
//System.err.println("pcm:\n" + StringUtil.getDump(pcm, 64) + "adpcm L:\n" + StringUtil.getDump(adpcm, 64) +"adpcm R:\n" + StringUtil.getDump(adpcm, adpcm.length / 2, 64));

        int numberOfChunks = adpcm.length / MAX_BLOCK;
        int moduloOfChunks = adpcm.length % MAX_BLOCK;
View Full Code Here

    /** unused ??? */
    public byte[] getMessage() throws InvalidMfiDataException {

        AudioEngine audioEngine = NecSequencer.getAudioEngine();
        adpcm = audioEngine.encode(4, 1, pcm); // TODO bits, channel
Debug.println("adpcm length: " + adpcm.length);

        // [10~]
        byte[] tmp = new byte[adpcm.length + 5];

View Full Code Here

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.