# Using Bezier Curves To Store Samples

I don’t know if anybody else has ever thought of this, or if this method already exists, but could Renoise convert a standard sample to a compressed format which uses Bezier curves to represent the smallest number of points on the curves that form a sample? Just about all instruments change slowly throughout the waveform, and presumably as the waveform is often repeated throughout the sample, except gradually getting smaller in amplitube (with most instruments), this could also help with the compression.

When I use PhotoImpact and draw a curved line, it can immediately convert it to Bezier curves, so I presume the same function can easily be applied to a waveform. I don’t know how much data it takes to store one Bezier point, compared to the individual samples required to represent the same amount of sample data, but could this work?

I don’t think it could.

depending on the accuracy you would want to achieve, Bezier curves can need much data to be enitrely described.

to completely describe the sample without loss, certainly the best thing to do would be setting the curve degree to 1 and save a control point for each sample, which is basically what a normal point-by-point description does, implicitly setting the degree to one, of course.

in a lossy form, your method should find a compromise between interpolation and precision, but it would always be a bad compromise.

a more precise (and generic) form of Bezier curves are NURBS curves, in whith each control point has a weighted influence over its range of curve, but this would require even more data to store:

• control points array
• knots sequence
• knots multiplicities array
• weigths array

it’s a nice idea, but believe me, this is not applicable

I have seen some whitepapers on Vector Audio Format though. I don’t think it used neither NURBS or Bezier. And it basically didn’t store the audio as visible waveform either.

It’s a very interesting concept and in theory it should work well on very primitive types of waveforms, but, as It-Alien has already stated; as soon as the waveform complexity increases - even by a small amount - this method would quickly become totally impractical, simply due to the huge amount of curves and control points that would be required to accurately represent the complex waveform. So, when it comes to compression of complex waveforms, traditional methods such as .flac are already pretty much the best we will find, imho.

Thanks for the responses, I had a closer look at a piano sample in Audacity, and as you all say, it just isn’t workable. Maybe for very simple waveforms, it might save space, but it won’t work on most waveforms.

I don’t suppose it matters so much nowadays anyway, with hard drives being so cheap!

Well the audio was not stored for compression. The idea was to create a format where you could hold audio data without actual sampling rate – infinite sampling rate. It was used for some audio studies and it worked.

Knowing what I know about splines + beziers, with something like this, the lower the frequency, the better the compression… however, you’d have presumably up to 16x as much data as a raw .wav for the highest possible frequency sin wave… for example, presuming 2x16bit floats for each control point… 44kbps waveforms allow 22khz waves, and this compression would need to be near to 704kbps to allow for the same waveform. Not to mention that with some additional lower frequency sin waves, the complexity would still increase more… resulting in the need for more points.

Perhaps, however, this method can be mixed with FFT and predictive statistical stuffs to create a really cool compression algorithm. Let me know when you’ve completed it!

Could be great for audio playback at 0.0001 x speed, and perhaps turning audio into controller values ?

Also, the idea reminds me of MPEG4 Structured Audio. It was an attempt to recreate music using a description of the music, instead of compression. It “specifies sound not as audio data, but as a computer program that generates audio when run”
http://www.cs.berkeley.edu/~lazzaro/sa/book/index.html