Kyma Forum
  Tips & Techniques
  How to create a bit crusher.....?

Post New Topic  Post A Reply
profile | register | preferences | faq | search

next newest topic | next oldest topic
Author Topic:   How to create a bit crusher.....?
CharlieNorton
Member
posted 05 December 2009 19:53         Edit/Delete Message   Reply w/Quote
Hello I am on the hunt for a way of creating of reducing the bit depth of a section of my signal path. - Not unlike Logic's or many other developers "Bit Crusher"

I have just worked out why my search results where not revealing much... (click here to search private forums!!) I will let you know what I find out.....

Any pointers are gratefully received

Charlie

[This message has been edited by CharlieNorton (edited 05 December 2009).]

IP: Logged

SeanFlannery
Member
posted 05 December 2009 22:51         Edit/Delete Message   Reply w/Quote
There is a good bit reduction unit in the CAG Microsounds which (unfortunately at the moment) only work on a Capy.

I am very much looking forward to a Paca(rana) port of these as well as Pete's DSP microsounds.

IP: Logged

keph
Member
posted 05 December 2009 23:00         Edit/Delete Message   Reply w/Quote

downsampler.kym

 

The bitcrushing part is achieved by lowering attenuating down to high level and the gaining back up.


The next piece in the Logic Plug-in is sample rate reduction (aka downsampling). You can easily do that with a sample and hold module. Logic adds in clip mode to top it off.

Attached is one example.

However, I am confused that this example stopped working for the Bitcrusher piece. There seems to be something wrong with the twoExp part or perhaps the something in the DSP code changed. This was the method I've used for years and now checking a few delays that also used this snip of code, they are not working anymore either.

SSC?

IP: Logged

keph
Member
posted 05 December 2009 23:21         Edit/Delete Message   Reply w/Quote

I think with the Pacarana the internal processing is now 32-bit float rather than 24-bit. That certainly changes things.

If you are on a Pacarana system, take the attached sound and up the attenuation / gain factor to 32 (or 31.9999 if you like) and then it should work better. However, it doesn't seem to pronounced as it used to be on the Capy systems. Someone may have ideas on how to spice it up.

IP: Logged

pete
Member
posted 06 December 2009 06:03         Edit/Delete Message   Reply w/Quote
Hi Keph/Charlie

Keph, your right about the 32 bit floating point, but it's not the 32bits that is the problem but the fact that it is floating point.

Floating points main purpose is to stop reduction in resolution when you attenuate numbers so using the attenuation method is a non starter. The floating point pretends to be a 256 bit number and even if you could attenuate it enough you would just produce NANs (Not A Number).

Floating point numbers are expressed as 1 point something times 2 to the power of something. True zero or any value near it simply doesn't exist. The first something is called the mantissa and the second is called the exponent and both can be plus or minus.

I always though it should be zero point something and all these NANs would disappear at the expense of one bit of resolution, but people far greater than me are making the decisions.

In DSP we could do bit crushing simply with an AND instruction of a 1111000000 type number with the Mantissa but we don't have access to the DSP at this stage.

So to do bit crushing in the Paca we have to be a bit more creative.

If we use a waveshaper module, call up a FullRamp file as the table and turn off interpolation, then because the file has only 4096 samples, putting a signal in the index input will give us a 12 bit crushed version on it's output. Now if we attenuate the input to the waveshaper and add gain to the output we can get bit crushed versions of 12 bits or any thing below 12 bits. So we can use the same attenuator and gain modules as used in the Capy style bit crusher (found on the tweaky in the shared aria) except we would have to make the starting point 12 bits instead of 24 bits.

I know this would be no good for bit crushing anything above 12 bits but it's a start.

If I can think of any other ways of doing it I'll let you know.

Pete

IP: Logged

keph
Member
posted 06 December 2009 12:18         Edit/Delete Message   Reply w/Quote
the waveshaper! perhaps the most under appreciated module in kyma.

12-bit and under are what most people are looking for and think of with a bitcrusher.

thanks pete.

Ben.

IP: Logged

SSC
Administrator
posted 06 December 2009 14:49         Edit/Delete Message   Reply w/Quote
Pete's waveshaping bit crusher could work for any number of bits as follows:

