Re: Lower WAV pitch problem

new topic     » goto parent     » topic index » view thread      » older message » newer message

Daryl,

I think I don't have the problem I thought I had, sigh, see below.

----- Original Message -----
From: <daryl_vdb at hotmail.com>
>
>
> Oh, you're still messing around with that old crappy version of WaveEdit.
> Didn't you say it crashed when the wave is displayed?

Yes, but it doesn't crash if I just open a wav file, & don't try to*select*
any portion of the not yet displayed waveform from the blank screen.  It's a
convenient test platform, since it already opens & saves wav files  :)

>I sent you the wrong
> file that time (it was one of my "work in progress" backups).  I'll send
you
> a proper working one, but it's a bit embarrasing because it sucked badly.

That's ok :)

>
> The code you showed looks fine to me.  It should sound exactly one octave
> lower in pitch.

I figured it should give 1/2 the original frequency, but I didn't know that
was the same as an octave???

>I don't know what you could be doing to double the duration
> and make it's pitch stay the same, but I'd love to find out.

If you wanted to do that on purpose, just put a copy of the existing samples
at the end of the original  :)


>  Maybe you
> should listen to it again, because I seriously doubt that it would be the
> same pitch.

I guess you're right, because I sent the code to Ricardo, and he says
something very similar to what Bernie suggested:  apparently I put so many
"deliberate" harmonics into my original test wave, that when I halved the
whole thing, the result gave an aural illusion of being the same as it was
initially.




>  Try inserting two samples in between each soriginal sample, to
> make the wave 3 times longer.  This definitely won't sound the same.

Thanks, you're right, that *was* clearly lower!

>
> This code has not been tested.
>
> procedure LowerPitch()
> integer diff1, diff2

but no need for diff1,diff2

> sequence newWave
> newWave = {}
>
>    -- wave is the wave data, wave[1] is for mono
>    for n = 1 to wavelen do
>      newWave &= wave[1][n]
>
>      if n < wavelen then
>         diff1 = wave[1][n+1] - wave[1][n]
>         if diff != 0 then
>            newWave &= {wave[1][n] + floor(diff / 3), wave[1][n] +
> floor(diff*2 / 3)}
>         else  -- two successive points are the same value, so just copy
that
> value:
>            newWave &= repeat(wave[1][n], 2)
>         end if
>      end if
>    end for
>
>    wave[1] = newWave
>    wavelen = length(wave[1])
>
>    changeStatus = 1
>    refresh()
>
> end procedure
>
>
> regards,
> Daryl Van Den Brink
>
> >I'm trying to write a routine to lower the pitch of a waveform, by adding
a
> >new sample point between every existing point, each new point being equal
> >to
> >half the value of the difference between each of the original points, but
> >it's not working.
> >
> >I get a wav that's twice as long in duration, quieter, but sounds like
> >still
> >the same pitch as the original.  If I look at the waveform using a
version
> >of "Cool Edit", it *looks* correctly stretched out doubly, though it
> >doesn't
> >sound any
> >lower; and if I use "Cool Edit" to stretch the original, that *does*
sound
> >lower, but *looks* the same as the original (ie, unstretched)!  And none
of
> >the format data appears to be any different, as far as I can see.
> >
> >Anybody have any idea what I might be doing wrong?
> >
> >What I did was, I included the following procedure into an old version of
> >Daryl van den Brink's "WaveEdit":
> >
> >--<code begins>
> >
> >-- LOWER THE PITCH OF A SOUND BY 1/2:
> >
> >-- copy first point in sample to a second, new sequence;
> >
> >-- then, for every point in the original for which there is a next point,
> >-- subtract value of current point from next point;
> >-- take half of the difference;
> >-- add that value to the value of the lowest of the two points;
> >-- place that value at the end of the second sequence.
> >
> >-- copy next point in original sample to second sequence, and
> >-- repeat above for the next point
> >-- (the one that was previously the second point)
> >
> >-- then replace original with new,
> >-- changing wavelen & ? so it will write & play correctly.
> >
> >procedure LowerPitch()
> >integer diff
> >sequence newWave
> >newWave = {}
> >
> >   -- wave is the wave data, wave[1] is for mono
> >   for n = 1 to wavelen do
> >     newWave &= wave[1][n]
> >
> >     if n < wavelen then
> >        diff = wave[1][n+1] - wave[1][n]
> >        if diff != 0 then
> >           newWave &= wave[1][n] + floor(diff / 2)
> >        else  -- two successive points are the same value, so just copy
> >that
> >value:
> >           newWave &= wave[1][n]
> >        end if
> >     end if
> >   end for
> >
> >   wave[1] = newWave
> >   wavelen = length(wave[1])
> >
> >   changeStatus = 1
> >   refresh()
> >
> >
> >end procedure
> >
> >onClick[mnuWaveLowerFrequency]=routine_id("LowerPitch")
> >
> >--<end code>
> >
> >Dan Moyer
>
>
>
> TOPICA - Start your own email discussion group. FREE!
>
>

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu