Jump to content

Creating sound with Fade in and fade out


crewex

Recommended Posts

In developing a diagnostic medical device (similar to a hearing test) that uses pulsed sounds one has to create fade in and fade out.

WHY??

Because if you start and stop a sound a headset and it is stripped of file formating so all it is is a sound wave the speaker POPS!

The way to avoid this is to create a .5 - 1 second fade in where you linearly increase the amplitude of the wave.

Here is my problem, I'm using a while loop to create the desired sound pulse and ramp up. The loop is not looping fast enough to produce a nice smooth fade in, the steps are too large. The only way to make smaller steps would be to increase the length of time the fade in takes place. Any suggestions?

Link to comment

You'll want to use a second simple waveform (ramp up, ramp down) to scale your actual signal. So rather than varying the amplitude of the signal generator, use a constant amplitude and then scale the generated waveform by multiplying it by the ramp waveform.

Here's a partial solution showing how to generate a ramp up and using it to scale your sine signal. This will ramp up continuously so you'll need to figure out how to stop the ramp and keep it level at your final amplitude and then add the ramp down for the end of your signal.

post-3370-1219158040.png?width=400

Link to comment

QUOTE (LV_FPGA_SE @ Aug 19 2008, 08:01 AM)

You'll want to use a second simple waveform (ramp up, ramp down) to scale your actual signal. So rather than varying the amplitude of the signal generator, use a constant amplitude and then scale the generated waveform by multiplying it by the ramp waveform.

The Windowing functions are also commonly used for this purpose. (Palettes -> Signal Processing -> Windows) Cosine window is pretty good. It's easier than a ramp because you don't have to calculate the starting and stopping. It gets trickier if you signal spans mulitple iterations of the loop, and if you can't pre-generate the whole signal at once, but it doesn't seem like you are in that situation.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.