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
Creating Waveforms (Read 2360 times)
Creating Waveforms
Jan 21st, 2010, 4:18pm
 
Hey,

I'm wondering what the best way would be to create/render a waveform, i basically don't want the audio file to play but only the entire waveform to be rendered for me to export.

Is that possible? I've tried to use minim and ess, however the audio file keeps on playing - have i missed something in the reference?

Thanks!

Re: Creating Waveforms
Reply #1 - Jan 22nd, 2010, 12:09am
 
Hi DustOn,

if you don't have any luck with minim and ess (I'm pretty sure you should be able to), you could try the following example which uses Beads (http://www.beadsproject.net). Recording is not that well tested, but it can definitely be done. If you want direct access to the Sample data instead of writing it then that's possible too.

Code:

import beads.*;

void setup() {
 try {  
     final AudioContext ac = new AudioContext();
     float ms = 1000; // this is how long the sample will be
     //(note, there are options for recording into variable length samples)
     final Sample s = new Sample(ac.getAudioFormat(), ms); //this is the sample
     Recorder r = new Recorder(ac, s); //this records sound into the sample
     ac.out.addDependent(r); //must plug recorder into signal chain
     
     //now make the sound you want to make (e.g., this is a sine wave)
     WavePlayer wp = new WavePlayer(ac, 500f, Buffer.SINE);
     //make sure to send the sound to the recorder
     r.addInput(wp);
     
     //when the recorder gets to the end of the sample, it gets killed off, so
     //this code runs a callback for when this happens
     //(you could choose another way of ending the recording)
     r.setKillListener(new Bead() {
       public void messageReceived(Bead message) {
         //stop the audio system and write the file
          ac.stop();
          System.out.println("done");
          try {
            s.write("snd.aif");   //save the file somewhere useful
          } catch(Exception e) {
             e.printStackTrace();
          }
       }
     });
     
     //this runs the system in non-realtime
     ac.runNonRealTime();
 } catch(Exception e) {
      e.printStackTrace();
 }
 
}



Re: Creating Waveforms
Reply #2 - Jan 22nd, 2010, 6:38am
 
Hey orsjb,

Thanks for this, i've been reading the docs on the site and looking at the examples but i'm wondering what purpose the Recording mode would have when creating my waveforms from my sound file? Is it needed?

I'm trying to get it to work at the moment with not much luck, all i get is a grey box inside a white square.
Re: Creating Waveforms
Reply #3 - Jan 22nd, 2010, 7:48pm
 
Hi DustOn,

maybe I didn't understand what you want to do. In the example, an empty Sample is generated. The Record class is used to record generated sound into the Sample, which is then saved in a file called "snd.aif" (because it's a relative path it gets saved in the same directory as the Processing app). Perhaps this isn't what you want to do as you're talking about creating a waveform from a sound file. Not sure.

Ollie
Re: Creating Waveforms
Reply #4 - Jan 23rd, 2010, 7:16am
 
Sorry if i wasn't being clear, but yup i just want to create a wavefrom from a sound file but i just can't seem to figure out how to do it at the moment. Feel very lost at the moment as it should be something relatively simple.
Re: Creating Waveforms
Reply #5 - Jan 23rd, 2010, 8:40am
 
hi,

i'm also looking for a audio analysis of an audio file, befor playing it.
i will get the beat's in the track, on a timeline.
in realtime i can get the beat's 99%, but only when play the audio file or get an audio input. but i will get thew beat's befor i start the audio file.

is it possible to analyze an audio file?? without playing it??

regards maik
Re: Creating Waveforms
Reply #6 - Jan 23rd, 2010, 4:39pm
 
Hi DustOn, what do you want to do with the waveform? Your original post said "export". I assumed that meant save it as a file. But you want to get the original material from a file. Beads and Minim, and probably others, both allow you to load a file and grab the sample data (the waveform), and do stuff with it.
Re: Creating Waveforms
Reply #7 - Feb 16th, 2010, 10:08am
 
Enhansing Quality of Waveforms using Waveform Quick-load
If the Waveform drawings you are getting don't look very good, you can turn off Waveform Quick-load. This will cause Transana to rebuild the graphic portion of the Waveform each time a new waveform is called for rather than using a saved waveform diagram.


Page Index Toggle Pages: 1