PGraphics limitation in array size help?
in
Programming Questions
•
1 month ago
I want to convert audio samples to something like a barcode.
So I need a very wide image array, like 64000 pixels wide would be a good.
Instead I get the Exeption: Image width and height cannot be larger than 8192 with this graphics card.
I don't want to show the pixels array onscreen. I just want to create it and save it to a png or jpg. Later edit in Photoshop or something. So the graphics card i'm using is irrelevant and so is this 8192 limit.
Anyone knows how to create a PGraphics array of ANY size without limitations and draw in it?
Then save it to a file without even showing it on screen.
This is the sketch i try to run:
So I need a very wide image array, like 64000 pixels wide would be a good.
Instead I get the Exeption: Image width and height cannot be larger than 8192 with this graphics card.
I don't want to show the pixels array onscreen. I just want to create it and save it to a png or jpg. Later edit in Photoshop or something. So the graphics card i'm using is irrelevant and so is this 8192 limit.
Anyone knows how to create a PGraphics array of ANY size without limitations and draw in it?
Then save it to a file without even showing it on screen.
This is the sketch i try to run:
* Press 'k' to trigger the sample.
*/
import ddf.minim.*;
Minim minim;
AudioSample hola;
PGraphics ihola;
void setup()
{
size(100, 100, P2D);
// always start Minim before you do anything with it
minim = new Minim(this);
// load Lepuse.wav from the data folder with a 1024 sample buffer
// hola = Minim.loadSample("Lepuse.wav");
// load Lepuse.wav from the data folder, with a 512 sample buffer
hola = minim.loadSample("Lepuse.wav", 35096);
ihola = createGraphics(8193, 80, P2D);
}
void draw()
{
// use the mix buffer to draw the waveforms.
// because these are MONO files, we could have used the left or right buffers and got the same data
}
void keyPressed()
{
if ( key == 'k' ) {
hola.trigger();
ihola.beginDraw();
int p = 0;
for (int i = 0;i < width; i++){
if(p < hola.bufferSize()-1){
int strokeSint = int (hola.left.get(p)*1000+1000);
float strokeS = map (strokeSint,0,2000,0,255);
stroke(strokeS);
p++;
ihola.line(i, 0 , i, height);
// println(strokeS);
}
}
ihola.endDraw();
ihola.save("newImg.png");
println(hola.bufferSize());
}
}
void stop()
{
// always close Minim audio classes when you are done with them
hola.close();
minim.stop();
super.stop();
}
This is what i've been forced to do: a "page" of little strips that later I have to align in one row using Photoshop, tedious work.
The sound "page" code:
So the question is:
Anyone knows how to create a PGraphics array of ANY size without limitations and draw in it?
Then save it to a file without even showing it on screen.
Thanks for any help in advance :)
This is what i've been forced to do: a "page" of little strips that later I have to align in one row using Photoshop, tedious work.
The sound "page" code:
* Press 'k' to trigger the sample.
*/
import ddf.minim.*;
Minim minim;
AudioSample hola;
void setup()
{
size(1600, 400, P2D);
// always start Minim before you do anything with it
minim = new Minim(this);
// load hola.mp3 from the data folder with a 1024 sample buffer
// hola = Minim.loadSample("hola.mp3");
// load hola.mp3 from the data folder, with a 512 sample buffer
hola = minim.loadSample("hola.mp3", 15096);
}
void draw()
{
// use the mix buffer to draw the waveforms.
// because these are MONO files, we could have used the left or right buffers and got the same data
}
void keyPressed()
{
if ( key == 'k' ) {
hola.trigger();
int p = 0;
for (int j = 1; j<11; j++){
for (int i = 0;i < width; i++){
if(p < hola.bufferSize()-1){
int strokeSint = int (hola.left.get(p)*1000+1000);
float strokeS = map (strokeSint,0,2000,0,255);
stroke(strokeS);
p++;
line(i, height/10*(j-1) , i, height/10*j);
println(strokeS);
}
}
}
println(hola.bufferSize());
}
}
void stop()
{
// always close Minim audio classes when you are done with them
hola.close();
minim.stop();
super.stop();
}
So the question is:
Anyone knows how to create a PGraphics array of ANY size without limitations and draw in it?
Then save it to a file without even showing it on screen.
Thanks for any help in advance :)
1