Page 1 of 1

import csv, generate histogram, export .wav or mp3 file

Posted: Mon May 10, 2010 3:19 am
by doughnut99
Hi

I would like to be able to create .wav or .mp3 sound files from an xy plot or histogram so that I can view sensor data alongside videos taken of the event where the sensor data was collected. Sensors I use are accelerometers and gyroscopes but the sensors could be any sensor that generates an analogue signal that is then read by an analogue to digital converter.

Generally the sensor data files are simple text files, often in CSV format with teh following format:
row 0 - Possibly a header file with variable names - this row could be manually deleted if this is easier but if present then typically in this format
sample number, accelerometer X, accelerometer Y, accelerometer Z, Gyro X, Gyro Y, Gyro Z, Aaaaa X, Aaaaa Y, Aaaaa Z
row 1 - 1001, 512, 512, 512, 512, 512, 512, 512, 512, 512 = Object at rest & sensors showing zero mid point value using 10 bit ADC, range 0-1023
row 2 - 1002, 396, 640, 500, ........ = Object moving & sensors showing sensed movement
.
.
.
.
row 32694 - 33694, 1023, 480, 0, ......... = Object still moving

I don't know much about sound files but I suspect that some additional information is required such as:
a) Samle rate - lets say 10Hzt (10 samples = 1 second) but this could be any reasonable integer, alternatively this could be a time value
b) Range - in this case 0 to 1023 as a 10 bit ADC used but could realistically be anything from around 8 bits (0-255) to 22 bits (ADC conversions beyond 22 bits start to strike resolution versus noise issues that usually make anything beyond 22 bits impractical). The range could be fixed if this is easier and it would be the users responsibility to normalise the data to fit the expected range.
c) Perhaps the mid-point if sound files require a zero mid-point, in this case I have simplistically stated the mid-point at 512, this is rarely the case for raw sensor data as there are always offset biases and errors but again either the user can be responsible for accounting for these biases and errors during pre-processing or the sound file gets generated from the uncorrected raw data.

Then take each column of data at a time (e.g. Accelerometer X - 512, 396, .....1023) and turn this into a single channel of sound in either .wav or .mp3 format.
Repeat for each channel.

Is this currently possible with XnView?

If not currently possible could it be done reasonably easily?

Is there a known better way of doing this?

Many thanks Doug

Re: import csv, generate histogram, export .wav or mp3 file

Posted: Mon May 10, 2010 1:00 pm
by JohnFredC
Hi Doug...

XnView is primarily a graphics/image application.

Try googling for "image sound synthesis". Perhaps something in the search results can get you started.

Here's one, for instance: PhotoSounder