We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Im trying to make .mp3 audio play from 3 separate arrays randomly. Each Array has 3 or 4 tracks. On a key or mouse press i want each array to play one track at the same time. Then on mouse press repeat and play a different 3 tracks.
My code is incomplete but I have
import ddf.minim.*;
import ddf.minim.analysis.*;
import ddf.minim.effects.*;
import ddf.minim.signals.*;
import ddf.minim.spi.*;
import ddf.minim.ugens.*;
import ddf.minim.*;
Minim minim;
AudioSample[] songArray = new AudioSample [10];
void setup()
{
size(100, 100);
minim = new Minim(this);
for (int i = 0 ; i < 3 ; i++) {
songArray[i] = minim.loadSample("sound" + i +".mp3");
}
for (int p = 0 ; p < 3 ; p++) {
songArray[p] = minim.loadSample("sounds" + p +".mp3");
}
for (int s = 0 ; s < 4 ; s++) {
songArray[s] = minim.loadSample("soundss" + s +".mp3");
}
}
void draw()
{
}
void mousePressed(){
.play();
}
If anyone can add useful pointers I'd be grateful
thanks
Answers
I only see 1 array there:
AudioSample[] songArray = new AudioSample[10];
~:>I've just made instead an example using a 2D array of AudioSample.
Since I don't have any of those files, I haven't tested it. No idea whether it even works! 3:-O
It works - you are clearly very knowledgeable with this (Im quite envious)
However just as an extra add on when I combine the audio code you have made with the image code I had already it flips out and gives the following message
==== JavaSound Minim Error ==== ==== Error parsing ID3v2: String index out of range: -131
Its so close to working its killing me.
The combination of image and audio code Ive got now looks like
Is it a memory issue ? I understand you dont have access to the .png or .mp3 files. The .png = about 50mb for 180 files and the .mp3 are 2mb for 10 files.
Thanks again for the help.
Well, there's no chance I can run that! Nonetheless some tips;
I know, it's grown a bit out of control.!
I've increased the ram to 2000. How do you swap OpenGL ? The only draw functions I could use would only occur on a mouse or key press so guess that rules that option out .
It did flinch slowly in to life before freaking out, freezing and dying. I'm gonna try it with fewer images.
Thanks again for all the support.
GoToLoop - Its working! kind of
I reduced the image array and used the JAVA2D renderer. It functions. However it only gives one iteration of the image on key or mouse press. The sound changes on each click but the image remains the same. I need to get a new image and new sound with every click.
Is it likely to be something to do with the frames running past one frame? Or would it be in the void draw?
so close to finishing , please help. . .
As I had advised before: place all drawing stuff in draw(). :-@
I don't understand why would you need a loop in order to pick 1 PImage to image() either.
Ive stuck it all in draw and its working, thanks. I'm all new to this so apologies if not picking up the instructions straight away, I really do value your input and don't want to p1ss any one off.
Genuinely don't get the image thing , I followed another tutorial to display random images and that is what it suggested to do. Is there a more efficient way?
An excerpt of what I'm trying to say: ~O)