[techtalk] can i help me

Almut Behrens almut_behrens at yahoo.com
Fri Aug 3 10:01:51 EST 2001


On Thu, Aug 02, 2001 at 03:28:35PM +0800, sreeram wrote:
> 
> ok i am writting a program in linux 6.2 which will
> read the file on the other side  which is having the (*.wav) data. as every
> data is there in the file the process is reading the data
> very fastly that it is doing the process in very less time.
> but i want to keep this process for some time but this is not happening?
> infact what is happening is when it reaches the end of the file and when
> data is not there it is just inserting silence in the other side of the
> file.
> i dont want to keep that silence so i think if i make this process of
> reading with the read function is made slow the process will
> be there for some more time

Hi,

I'm not exactly sure whether I understand what you are trying to
achieve. As I read you, you intend to timestretch an audio sample
so it plays longer than the original sample is. Is that right?

Basically, having an audio file simply play longer is as easy as
changing the playback sample frequency. This method has severe
drawbacks, though, as it inevitably will change the pitch and other
perceived qualities of the sound (be it music or speech).

Also, it can *not* be achieved by throttling the input data stream
(which seems to be what you are trying). Rather, you would need to
program the chip of the soundcard to 'pull' or 'consume' individual
values at a lower rate. (Normally, you wouldn't need to do this low
level soundchip programming yourself -- all kinds of audio software/
drivers already do exactly that for you.)  The proper sampling rate
is normally stored together with the audio sample (in some header,
depending on format). You would basically just have to modify this
entry in the header... Also, some tools have commandline options for
specifying the playback rate. So, for example, if you change the
original sampling rate of 44kHz down to 22kHz, it will play twice as
long, but pitch will change too, e.g. a tone of originally 1kHz will
be played at 500Hz.  I guess this is not really what you want -- so I
won't go into further details...

To me, it sounds more like you want to stretch the audio sample
while leaving other perceived qualities intact... If that's what you
are trying to do, I'd really recommend that you quickly forget about
the project -- sorry to disappoint you ;)

Even the most clever heads of the signal processing departments and the
electronic music hardware industry have been fighting with this problem
for decades.

At least it's definitely not as simple as inserting pauses in the data
stream, however tiny and evenly distributed they may be...
Timestretching audio data is more of a problem of *creating* the
missing data basically out of nowhere, i.e. trying to extrapolate from
the existing surrounding data. Various algorithms have been devised,
most of them with questionable results. They typically produce clearly
audible distortions, and applicable time stretching/compression factors
in many cases only range from about 0.7 to 1.5.

Various terms have been coined around related things: timestretching,
time/pitch scaling, pitch shifting, etc.
One of the modern and higher quality algorithms is MPEX, which is a
proprietory technique developed by Prosoniq (btw, it has nothing to do
with MPEG;)  It's based on some artificial neural network algorithm.
The associated (commercial) software package is called TimeFactory
(available for WinXX/Mac only).

A different, equally high quality technique has been developed by
the Roland company and is available as a musical hardware device
called VP-9000, allowing real-time modifications of pitch, formants 
and timing.

There are probably more, of course. These are just the ones I know
of -- and I'm in no way affiliated with either Prosoniq or Roland...

In case you are interested in this stuff, here are a few pointers:

Overview article on algorithms -- with sound samples:
  http://www.dspdimension.com/html/timepitch.html

Lots of related links on the same site:
  http://www.dspdimension.com


The TimeFactory (MPEX) software:
  http://www.prosoniq.com/html/timefactory.html

  (side note: disable JavaScript before following this link -- this site
  is one of the examples of what JavaScript should *not* be used for...)

A review article:
  www.sospubs.co.uk/sos/jul00/articles/prosoniq.htm

The VP-9000 hardware solution:
  www.roland.co.jp/worldwide/products/MI/variphrase_processor/VP-9000.html
  www.rolandus.com/USERS/RUG/ARCHIVE/Winter_00/UT-variphrase.html 


Just in case I completely misunderstood what you are trying to do,
I apologize in advance :)

Have fun,

- Almut





More information about the Techtalk mailing list