We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hey all,
I was trying to use minim in one of my other projects and was running into issues so I made this very simple program to test things out... I get a "cannot convert from AudioSample to AudioSample" error..? This seems to be the exact implementation from the examples at: http://code.compartmental.net/minim/audiosample_class_audiosample.html.
import ddf.minim.*;
Minim minim;
AudioSample sample;
AudioPlayer player;
void setup(){
minim = new Minim(this);
minim.debugOn();
sample = minim.loadSample("tamb.wav");
//player = minim.loadFile("tamb.wav");
}
void draw(){
}
void mouseClicked(){
sample.trigger();
//player.play();
//player.rewind();
}
When that didn't work I tried loading the same wav file, a <1 second tamborine sample if that matters, into AudioPlayer (commented sections of code above). It seemed to load in ok but when I tried to play it I got a Java.lang.ArrayIndexOutOfBoundsException: 15
minim debug (before playing):
==== JavaSound Minim Debug ====
==== Base input stream is: java.io.FileInputStream@257b746
==== JavaSound Minim Debug ====
==== Acquired AudioInputStream.
==== It is -1 frames long.
==== Marking support: true
==== JavaSound Minim Debug ====
==== Reading from class javax.sound.sampled.AudioInputStream
==== JavaSound Minim Debug ====
==== File format is: MPEG1L1 48000.0 Hz, unknown bits per sample, mono, unknown frame size, 125.0 frames/second,
==== JavaSound Minim Debug ====
==== SourceDataLine is class com.sun.media.sound.DirectAudioDevice$DirectSDL
==== Buffer size is 8192 bytes.
==== Format is PCM_SIGNED 48000.0 Hz, 16 bit, mono, 2 bytes/frame, little-endian.
==== JavaSound Minim Debug ====
==== Getting the properties.
==== JavaSound Minim Debug ====
==== MpegAudioFileReader.getAudioFileFormat(InputStream inputStream, long mediaLength): begin
==== JavaSound Minim Debug ====
==== InputStream : java.io.FileInputStream@fca1255 =>RIFF@&WAVEJUNK\
==== JavaSound Minim Debug ====
==== RIFF/WAV stream found
==== JavaSound Minim Debug ====
==== File properties: {mp3.crc=false, mp3.copyright=true, mp3.padding=true, mp3.channels=1, mp3.version.mpeg=1, mp3.length.bytes=403016, mp3.framerate.fps=125.0, mp3.framesize.bytes=320, duration=9976000, mp3.version.layer=1, mp3.length.frames=1247, mp3.frequency.hz=48000, mp3.header.pos=0, mp3.vbr.scale=0, mp3.bitrate.nominal.bps=320000, mp3.version.encoding=MPEG1L1, mp3.mode=3, mp3.vbr=false, mp3.original=true}
==== JavaSound Minim Debug ====
==== JSBaseAudioRecordingStream :: FloatSampleBuffer has 1024 samples.
==== JavaSound Minim Debug ====
==== JSBaseAudioRecordingStream :: rawBytes has length 2048
==== JavaSound Minim Debug ====
==== JSBaseAudioRecordingStream :: skipBytes has length 960000
==== JavaSound Minim Debug ====
==== SourceDataLine is class com.sun.media.sound.DirectAudioDevice$DirectSDL
==== Buffer size is 8192 bytes.
==== Format is PCM_SIGNED 48000.0 Hz, 16 bit, mono, 2 bytes/frame, little-endian.
=== Minim Debug ===
=== Likely buffer underrun in AudioOutput.
After trying to play:
java.lang.ArrayIndexOutOfBoundsException: 15
at javazoom.jl.decoder.LayerIDecoder$SubbandLayer1.read_allocation(Unknown Source)
at javazoom.jl.decoder.LayerIDecoder.readAllocation(Unknown Source)
at javazoom.jl.decoder.LayerIDecoder.decodeFrame(Unknown Source)
at javazoom.jl.decoder.Decoder.decodeFrame(Unknown Source)
at javazoom.spi.mpeg.sampled.convert.DecodedMpegAudioInputStream.execute(Unknown Source)
at org.tritonus.share.TCircularBuffer.read(TCircularBuffer.java:134)
at org.tritonus.share.sampled.convert.TAsynchronousFilteredAudioInputStream.read(TAsynchronousFilteredAudioInputStream.java:189)
at ddf.minim.javasound.JSBaseAudioRecordingStream.readBytes(Unknown Source)
at ddf.minim.javasound.JSBaseAudioRecordingStream.mRead(Unknown Source)
at ddf.minim.javasound.JSBaseAudioRecordingStream.read(Unknown Source)
at ddf.minim.javasound.JSAudioOutput.readStream(Unknown Source)
at ddf.minim.javasound.JSAudioOutput.run(Unknown Source)
The file in question: https://www.dropbox.com/s/a37o9qzvgqhzh5v/tamb.wav?dl=0
Does anyone see anything wrong?