FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Topics & Contributions
   Sound
(Moderators: pitaru, REAS)
   sound analysis newbie Qs...
« Previous topic | Next topic »

Pages: 1 2 
   Author  Topic: sound analysis newbie Qs...  (Read 2800 times)
arielm

WWW
sound analysis newbie Qs...
« on: Nov 7th, 2003, 12:26am »

on Oct 18th, 2003, 3:41am, mKoser wrote:
I am about to start doing a series of objects-and-their-coexisting-graphics where I will use a microphone as sensory input (mind you, I am not interested in music, speech and the likes) i believe a mic can be used to alot more - in terms of input at least!

i'm also interested to play with that direction of controlling things with sound (in the context of providing additional input sources for a forthcoming workshop)...
 
anyway, my knowledge in sound engineering is quite weak, and i wonder if someone can help me with the following basics of sound-analysis:
 
- what are the common properties of a sound that can be analyzed and transformed into a scale (0.0 - 1.0)(i guess the simplest example is the volume of a sound)
 
- if i want to get a scale based on the tone of a sound (from acute to grave), is it "simply" a matter of analysing frequencies if so, is it like processing a lot of data by somehow averaging it..
 
- when processing sound in real-time and it requires heavy calculations: isn't it problematic to have delays between the input & output
 

Ariel Malka | www.chronotext.org
christian


Re: sound analysis newbie Qs...
« Reply #1 on: Nov 7th, 2003, 12:56am »

dear bagel papa poule,
men is able to hear sounds between 20 Hz and 20MHz.
that is the ideal range a mic can usually get.  
the fast fourier algorithm gets the soundshape into
a frequency-shape, that means, imagine a diagram,
the x is in the first case the time, in the second
case its the frequencies. y is the loudness. every
time analogue sound is transformed into digital signals, this procedure happens. the volumes property
is the loudness, if you need seperately for the left and the right channel. the tone (if i understood you
right)is not really a matter of frequencies, even if  
certain acoustic happenings have significant properties: female voices´ basic frequency is about
200-300Hz, the male about one octave below which is always the half of it. thing called "presence" of  
a sound results from frequencies about 3000 Hz.
after all, sound has alway a basic frequency and  
then so called uppertunes (dont know how it is called
in english, but i think you know what i mean). if these uppertunes are an integer multiple of the basic
frequency, then it is a tune, every other acoustic
event is not.certainly theres a lot more to know about that stuff,thats all i know for that moment.
(sorry for bad english)
 
+ christian
« Last Edit: Nov 7th, 2003, 12:57am by christian »  
arielm

WWW
Re: sound analysis newbie Qs...
« Reply #2 on: Nov 7th, 2003, 2:09am »

thanks christian for trying to put me on tracks,
 
i'm loosing you at the beginning of your explaination, when you say: Quote:
imagine a diagram, the x is in the first case the time, in the second case its the frequencies. y is the loudness

(from one of amit's SONIA examples: http://pitaru.com/sonia/fft, i did saw the display of a frequency-spectrum-analizer but i can't understand what i see for now...)
 
what do you mean by "x in the first case the time, in the second case its the frequencies"?
 
is this a two-pass analyis? or is there two different graphs?
 
okay, let's stick to SONIA fft example source-code:
Code:

spectrum = new float[1024];
liveInput.start(1024);
...
void getSpectrum()
{
  spectrum = liveInput.getSpectrum();
  for ( int i = 0; i < spectrum.length/4; i++){
    line(i*2, height, i*2, height - spectrum[i]/10);
  }
}

 
i understand that 1024 "samples" are fed in real time into an array and used to produce a graph on the x-axis...
 
Q1- what is the relation between time and 1024? say, if the sampled audio is at 44khz, 1024 should be a very short time value, yes?
 
Q2- what each of these float numbers represent? (loudness?) and between which boundaries each float can vary?
 
Q3- still confused about frequencies... is "frequency" related to loudness-over-time?
 
and finally:
 
can a frequency-spectrum-analizer be used to produce a value between 0.0 and 1.0, where, say, 0 is a very acute sound and 1 is a very grave sound?
 
danke!
 

Ariel Malka | www.chronotext.org
benelek

35160983516098 WWW Email
Re: sound analysis newbie Qs...
« Reply #3 on: Nov 7th, 2003, 7:11am »

re: frequencies, this is the same as "pitch". if you imagine a waveform, a higher frequency wave would sound as a higher pitch. the amplitude of the wave has to do with the volume of the sound.
 
if you're interested, I just finished a general education course entitled The Science of Music. The course has excelent documentation of speech accoustics over at http://www.phys.unsw.edu.au/speech/
 
one interesting aspect of speech, is that our voices contain a whole range of frequencies, but that within each of our voices there are two frequency areas which exist in harmony with each other, and which are therefore amplified.
 
arielm

WWW
Re: sound analysis newbie Qs...
« Reply #4 on: Nov 7th, 2003, 9:31am »

thanks benelek for the clue about pitch, and the link,
 
i guess i still have a bit of road to go from where i'm standing now, before getting into voice analysis...
 
meanwhile, a good pillow-inspiration-session helping, i remembered things i used to know about sound:
 
a raw piece of digital sound is made of a huge number of bit-sized samples (volume on/volume off) per second, that can be transformed into an analogic form that produce vibrations i.e. sound waves, when redirected to speakers...
 
now, "frequency" is somehow related to the number of vibrations over time: a few number of "volume on" bits per second is a low frequency (grave?) and a high number of "volume on" bits per second is an high frequency (acute?)
 
so back to SONIA: liveInput.getSpectrum() is taking a sound sample (made of volume on/volume off bits) as input, and produces float values out of it,
 
