IPB

Welcome Guest ( Log In | Register )

Triangular Probability Density Function Dither, How does this random number exaclty work
aristotel
post Dec 31 2003, 04:52
Post #1





Group: Members
Posts: 22
Joined: 31-December 03
From: Warwick, UK
Member No.: 10830



Hello everybody,

THis is my first post on this site. NIce to find a forum for this field which I am interested in and studying.

So here is the problem...

I need to write in C, a program that will dither and truncate a 16 bit stereo file to a 14 bit stereo file. It is for an assignment for university basically. I more or less have the idea of how it works after having read several books and websites.

However here is the problem/question.

To go from 16 bit to 14 bit and add dither before truncating it is necessary to add 3 bits of noise to the 16 bit original signal.

3 bits can have the maximum value of 8. In audio Terms -4 to +4. Correct so far?

Now if i generate a random number between 0 and 8, I can't just add that number to the 16 bit stream right? Becuase I need to add a +4 to -4 range number. It that correct? and if it is, how can I generate a random number between +4 and -4 in C?

int a = rand() % 8;

this would give a random value between 0 and 8. BUt how do i set a lower and upper limit for the random number to be generated?

Well, at this point this is all i will ask. I have a feeling this is somehting really simple and for some reason I have been stuck on it for some time now. huh.gif

Thank you in advance for reading it and hopefully replying.

In the meantime, Happy New Year everybody! cool.gif


PS: Oops..i just realised it was moved from general audio to Scientific..Sorry..i am new ..i thought this was a simple question and thats why i put it in General audio.

This post has been edited by aristotel: Dec 31 2003, 05:02
Go to the top of the page
+Quote Post
 
Start new topic
Replies
jlohl
post Sep 6 2007, 11:02
Post #2





Group: Members
Posts: 80
Joined: 5-November 05
Member No.: 25574



QUOTE
What is the effect of a non-white random source in dithering?

I did a small and free software to show/hear the effect of dither. The dither itself can be noise but also a sine wave. So you can try and listen to the result.
Get it here


--------------------
www.ohl.to
Go to the top of the page
+Quote Post

