IPB

Welcome Guest ( Log In | Register )

Low Sampling Rate 1 Bit Audio Enhancement, For Use on Older Machines
chjmartin2
post Nov 25 2011, 05:26
Post #1





Group: Members
Posts: 16
Joined: 24-June 11
Member No.: 91806



Here is my situation. I am trying to playback sampled audio on an old Mattel Aquarius. The computer has the ability to put out only a high value or a low value to the audio channel. It is very similar to the PC speaker in this regard. I have been toying with different ways to get sampled audio out of the machine, using a PC, Cooledit and a program that I wrote to do conversion and playback. The absolute max sampling rate that I can get out of the machine is 50,700 Hz, although at that rate I really am not allowing the audio signal to max out so it can be very quiet. I have created a 1 bit encoder that takes an 8 bit unsigned .RAW file as an input.

The first thing I do is downsample my target audio to 8 bit mono, then save it as a raw, my converter then takes that raw file and converts it to a 1 bit audio data stream. I want to create audio files that I can use with my video player, and since I am limited to 1 megabyte of storage total (bankswitched cart) and I need to use most of the data storage for my video frames, I really need a way to create half-way decent sounding 1 bit audio. In addition, I would like a method to optimize higher sampling rate audio for other purposes (or to just see how "good" the audio could get) but I will limit this question to the task at hand. First, lets start with my source file:

imperial.mp3

You'll recognize it as the imperial march. For my needs I had to downsample it to 7,061 hertz (that is not a type) and 8 bit:

imperial.wav

So, straightforward enough... Now here is the output from a simple program that takes every 8 bit unsigned value greater than 127 and makes it a 1 and every value at 126 or lower and makes it a 0. No distribution of the error or dithering is performed. In order to play it back effectively, I converted the output to an 8 bit wave with values of 0 and 255 respectively:

Imperial_1Bit_NoDistNoDith.wav

Inside my program I built in the ability to distribute the quantization error. It works like this:

Quantize the current sample (to 0 or 255) and take the difference.
Add the error to subsequent samples prior to their quantization, distributing various amounts.
I also have the ability to add dither in the same manner, random noise at up to 255.
I have tried to learn about noise shaping and dithering, etc, but frankly, at this low a sampling rate I am not sure what applies.
Here is an example where I take 1/3 of the quantization error and apply it to the next sample, or in the form of

audio(j+1)=audio(j+1)*.3*quanterror(j)

Imperial_1bit_30percentquantdist.wav

Obviously it doesn't sound very good. I have a lot of degrees of freedom for quantization error distribution, but frankly, I just can't figure out the right coefficients to use.

Here is my final example where I distribute the quantization error equally across the next 200 samples or:

k=1 to 200
audio(j+k)=audio(j+k)+quanterror(j)*(1/200)

imperial_1bit_quantdist200.wav

Here is what I would like to know. Given a frequency of f (in this case, f=7,061) how do I get the quantization noise to be more focused at a more inaudible frequency. I understand that at 7,061 the max frequency I have is 3,500 hz, but I know from looking at human ear frequency response curves that there is a dip at around 3,000 hz (if I understand it correctly) and I would like to "push" the quantization distortion to the frequency.

Anybody have any good ideas? Also, any thoughts on a different way to approach this would be great.

Thanks,

Chris



Go to the top of the page
+Quote Post
 
Start new topic
Replies
Canar
post Feb 27 2012, 19:41
Post #2





Group: Super Moderator
Posts: 3373
Joined: 26-July 02
From: To:
Member No.: 2796



Given what you're working with, that's quite fantastic! Bravo!


--------------------
You cannot ABX the rustling of jimmies.
No mouse? No problem.
Go to the top of the page
+Quote Post

Posts in this topic
- chjmartin2   Low Sampling Rate 1 Bit Audio Enhancement   Nov 25 2011, 05:26
- - Canar   QUOTE (chjmartin2 @ Nov 24 2011, 21:26) I...   Nov 25 2011, 06:09
- - chjmartin2   Ok - so where is it least sensitive then???   Nov 25 2011, 07:41
- - dhromed   At the edges of the spectrum. See Equal loudness ...   Nov 25 2011, 09:31
- - chjmartin2   So at a sampling rate of 7061 I am toast - unless ...   Nov 25 2011, 17:25
|- - 2Bdecided   QUOTE (chjmartin2 @ Nov 25 2011, 16:25) S...   Nov 25 2011, 19:04
- - [JAZ]   What you say remind me of what some old audio prog...   Nov 25 2011, 19:03
- - chjmartin2   For just playing back audio - I could use the 50,7...   Nov 25 2011, 20:28
|- - googlebot   Are you sure that binary on/off is your only optio...   Nov 25 2011, 23:31
|- - chjmartin2   QUOTE (googlebot @ Nov 25 2011, 17:31) Ar...   Nov 26 2011, 01:56
|- - knutinh   QUOTE (googlebot @ Nov 26 2011, 00:31) Ar...   Feb 28 2012, 11:19
|- - KMD   You need to dither the 16 bits down to 1 bit for a...   Feb 28 2012, 12:37
- - Canar   If you can actually run at 50.7kHz, that provides ...   Nov 26 2011, 17:00
- - chjmartin2   Ok, so, lets talk specifically about how to accomp...   Nov 26 2011, 17:19
- - benski   What if you were to convert to 50,700 Hz Direct St...   Nov 26 2011, 20:56
- - chjmartin2   I think that is a great idea - how would one conve...   Nov 27 2011, 00:24
- - chjmartin2   For those who were reading this thread. With some...   Feb 27 2012, 19:14
- - Canar   Given what you're working with, that's qui...   Feb 27 2012, 19:41


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

 



RSS Lo-Fi Version Time is now: 25th December 2014 - 03:37