Input-->Attenuate by 2 raised to number of bits beyond 12-->Waveshaper-->Gain by 2 raised to number of bits beyond 12

For example, for an 8-bit signal, you would attenuate by (12 - 8) twoExp (which is 16 inverse). Put it through the Waveshaper, and put a post Gain of 16.

If you really want additionally clipping at the end, you could boost it by even more in the final Gain stage.

IP: Logged

SSC
Administrator
posted 06 December 2009 14:57         Edit/Delete Message   Reply w/Quote

pacadownsampler.kym

 
Here's a modified version of Keph's Sound that works to crush the higher quality audio signals of the Paca(rana). I think Charlie is using a Capybara, and Keph's original Sound will do the trick on a Capy. Pete's waveshaping concept will work universally.

IP: Logged

CharlieNorton
Member
posted 06 December 2009 17:26         Edit/Delete Message   Reply w/Quote
Wow,

Thankyou all so much for your suggestions and advice;

Sean - Thanks for the suggestion, I have seen them before, but not noticed the bit-crushing unit. - They along with Harm's models will have to be purchased sooner rather than later. I have a Capy.... I have an unexpanded 320, does anyone thing I will have problems running the models? - -(Even if I have to cache and process...)

Keph, You description/analysis of the bit crusher theme has cleared out several conceptual cobwebs for me. Splendid. I am just about to experiment with your sound.

Pete, Wow thats epic, I have re-read a couple of times, the bit i would love to get my head around at this point, is the relationship between 4096 samples & 12 bit. It is most likely something rudimentary. I must do more reading of the theory. (feel free to point me to something to read...)

