1

Using a two channel 10-bit A/D-converter, I took about 350k samples (one per 10 millisecond) from a device and saved it all in a textfile. Because of 10-bits, the numbers are all between 0-1023.

Now I want to visualize these two sources. Gnuplot is way too slow due to the large amount of data points, so I thought of converting the data to binary, and then import it as raw to Audacity (or process it using sox), but the end result is not what I expect.

Excerpt from the datafile:

360  594
367  596
375  594
382  595
389  594
396  593
404  594
412  594
418  596
426  594
433  596
441  594
448  630

Data-source #1 is the left column, data-source #2 is the right.

Quick-hack in Python to split and convert the datapoints to separate files:

import struct

f = open("new_data").readlines()
l = ([], [])

for line in f:
    a, b = line.split()
    l[0].append(int(a))
    l[1].append(int(b))

with open("new_1.raw", "wb") as file:
    for n in l[0]:
        file.write(struct.pack("i", n))

with open("new_2.raw", "wb") as file:
    for n in l[1]:
        file.write(struct.pack("i", n))

Launching Audacity and importing, I found only unsigned for 8-bit which was a bit confusing, since my numbers are 10-bit (or 16) and unsigned. Anyhow, I did two imports: unsigned 8-bit PCM and signed 16-bit PCM. The results are in the screenshot below.

enter image description here

The 8-bit had, ofcourse, damaged edges because of the bit-clipping, while the 16-bit looks way better. I can find out the period time of the sawtooth sample, and this is actually what I wanted to find out. However, I never managed to get this good import prior starting to write this question (because I only tried the 8-bit import), so this question is no longer a question, which is a pity given the time taken for me to write this.

5 minutes later

Now a question popped up. This is the first time I use Audacity, so; Since I want to investigate both datasamples, both imported into Audacity, how can I link both sample windows, making both scroll horizontally at the same time when I scroll either of them?

bos
  • 6,437
  • 3
  • 30
  • 46

0 Answers0