POV-Ray : Newsgroups : povray.newusers : sound-/sine wave in povray Server Time
2 Jul 2024 11:39:50 EDT (-0400)
  sound-/sine wave in povray (Message 1 to 7 of 7)  
From: Marco
Subject: sound-/sine wave in povray
Date: 16 Sep 2010 15:00:00
Message: <web.4c9268b1d5cad8236731f09e0@news.povray.org>
So here's a thingie I can't solve, don't know enough math to figure this one out
(I presume my problem's math-related): 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. Could anyone help me with this
please?


Post a reply to this message

From: Christian Froeschlin
Subject: Re: sound-/sine wave in povray
Date: 16 Sep 2010 15:43:49
Message: <4c927375$1@news.povray.org>
Marco wrote:
> So here's a thingie I can't solve, don't know enough math to figure this one out
> (I presume my problem's math-related): 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.


Post a reply to this message

From: Alain
Subject: Re: sound-/sine wave in povray
Date: 16 Sep 2010 17:24:43
Message: <4c928b1b$1@news.povray.org>

> So here's a thingie I can't solve, don't know enough math to figure this one out
> (I presume my problem's math-related): 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. Could anyone help me with this
> please?
>
>
You can use a sphere_sweep. Sample the sin function at sufisently small 
intervals.

It's also possible to use an isosurface.



Alain


Post a reply to this message

From: omniverse
Subject: Re: sound-/sine wave in povray
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

From: Marco
Subject: Re: sound-/sine wave in povray
Date: 17 Sep 2010 05:45:01
Message: <web.4c933804613bfb9e6731f09e0@news.povray.org>
"omniverse" <omn### [at] charternet> wrote:
> 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 */
> ...
> /* end sine or sound wave */

Thank you very much! That looks beautiful, I'll just try and modify this sample,
maybe change the coloring of the spheres, maybe try to create the look of a
single thread (and not a string of spheres), and perhaps if I could create some
"cartoony" randomness to the peaks of the wave forms, that would really look
great.

Oh, and 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, or if you burn it to CD it will come
out like the Smurfs (because the CDplayer will play back at 44k1 regardless)! (I
had that once, very funny, but not what I wanted at all)


Post a reply to this message

From: omniverse
Subject: Re: sound-/sine wave in povray
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

From: Alain
Subject: Re: sound-/sine wave in povray
Date: 17 Sep 2010 17:01:23
Message: <4c93d723$1@news.povray.org>


> Thank you very much! That looks beautiful, I'll just try and modify this sample,
> maybe change the coloring of the spheres, maybe try to create the look of a
> single thread (and not a string of spheres), and perhaps if I could create some
> "cartoony" randomness to the peaks of the wave forms, that would really look
> great.
>

If you use a string of relatively short cylinders connected by spheres, 
you can get something very reasonable.
The cylinders rid you of the beady aspect, and the spheres will fill up 
the gaps between the cylinders.



Alain


Post a reply to this message

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