SSC, Fascinating, I must purchase a Paca..... Right after I pay off my existing debts :-( Never mind, my day will come, I still have much to learn anyway...


IP: Logged

SSC
Administrator
posted 06 December 2009 17:47         Edit/Delete Message   Reply w/Quote
quote:
the bit i would love to get my head around at this point, is the relationship between 4096 samples & 12 bit. It is most likely something rudimentary. I must do more reading of the theory. (feel free to point me to something to read...)

2 raised to the 12th power = 4096. In other words, 2 multiplied by itself 12 times = 4096.

12 is the number of bits required in order to store the number 4096 in binary.

When you feed a signal into a Waveshaper, you are saying, use this signal as the index into the wavetable referenced by the Waveshaper. If the wavetable has only 4096 samples in it, you are quantizing the input signal to 4096 discrete possible output values. To represent 4096 values as a binary number, only 12 bits are required.

If you were to reference a 1024-sample wavetable in the Waveshaper, you would be quantizing to 10-bits.

(Note that, in order for this to work, you must uncheck Interpolation, since interpolating will give you values in between the 4096 discrete values in the wavetable).

IP: Logged

CharlieNorton
Member
posted 06 December 2009 18:26         Edit/Delete Message   Reply w/Quote
Ok!

The layers are peeling away before my eyes. I have the Downsampling patch integrated into my current sound, it is beautiful and simple yet destructive. Great stuff.

SSC, wow, again, this is the weekend, and that was a an heroically quick reply with a response that clears up a second round of mysteries for me elegantly and concisely.

I have to thank you all, you have turned an idle request into an education.

Now to examine el waveshaper....... And pay more attention to the wiki

All the best

Charlie

IP: Logged

pete
Member
posted 06 December 2009 18:30         Edit/Delete Message   Reply w/Quote
Hi SSC

Bit confused here. How could you use the wave shaper to bit crush to 18 bits without using a bigger wave table? less than 12 bits is easy as I said (attenuate on the way in and amplify on the way out).

Thanks

Pete

IP: Logged

SeanFlannery
Member
posted 07 December 2009 02:21         Edit/Delete Message   Reply w/Quote
Hi Charlie,

I was running an 8 processor Capy up until recently and was able to make quite complex stuff using the CAG modules. Most of Harm Visser's Phm Toolkit was able to be run easily but there were a few objects using crossfilters that may cause you some problems.

Both of these products are fantastic additions to the Kyma library, I highly recommend them. The PHM Tool kit works on the Paca(rana) platform already as it is an implementation of standard Kyma prototypes.

regards
Sean

IP: Logged

SeanFlannery
Member
posted 07 December 2009 03:22         Edit/Delete Message   Reply w/Quote
Oh, and thanks to Charlie and All, this has been a very informative discussion

[This message has been edited by SeanFlannery (edited 07 December 2009).]

IP: Logged

SSC
Administrator
posted 07 December 2009 08:36         Edit/Delete Message   Reply w/Quote
Hi Pete,

quote:
Bit confused here. How could you use the wave shaper to bit crush to 18 bits without using a bigger wave table?

Exactly! By using a longer wavetable! The Waveshaper can take any length wavetable as its shaping function (and you could create a fullRamp of any length using the Samples Editor).

IP: Logged

rafe
Member
posted 07 December 2009 13:58         Edit/Delete Message   Reply w/Quote
quote:
Originally posted by SSC:
Hi Pete,

Exactly! By using a longer wavetable! The Waveshaper can take any length wavetable as its shaping function (and you could create a fullRamp of any length using the Samples Editor).


so that statement mean that wavetables, function generators and triggered table read functions DO NOT require tables of length exactly 4096 samples? the entire wavetable that is selected will be read from beginning to end.

i had misunderstood that detail about those prototypes - i had somehow expected that sample file length was necessary. wow good thing to know and clarify.

great post charlie - educational for me too.

thanks

[This message has been edited by rafe (edited 07 December 2009).]

IP: Logged

pete
Member
posted 09 December 2009 14:59         Edit/Delete Message   Reply w/Quote
Yep rafe your absolutely right about the wave shaper but I think you have the 4096 restriction on the Function generator.

If you look back through the old forum posting you will see a number of times I've said that the WaveShapers name is very misleading.

This innocent sounding little module is one of the most powerful beast in Kyma, as you can put a very big sound file in it, and use the index to play forwards backwards, at varying rates and jumping about all over the place like b****ry. You will need the index to be at sample rate signal ( not derived directly from capy talk) but this is the module of great power. This is why the vast majority of the modules in Petes DSP modules are made for feeding the index of the wave shaper ( but note you can only use them on the capy not the paca, sorry)

Pete

[This message has been edited by pete (edited 09 December 2009).]

IP: Logged

SSC
Administrator
posted 09 December 2009 15:15         Edit/Delete Message   Reply w/Quote
FunctionGenerator can use any length wavetable (aka sample).

IP: Logged

SSC
Administrator
posted 09 December 2009 15:17         Edit/Delete Message   Reply w/Quote
TriggeredTableRead can also take any length wavetable (or sample).

IP: Logged

CharlieNorton
Member
posted 10 December 2009 09:27         Edit/Delete Message   Reply w/Quote
A small detail,

everyone is discussing 'the waveshaper', On the prototypes, there are many.

Is there a suggestion for one that I should start investigating with reference to this wavetable bitcrushing mission?

Charlie

IP: Logged

CharlieNorton
Member
posted 10 December 2009 19:48         Edit/Delete Message   Reply w/Quote
I am currently experimenting with various waveforms as wavetables in the TimbreWaveshaper.

I had a read of this. It answered one of my next questions about Polynomial Transfer Functions.
http://www.music.mcgill.ca/~gary/307/week12/waveshaping.html

:-)

IP: Logged

rafe
Member
posted 26 January 2010 19:20         Edit/Delete Message   Reply w/Quote
hello Charlie

the link you posted is broken. i searched the mcgill site with no luck.

here is an alternative if anyone is interested.
http://www.cs.sfu.ca/~tamaras/waveshapeSynth/Waveshaping_Synthesis.html

thanks
rafe

[This message has been edited by rafe (edited 27 January 2010).]

IP: Logged

All times are CT (US)

next newest topic | next oldest topic

Administrative Options: Close Topic | Archive/Move | Delete Topic
Post New Topic  Post A Reply

Contact Us | Symbolic Sound Home

This forum is provided solely for the support and edification of the customers of Symbolic Sound Corporation.


Ultimate Bulletin Board 5.45c