Posts in this topic
- aristotel   Triangular Probability Density Function Dither   Dec 31 2003, 04:52
- - kjoonlee   Hi, I'm quite a newbie, so I can't offer ...   Dec 31 2003, 05:16
- - tigre   AFAIK rectangular dither is equal to random noise ...   Dec 31 2003, 11:23
- - aristotel   Hey..thanks for your replies. I have come up with...   Dec 31 2003, 16:49
- - Jasper   It seems correct, but wouldn't you just need t...   Jan 1 2004, 11:49
- - aristotel   Hey Jasper..thanks for your post. The decision to...   Jan 1 2004, 16:57
- - cabbagerat   You might want to consider the fact that with most...   Jan 2 2004, 06:57
- - Jasper   If you are looking for good random number generato...   Jan 2 2004, 12:02
- - aristotel   Hello, Jasper..the way I understood it was that if...   Jan 3 2004, 20:15
- - Jasper   Actually the information from those two bits of no...   Jan 4 2004, 11:28
- - tigre   There must be a mathematical way to determine how ...   Jan 4 2004, 12:20
- - Ariakis   http://www.hydrogenaudio.org/forums/index....indpo...   Jan 4 2004, 12:33
- - Diocletian   QUOTE (tigre @ Jan 4 2004, 12:20 PM)There mus...   Jan 4 2004, 12:56
- - tigre   totally = not mesurable. e.g. distortion: If you ...   Jan 4 2004, 13:06
- - aristotel   Hello everybody...lots of replies i see...lots of ...   Jan 4 2004, 19:16
- - tigre   QUOTE (aristotel @ Jan 4 2004, 08:16 PM)It ta...   Jan 4 2004, 19:58
- - 2Bdecided   I've only just seen this thread. At the risk ...   Jan 5 2004, 16:07
- - KikeG   QUOTE (tigre @ Jan 4 2004, 12:20 PM)There mus...   Jan 6 2004, 16:49
- - aristotel   QUOTE (tigre @ Jan 4 2004, 10:58 AM)Do proces...   Jan 6 2004, 18:21
- - aristotel   Hello 2bDecided..your post is helpful and thank yo...   Jan 6 2004, 19:04
- - aristotel   QUOTE (KikeG @ Jan 6 2004, 07:49 AM)if I...   Jan 6 2004, 19:16
- - aristotel   QUOTE (aristotel @ Jan 4 2004, 10:16 AM)Howev...   Jan 6 2004, 19:20
- - 2Bdecided   QUOTE (aristotel @ Jan 6 2004, 06:04 PM)Hello...   Jan 7 2004, 13:46
|- - goli   Hi everybody, I just visited this page and i was ...   May 29 2005, 19:02
|- - 2Bdecided   QUOTE (goli @ May 29 2005, 06:02 PM)Hi everyb...   Jun 16 2005, 11:37
|- - Nika   QUOTE (goli @ May 29 2005, 12:02 PM)Hi everyb...   Jun 16 2005, 14:55
- - aristotel   QUOTE (2Bdecided @ Jan 7 2004, 04:46 AM)Hope ...   Jan 9 2004, 03:22
- - Ariakis   Just a note on what David said about a triangular ...   Jan 9 2004, 09:04
- - Jasper   Actually I think you'd want something symmetri...   Jan 9 2004, 13:06
- - 2Bdecided   QUOTE (Ariakis @ Jan 9 2004, 08:04 AM)Just a ...   Jan 9 2004, 13:29
- - spoon   To quote shibatch "Dithered 8bit files contai...   Jun 15 2005, 10:11
- - KikeG   That depends largely on the sample rate.   Jun 15 2005, 13:13
- - Nika   Sorry, guys, I've only just seen the thread an...   Jun 16 2005, 14:50
|- - madshi   QUOTE (Nika @ Jun 16 2005, 14:50) Sorry, ...   Aug 27 2007, 15:47
|- - SebastianG   QUOTE (madshi @ Aug 27 2007, 16:47) Sorry...   Aug 27 2007, 17:53
|- - madshi   QUOTE (SebastianG @ Aug 27 2007, 17:53) T...   Aug 28 2007, 08:23
|- - SebastianG   QUOTE (madshi @ Aug 28 2007, 09:23) (1) a...   Aug 28 2007, 09:13
|- - madshi   QUOTE (SebastianG @ Aug 28 2007, 09:13) T...   Aug 28 2007, 09:23
|- - SebastianG   QUOTE (madshi @ Aug 28 2007, 10:23) QUOTE...   Aug 28 2007, 14:10
|- - madshi   QUOTE (SebastianG @ Aug 28 2007, 14:10) B...   Aug 28 2007, 14:50
|- - SebastianG   QUOTE (madshi @ Aug 28 2007, 15:50) P.S: ...   Aug 28 2007, 14:59
|- - madshi   QUOTE (SebastianG @ Aug 28 2007, 14:59) E...   Aug 28 2007, 16:23
|- - SebastianG   QUOTE (madshi @ Aug 28 2007, 17:23) QUOTE...   Sep 28 2007, 10:51
|- - madshi   QUOTE (SebastianG @ Sep 28 2007, 10:51) Y...   Sep 28 2007, 21:58
- - Nick.C   Is it not simply: new_value = round(old_value/(2^...   Aug 27 2007, 17:01
- - Nick.C   Surely, to round you will have to use FP maths? .....   Aug 28 2007, 08:31
|- - madshi   QUOTE (Nick.C @ Aug 28 2007, 08:31) Surel...   Aug 28 2007, 09:02
- - 2Bdecided   It's probably worth mentioning a simple trick ...   Aug 28 2007, 14:18
|- - Nick.C   QUOTE (2Bdecided @ Aug 28 2007, 14:18) Do...   Aug 28 2007, 14:33
|- - kwwong   QUOTE (2Bdecided @ Aug 28 2007, 08:18) It...   Sep 4 2007, 02:59
|- - SebastianG   QUOTE (2Bdecided @ Aug 28 2007, 15:18) It...   Sep 5 2007, 10:27
- - jlohl   QUOTE What is the effect of a non-white random sou...   Sep 6 2007, 11:02
- - ilo   TPDF dither should have a peak amplitude twice tha...   Sep 27 2007, 22:57
|- - madshi   @ilo, that sounds quite interesting, but honestly...   Sep 28 2007, 09:12
|- - ilo   @ madshi: I think the stuff already posted will d...   Sep 28 2007, 14:16
- - Nick.C   It should be 0..16 as that is (0.0 .. 1.0) x 2^4. ...   Sep 28 2007, 22:11
|- - madshi   QUOTE (Nick.C @ Sep 28 2007, 22:11) Sorry...   Sep 28 2007, 22:18
- - Nick.C   If you're really wanting to use integers, why ...   Sep 28 2007, 22:21
- - madshi   QUOTE (Nick.C @ Sep 28 2007, 22:21) If yo...   Sep 28 2007, 22:29


Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 21st April 2014 - 09:22