Convert time series data to sound

I have a file containing a series of double precision floating point values, normalized between [0,1]. They are each separated by a carriage return (or any delimiter, if necessary). I’d like to convert this data into a sound file of any format, where each value is played for a given duration of time (say, 1 sec), and the magnitude of the value is the pitch of the sound played. In regards to the wave format for each quanta of sound, anything will do, however I’d like to eventually choose a particular wave, and use this. An alternative would be to convert this data to MIDI format, and play it, but I’d like to have more control over it. Any suggestions would be great. Note that this post is similar to the request given here

Thanks, Ben

After playing a bit today, I decided to use Matlab to do sound data creation, as the original time series is created with it. I created a 2-column vector (left and right channel, respectively) of the data, and using the wavwrite command, outputted to a wav file at a given frequency and bit-rate. I then brought this into Audacity to further process it. A code is below, which creates some data, and then performs these operations, for those interested:

%% musicode
%% Ben Jordan

%% Constants
% standard pitch scales and ratio
a4am=440; % Hz, A4 American Standard Pitch
a4in=435; % Hz, A4 International Standard Pitch
c4jt=256; % Hz, C4 Just Intonation
a1=55; % Hz, A1

fac=2^(1/12); % ratio between two successive pitches

Fs=8000; % Hz, sampling rate
T=1/Fs; % Sampling period
b=16; % b-bit sound
noct=1; % number of octaves to span
nstp=12; % number of steps in each octave

vfl=[]; % vector for left sound data
vfr=[]; % vector for right sound data

%% Generate the vector of sound info
% starting with a1=55 Hz, make vectors of pitch 1 second long

pt=a1; %starting pitch
x=linspace(0,1,Fs); % vector of sample points

for oct=1:1:noct
for st=1:1:nstp
pt=pt*fac; % go up by 1 step each iteration

%% Effects

vfr=wrev(vfr); %reverse the right channel

vf=cat(2,vfl,vfr); %make two channels into stereo 2-column vector

vf=vf*.9999; % scale to avoid truncation at 1 and -1

%% Process
plot(vfr); % plot the sound wave
title(‘Left channel’);
plot(vfl); % plot the sound wave
title(‘Right channel’);

%% Save to file

You could generate the sound relatively easily using Audacity’s built in “Nyquist” language.

To read the file:

(setq fp (open "test.dat" :direction :input))

(read fp)

where “test.dat” is the file containing the data).

To generate the tone:

(hzosc hz table phase)

To iteratively evaluate the new sound (beh) and add them in a sequence:

(seqrep (var limit) beh)