We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
complete wavetable (Read 637 times)
complete wavetable
Jan 2nd, 2008, 12:37pm
 
Hi all,

I want to draw the wavetable of a short soundfile
and the write a PDF from it.
My problem is that I can only animate the wavetable
and not make a static image of it.
I'm very basic with java so her's the code:

import ddf.minim.*;  
import processing.pdf.*;


AudioPlayer audioPlayer;  



void setup() {  
 size(1024, 200);  

 Minim.start(this);  
 audioPlayer = Minim.loadFile("sound.aif");  
audioPlayer.play();
 smooth();
beginRecord(PDF, "test");




}  
void draw()
{
  stroke(0);
 background(255);
 for(int i = 0; i < audioPlayer.bufferSize() - 1; i++)
 {
 
   line(i, 100 + audioPlayer.mix.get(i)*50, i+1, 100 + audioPlayer.mix.get(i+1)*50);

 }
 
 
}
 
void stop() {  
 audioPlayer.close();  
 endRecord();
 super.stop();  
}


I hope someone could help me
greetz
boehma
Re: complete wavetable
Reply #1 - Jan 5th, 2008, 7:12pm
 
In the next release you will be able to get the entire waveform from an AudioSample. So, provided the file is small enough to fit into memory, you would use loadSample and then just ask for the entire sample array at once.
Re: complete wavetable
Reply #2 - Jun 18th, 2008, 8:27pm
 
i'm also looking for the same functionality, though my audio file is probably a bit longer

i understand that loading an entire song file into an AudioSample and playing it would cause a major freeze up

however, i'd just like to grab the sample array, dump the AudioSample object, and use an AudioPlayer to play the file, buffered as usual

on a similar note! -

it seems as if the BeatDetect class is designed in a way so that one might only find the "onsets" in a given file after they've played it the whole way through

would it be possible, in a future release of minim, to simply grab an array of floats containing the position of each "onset" straight off the bat? ... without scrubbing through the entire audio file?
Page Index Toggle Pages: 1