POV-Ray : Newsgroups : povray.newusers : sound-/sine wave in povray : Re: sound-/sine wave in povray Server Time
4 Jul 2024 13:50:02 EDT (-0400)
  Re: sound-/sine wave in povray  
From: omniverse
Date: 16 Sep 2010 19:40:01
Message: <web.4c92aa22613bfb9ed939a6800@news.povray.org>
Christian Froeschlin <chr### [at] chrfrde> wrote:
> Marco wrote:
I want to make a sine-wave in 3D, with a
> > look like a b_spline (as in: rounded edges, to give it a proper 3D-look), like
> > the representation of a sound wave in Audacity.
>
> I'm not sure how it looks in Audacity but you might try a sphere_sweep.

I recently bought a turntable with USB connection so I could put old vinyl
records onto CD and it comes with Audacity. To see anything like a sine wave I
must magnify the view to the extreme, otherwise mostly see chaotic waveforms not
simple sine waves from music. Guess that's beside the point.  ;)

Not sure sphere_sweep is going to be good for this since it requires a known
number of points. I could just be thinking wrong but stringing spheres together
might be easiest to work math in for variations on waveform.
Simple example here (because it's all I could do), not intended as THE solution:

/* sine or sound wave */
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

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

texture
{
 pigment
 {
  function {abs(y)}
  color_map {
   [0 rgb <0,1,0>]
   [1 rgb <1,0,0>]
  }
  scale 1+S // adjust to sphere size
 }
 finish
 {
  ambient 1
 }
}
} // end union spheres
/* end sine or sound wave */


Post a reply to this message

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