still have to workout about the nature of these floats...
 

Ariel Malka | www.chronotext.org
benelek

35160983516098 WWW Email
Re: sound analysis newbie Qs...
« Reply #5 on: Nov 7th, 2003, 11:33am »

yep, uncompressed CD audio is usually made of around 44000 samples per second per track, each sample consisting of a two byte number (between -32768 and 32768 ). that number indicates to the speaker how much it should move from its starting position.
 
here's an image i found a short while ago for an assignment, which has been sitting about on my hard drive:
http://users.bigpond.net.au/schwartz/digital_wave.png
« Last Edit: Nov 7th, 2003, 11:34am by benelek »  
Ale_k

WWW
Re: sound analysis newbie Qs...
« Reply #6 on: Nov 7th, 2003, 1:13pm »

Hi,
Take a look at this
http://eamusic.dartmouth.edu/~book/MATCpages/chap.3/3.4.DFT_FFT_IFFT.htm l  
it explain in a quite simple way FFT (Q1).
Anyway the problem with FFT is that it returns "row data", I mean it gives us the formants (sine waves) of a (pseudo) periodical sound not which is the "function" , fundamental and overtones for harmonic sound, more complex for periodic but not harmonic sound (bells for example). In short, the real analisys should follow.
I'm sorry for my english.
Bye  
Alessandro
 
 
arielm

WWW
Re: sound analysis newbie Qs...
« Reply #7 on: Nov 7th, 2003, 10:44pm »

thanks guys!
 
entered the link provided by Alessandro, and started with chapter 1 ("What is Sound") first: it's really a great ressource for understanding!!!
 
p.s. since i'm already pretty acquainted with sinusoidal functions, i was delighted to discover that it's the basis for everything in sound analysis ("the atoms of sounds" as they say...)
 

Ariel Malka | www.chronotext.org
toxi

WWW
Re: sound analysis newbie Qs...
« Reply #8 on: Nov 10th, 2003, 11:45am »

maybe you don't need it anymore by now, but you might also check out this very detailed DSP course site: http://www.bores.com/courses/intro/index.htm
 

http://toxi.co.uk/
arielm

WWW
Re: sound analysis newbie Qs...
« Reply #9 on: Nov 10th, 2003, 2:10pm »

thanks toxi, it's very a useful and didactic site indeed!
 
it helped me to finally understand why "windowing" is required when doing FFT, and also what a "fundamental" and it's "harmonics" fellows really are!
 

Ariel Malka | www.chronotext.org
pitaru


WWW Email
Re: sound analysis newbie Qs...
« Reply #10 on: Nov 10th, 2003, 2:43pm »

hey ariel,
 
i've already integrated windowing and eq in the upcomming version of sonia,ported from this link: http://www.nullsoft.com/free/vms/
 
also - Toxi contributed wonderful optimized code for the fft - which i'll merged into the existing library. thanks toxi! Rock on.
 
if anyone has a free sec -  please go over sonia and let me know of any bugs or wish lists concerning the playback of samples. i'm trying to tighten that up as well. when that's done, i'll start working on synthesis.
 
cheers,
-amit
 
arielm

WWW
Re: sound analysis newbie Qs...
« Reply #11 on: Nov 10th, 2003, 3:56pm »

hi amit,
 
well, if toxi is involved in the coding, we can be sure that no processor cycle will be wasted without a valuable reason
 
regarding the playback of samples: in the current 8bit SONIC engine, there is this soundEvent() callback mechanism that looks interesting to my newbie-eyes. is there a way to do similar things with JSyn/SONIA?
 
if i understand well, you can get an event that gives you access to a sound-frame's data, so that you can either analyse it, or modify it before it's sent for output.
 
my questions are:
- when processing a single frame, 8bit/11khz is much less data than 16bit/44khz: it it reallistic to build on java to handle this in real-time?
- is this way of producing sound (by only playing with samples) not really suited anyway? (from what i'm starting to understand, the real game is in the frequencies playground...)
 

Ariel Malka | www.chronotext.org
pitaru


WWW Email
Re: sound analysis newbie Qs...
« Reply #12 on: Nov 10th, 2003, 4:24pm »

Regarding the soundEvent() callback :
I've decided not to do this because it involves either modifying BApplet, or using a separate thread. Instead, you have boolean isPlaying() which returns TRUE if the sample is still playing.
 
Regarding access to a sound-frame's data:
very important - the next version will have get/setSampleData()
 
Regarding Processing 16bit/44khz in java:
depends on what you're up to. for example - our fft is looking at up to 1024 frames at a time, so you have some cpu to work with. with that said, you just got me thinking about introducing 'lo-res' 8bit mode.
 
Regarding synthesis vs. sample:
there's definitely a trend to put down sampling in favor of synthesis, but i think it will settle down with time. they are both equally important to the professional musician/sound-artist. synthesis is similar to generating pixels from scratch. sampling can be compared to collage, or image processing.
my personal take: the most interesting area is how to combine the two in meaningful ways.
sonia will soon have synthesis and companion functions that integrate the two intuitively.
 
mrb

WWW
Re: sound analysis newbie Qs...
« Reply #13 on: Nov 10th, 2003, 6:11pm »

im working on some granular synthesis code in c++/portaudio -- granular synthesis is a very compelling combination of synthesis and sampling, both when wavetables like sine waves are used and when sampled sound is granulated ... there is granular synthesis in jsyn, no?
 
mrb
 
pitaru


WWW Email
Re: sound analysis newbie Qs...
« Reply #14 on: Nov 10th, 2003, 6:24pm »

yep, 'cause jsyn is using portaudio
 
Pages: 1 2 

« Previous topic | Next topic »