POV-Ray : Newsgroups : povray.animations : re: Synchronizing Sound Server Time
28 Jul 2024 16:31:30 EDT (-0400)
  re: Synchronizing Sound (Message 1 to 1 of 1)  
From: Eric Andersen
Subject: re: Synchronizing Sound
Date: 8 Feb 1999 02:09:45
Message: <36BE8EC0.C093C9EC@frontiernet.net>
Dennis Miller wrote:
> 
> Eric, I am very interested in this. May I see what you have as samples? I
> don't know of an app that can generate the spectral data; what exactly are
> you getting there, just raw sample amplitude values? Is there a separate
> frequency parameter, or just the 16-bit linear data? What program did you
> use?
> Thanks much,.
> D>

Dennis:

Well, I just finished moving from one apt. to another.
...computer turned on and plugged in but life still upside-down.
(that's why i reply so late.)

I will post a sample tomorrow or the next day or the next day--i'll let
you know when it's up
so you can see some results.

I have tried several apps for this, but the one I ended up using was,

>>Digital Oscilloscope 2.1
"Digital Oscilloscope enables you to use your Macintosh as an
oscilloscope and a frequency meter. All you need for this application to
work is a sound input device, and a sound source connected to your Mac.
System 7.0 or later is required."
Freeware.
Available on the web:

ftp://ftp.the.net/mirrors/ftp.utexas.edu/sound/digital-oscilloscope-21.hqx

I used the frequency meter to output peak frequency data to a text file.
 Then I did a find-replace-all in tex-edit to reformat the data into
digits separated by commas.  In POV, I #fopen'ed the file and #fread in
the data.  the file is a list of time, frequency, intensity values so it
was pretty easy to use a few #if's to read in the frequency and
intensity values as they come in and compare them to the currently
#declared time index.  D.O. produces the frequency data at a variable
rate, but I got an average frequency data rate of about 60 fps, which is
good enough for the 30fps i was using in the animation.

Originally, I tried using Macromedia's SoundEdit 16 to output spectral
data, but the sheer volume of data proved too slow since there's no such
thing as a random access file function in POV (or is there??? if so let
me know).  ie the whole file has to be read in up to the current time
index to get the proper value, which for later frames takes a long time.

I've got a side-project going in Mathematica to generate POV-scenes with
a sound file as the source, but Mathematica is a memory hog-- The whole
sound file must fit into RAM beyond my machine's current limits.

So the FREEWARE	Digital Oscilloscope did the trick neatly and compactly.
 Joy.

For animation work, lower res sounds should work ok by the mathematica
or se16 approach (although one sacrifices the high-frequency sounds with
lower sample rates, and hence the corresponding Nyquist frequencies).  I
haven't tried this yet.

My results were a little jerky.  maybe by building in a slow decay--like
how the lights on a tape record meter get punched up by the sound, and
then ease back to zero slowly...this could be done by setting up a
communication between frames within pov by writing to a file in order to
hand off data from one frame to the next.
This would be perhaps pleasanter, but less accurate.  

another approach to smoothing the animation would be to use a sound
editor like SoundEffects! (shareware) to smooth out the sound, bandpass
filter, etc.
*before* creating the text file. 

-Eric

P.S. I am posting this to povray animations.


> 
> Eric Andersen wrote:
> 
> > GrimDude wrote:
> > >
> > > Sounds to me like you have a professional package for this?
> >
> > Nope.  Here are the rough details:
> >
> > I used a shareware oscilliscope program to output frequency data to a
> > text file.  Then, using a text editor I formatted the data into the form
> > required by POV.  Within the scene file, the frequency data is read in
> > and used to scale and texture objects, carefully coding so that the time
> > index of the current frame is synchronized with the music (!).  One
> > could create, (like i have), a sphere that pulsates with each bass note.
> >  Since each "frame" of sound data is much shorter than 1/30 second, a
> > "snapshot" approach can generate a very accurate but somewhat jerky
> > animation.  I'm working on ways of smoothing out the animations without
> > bogging down too much under all the extra MB's of sound data.
> > I also plan to modify this code for lip-sync.
> > If you're really interested in the nitty-gritty, let me know and I'll
> > share some old code--but be warned it's all specialized and full of
> > goofy junk.  Also, I work on a mac, which shouldn't make much of a
> > difference, but sometimes there are compatability issues.
> >
> > Ya know, tho_... some of my best results in sync-ing audio and video
> > have come from purely random collage.  It's amazing how things just seem
> > to line up on their own.
> >
> > -E


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.