POV-Ray : Newsgroups : povray.newusers : sound-/sine wave in povray : Re: sound-/sine wave in povray Server Time
4 Jul 2024 13:51:45 EDT (-0400)
  Re: sound-/sine wave in povray  
From: omniverse
Date: 17 Sep 2010 15:35:00
Message: <web.4c93c214613bfb9ed939a6800@news.povray.org>
"Marco" <rpo### [at] gmailcom> wrote:
>
> Thank you very much! That looks beautiful, I'll just try and modify this sample,

Happy to help.
Christian and Alain are probably right about using sphere_sweep, I just have
trouble every time I try to automate the coordinates for those. I finally got it
right(?), see redone script below. Had seen Mike Raiford's post in off-topic,
Wavelet, so that got me thinking more about this.

> your records must be in pretty bad shape if you can't see the sine wave
> (or maybe I always zoom in very far with Audacity), enjoy anyway! Oh, and make
> sure you record to 44k1Hz, and not 22050Hz

Yep, that was the first thing I found out, using 44.1 not a higher (better?)
rate. That sounds fine to my ears. My records are in bad shape or well used, and
the randomized wave form of my script is about what I see when zoomed into the
Audacity graph.  ;)

/* example sound wave */

#local Sweep=yes;

camera
{
 location <15, 0.5, -25>
 look_at <15,0.5,0>
}

#local T=25; // total time
#local I=0; // time count
#local S=0.1; // scale
#local A=3; // amplitude
#local F=0; // frequency

#if (Sweep=yes)

#local I=2; // time count
#local Ss=1; // scale

sphere_sweep
{
 b_spline
 T,

#while (I-2<T)

#local R=seed(I); // random

 <I+F,sin(I)*A,0>, S

#local I=I+Ss;
#local F=sin(I*R);//(sin(I/2)+cos(I/3)); //sin(I);
#end

#else

union
{

#while (I<=T)

#local R=seed(I); // random

sphere
{
 <I+F,sin(I)*A,0>, S
}

#local I=I+S;
#local F=0; // sin(I); // math to reshape wave, like sin(I*R)
#end

#end // if

texture
{
 pigment
 {
  function {abs(y)}
  color_map {
   [0 rgb <0,1,0>]
   [1 rgb <1,0,0>]
  }
  scale 1*A+S // adjust amplitude and sphere size
 }
 finish
 {
  ambient 1
 }
}
} // end union spheres


Post a reply to this message

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