Waveform Development

This section is now closed.
Forum rules
Audacity 1.3.x is now obsolete. Please use the current Audacity 2.1.x version.

The final version of Audacity for Windows 98/ME is the legacy 2.0.0 version.
Locked
leonwhite06
Posts: 10
Joined: Fri Feb 10, 2012 2:57 pm
Operating System: Please select

Waveform Development

Post by leonwhite06 » Thu Feb 16, 2012 3:51 am

I need help developing a waveform for research. I have attached a picture for viewing.

In picture: I developed a basic waveform using the Chirp command. I would like to tilt the waveform so that the the RED line of the waveform shifts to the YELLOW line (x-axis), while still keeping the same Chirp waveform as is already developed.

Is this possible? Another way to tackle this problem? Any help would be GREATLY appreciated.

Thank you,

:geek:
Attachments
Audacity Question.JPG
Audacity Question.JPG (75.44 KiB) Viewed 1566 times

PGA
Posts: 695
Joined: Thu Jan 19, 2012 9:16 pm
Operating System: Please select

Re: Waveform Development

Post by PGA » Thu Feb 16, 2012 6:58 am

I'll begin by stating that I am only a "reasonably intelligent layman", not an "expert". My understanding of the physics of sound is that we perceive sound as a consequence of the minute changes in pressure that fall upon our ears as the sound wave arrives (probably on the ear drum but I could be wrong on that). That pressure will be either pushing the drum inwards (let's call that positive pressure) or it will allow the drum to move outwards (let's call that one negative pressure). Therefore a sound wave has both positive and negative elements. What you seem to be wanting to achieve is a sound wave that has only positive elements. I'm not sure such things exist in nature, and therefore I'm not sure that any software programmers will have even considered the possibility.

As I said, I'm only a layman, so I will be following this topic with interest in order to learn more for myself.

steve
Site Admin
Posts: 81627
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Waveform Development

Post by steve » Thu Feb 16, 2012 11:10 am

leonwhite06 wrote:Is this possible?
Yes it is, though as PGA wrote, this is not "normal", so the method is a bit geeky :ugeek:

Let's say that the chirp was generated with amplitudes:
Start: 0.1
End: 1.0

To shift the red line up to the yellow line, you will need to shift the left end up by 0.1 and the right end up by 1.0.

Note 1:
This will cause the right hand end of the waveform to exceed 0 dB.
Sample values greater than 0 dB are only possible when using "floating point audio formats", so the track must be 32-bit float format.
Integer formats cannot handle values over 0 dB, so the "over 0 dB" part will be clipped to 0 dB.
There is a bug in all current release versions of Audacity that can sometimes cause data corruption when resampling over 0 dB samples (not surprising as over 0 dB is not generally considered to be "valid" audio, however this has been fixed for the next version of Audacity).

If you specifically need sample values over 0 dB, then the audio must be 32-bit float so as to avoid these issues, but sound cards will not be able to play the sound because sound cards use integer format data which will clip the audio at 0 dB. The better solution is likely to be to tilt the audio and then to scale it so that the peak at the right hand end does not exceed 0 dB. The output will then look like this:
firsttrack000.png
firsttrack000.png (9.37 KiB) Viewed 1560 times
Note 2:
It looks like your "chirp" is a square wave. If the waveform is "tilted", the waveform will no longer be quite "square" because the top of the waveform will now be tilted. If you need the top and bottom of the waveform to be exactly horizontal, the waveform that you require will need to be synthesized from scratch.

Note 3:
We are adding a "DC offset" to the signal (making it "offset" from the centre line). If you output this signal through your sound card it is likely that the sound card will be unable to handle the DC component and will attempt to "correct" it, tilting the output back down.

To add the DC component, we can use the Nyquist Prompt effect.
The following code will produce a "ramp" from 0.1 to 1.0 at a low sample rate.

Code: Select all

(pwlv 0.1 1 1.0)
We can "add" this to the signal like this:

Code: Select all

(sum s (pwlv 0.1 1 1.0))
"s" is a special variable that Audacity uses to pass audio from the track to Nyquist.

We then want to scale the audio so that it still fits within a 0 dB range. Essentially we are halving the amplitude of each sample, so all we need to do is to multiply each sample value by 0.5:

Code: Select all

(mult 0.5 (sum s (pwlv 0.1 1 1.0)))
Select the track, then copy and paste this final line of code into the Nyquist Prompt text box, then click the OK button.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

leonwhite06
Posts: 10
Joined: Fri Feb 10, 2012 2:57 pm
Operating System: Please select

Re: Waveform Development

Post by leonwhite06 » Thu Feb 16, 2012 6:45 pm

You are pure genius!

Thank you so much. :ugeek:

steve
Site Admin
Posts: 81627
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Waveform Development

Post by steve » Thu Feb 16, 2012 7:06 pm

You're welcome.
Aren't you going to tell us what you want it for?
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

waxcylinder
Forum Staff
Posts: 14685
Joined: Tue Jul 31, 2007 11:03 am
Operating System: Windows 10

Re: Waveform Development

Post by waxcylinder » Fri Feb 17, 2012 2:23 pm

steve wrote:You're welcome.
Aren't you going to tell us what you want it for?
Yes please - I'm curious too ...

WC
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * FAQ * * * * * Tutorials * * * * * Audacity Manual * * * * *

leonwhite06
Posts: 10
Joined: Fri Feb 10, 2012 2:57 pm
Operating System: Please select

Re: Waveform Development

Post by leonwhite06 » Fri Feb 17, 2012 2:34 pm

lol....I'm trying to develop a new type of waveform to be used for my research. I cant go into too much detail as our research team and advisors dont want me to. I hope you can understand.
However, I will say that your help will NOT be forgotten. As soon as I am able to share the full details, I will!! And I will certainly give credit where credit is due.


Thank you so much again. :ugeek:

steve
Site Admin
Posts: 81627
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Waveform Development

Post by steve » Fri Feb 17, 2012 3:10 pm

Tantalizing :D

Good luck with the research, I look forward to hearing more about it.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

leonwhite06
Posts: 10
Joined: Fri Feb 10, 2012 2:57 pm
Operating System: Please select

Re: Waveform Development

Post by leonwhite06 » Tue Feb 21, 2012 2:10 pm

thanks! and you will! 8-)

Locked