Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Sunday, 8 October 2017

Digital DI Box 03 - continuous data flow

Digital DI Box 03 - continuous data flow

Downsampling for better dataflow

Previously I concluded I will have to sample t 10KHz in order to keep up with the data flow. Right now I set the sampling rate at 7us - approximately 15KHz. The sound is not perfect (coming out of 10bit DAC) - mainly due to DAC noise and occasional ADC errors. And of course low sample rate makes higher frequencies sound poorly. Here is the graph of a youtube video passed through ATXmega controller and received in digital form at the same computer.

The red line is the actual signal, the blue line is the same signal averaged over 5 past values. The graph is autoscaled after reading roughly 250 samples from serial port every 100ms

Time problem

As usual the datasheet was near useless with timer setup. I had to guess the timer register TCC0 and I recon there will be more guessing on what is required to get the timer going. If I had a debugger I would probably able to figure it out. Oh well, I may need to google again.

Digital DI Box 02 - ADC

Digital DI Box 02 - ADC

ATXmega ADC

ATXmega32A4U has a 12bit ADC with the ability to perform up to 1M conversions per second. Since audio signal is signed, I will only get 11 bits, but with such fast rate I can oversample (I hope). Below is the initial buffered sample (approximately 1000 readings). Drawn in canvas, captured via serial port at 2Mbs Baud.

Due to the amount of data being transferred I could not send the bulk of data and at the same time perform the conversion. My calculations show that in order to send reasonable amount of data to put into more or less pleasant visible form will require at least 10us of CPU time. That means I will have to scan the ADC channel once in 10us. ATXmega datasheet is quiet about the ADC maximum clock (I assumed 2us, but at what CPU clock?). Anyway 2us supposed to give me almost 50KHz sampling rate. 10us for sending data over serial line will reduce the sampling rate down to 10KHz, unless I can oversample. This will have to wait, I need to get the continuous flow of data first - both for analysis purpose and to create a cool waveform on the computer screen :).

Thursday, 5 October 2017

Digital DI Box 01 - Intro

Digital DI Box 01 - Intro

What is DI Box

In Audio processing DI Box converts an unbalanced signal into balanced, to improve audio transfer on a longer distances. Normally this is done with a high quality transformer which inverts the incoming audio and sends it along side with t non-inverted original. This kind of devices are quite expensive.

Why Digital?

Since IC's these days are much cheaper than many analogue parts, I will attempt to create a Digital DI box. I will convert the unbalanced audio signal into bits, invert digitally and convert back to analogue. (Sending pure digital data will require complex protocols and proprietary hardware which defeats the purpose of the experiment). At the ogher end I will digitize both streams and combine back into unbalanced audio.

Plan

So far I will need the following:
  1. Practice with ADC on a relatively fast MC - e.g. ATXmega32A4U
  2. Establish high speed communication with the MC to ensure the data gets converted sufficiently
  3. Invert and convert to analogue digital audio
  4. Receive two audio streams simultaneously converting to digital
  5. Combine two signals into one and convert to analogue

Thursday, 14 September 2017

How to make your computer run faster

Slow computer has happened at least once in your lifetime. If you use Windows - may be much more than once. What you would usually do? Cleanup, uninstall unneeded programs, remove old data, defragment and finally full reinstall. So what new I can tell you here?

First thing first. The blog title is designed to be liked by search engines. It does not mean I will not tell you anything useful. It just means that I lured you here so you could click on my blog and maybe you will find an answer to your question. (BTW, the exact answer 'Can I make my computer run faster' is 'it depends', but not necessarily on things you usually hear from IT professionals.

I hope you are still interested. If so, let's begin.

On destiny and chaos

There is a popular belief that all computers of same kind (CPU, RAM, motherboard, etc) are created equal. But the experience shows that two identical computers, freshly imaged and plugged in, can display different performance from the very start of their useful lives. You can change cables, change peripherals, swap places - still one computer will give you trouble. Like a bad omen is hanging over it. Sometimes full reinstall helps. But often you just cannot fix it. Finding the root cause will waste your time and money, and there is no guaranty you will actually discover it at all. Sometimes this is a very hard to detect RAM malfunction or faulty PSU, or dodgy BIOS. To check all nodes of a complex system is just not worth it. The multitude of possible scenarios reduces your chance of success down to zero. And in that case there is no other option but to get a new computer. Right?

Not all operating systems are created equal

When I just started my job as IT support technician I had to make a network cable, because there was no available ones in stock. It was during the time when 100 base T was the top speed and Windows NT 4 was the most popular system at the enterprise level. Being completely ignorant of wiring standards I crimped the cable and connected it to the computer running Windows NT. To my amusement it started to complain about 'no carrier' being detected. Strange, I thought, my tester did not show any miswiring. I started Linux from a live CD on the same computer and the cable got detected, although only at 10 base T. This led to the series of discoveries. First of all, network cable is not just a bunch of wires, but also each pair of wires has it's own electrical properties which affect the way the signal propagates. Thus the network interface card can distinguish between correct and incorrect wiring by sensing the resistance of each pair. The second thing I noticed that different operating systems interpret the wiring properties in a different manner. Linux was more flexible and forgiving to my poor wiring skills.

Should you buy a new computer?

If defragmentation, re-installation and memory tests did not fix the problem, what else left to be done? If you are on a tight budget and it is hard to get a new computer, then you might want to either live with it (suffering from slow and unreliable service) or try installing a different OS.

The real question is: do you want to drastically change your computer experience? Because you will get other problems. But maybe you can tolerate those better then unproductive and erratic current system.

Is low level programming still relevant these days?

The levels of abstraction have made the application programming much easier and faster. But everything comes at a price. This is a new ...