# Recording square waves at sample frequency

For a project I am working on, I need to incorporate GPS data into an audio file. As things currently are, the easiest way for me is to record the audio in a multi-channel .wav file, and add the GPS data as a square wave in a separate channel.

GPS data will be binary, i.e. either an arbitrary high or low signal for an arbitrary time period. I do not need to reconstruct an analog value.

My question is: at which frequency will I be able to faithfully record a square wave, >= Nyquist frequency or >= the sampling frequency?

Edit: elaborating on the setup I have in mind

I am preparing a series of binaural recordings of me walking around town in hours nobody is around. A modified headphone will act as two separate microphones, going into two separate channels of a handheld recorder.

I will use my cellphone as a GPS device. My idea is to translate that GPS data into a series of pulses and output it to the phones' jack, which I then will connect to the handheld recorder. I prefer to have this data on a separate audio channel, because I like to keep the recorded audio as clean as possible, and because extracting data embedded in audio channels is beyond my capabilities at the moment.

This is what I came up with (note: this is a mock-up)

As both encoding and decoding the GPS data is going to be a custom job, i have a lot of liberty in writing the 'protocol'.

Again, what is the fastest rate at which i could toggle the data signal? Is it the sampling frequency of the audio file, because I am only interested in a binary representation? Or am I missing something very obvious? Bear in mind, this is my first step in signal processing.

• What is the minimum time period between edges of the GPS waveform? – John Jul 7 '14 at 15:34
• Whatever I want it to be – Tom Jul 7 '14 at 15:38
• Well I would set that minimum period to something a little longer than 6 times the sampling interval, so that you can capture the third harmonic of an alternating sequence. – John Jul 7 '14 at 16:14
• "I need to incorporate GPS data into an audio file". Is the data going to be embedded digitally or recorded from an analog signal? How is the data going to be decoded? – pichenettes Jul 7 '14 at 19:15
• What is the finality of this? Just having the GPS data nicely synchronized with the audio? What about this: 1/ configure your audio recorder to record a real-time timestamp with the audio (it can probably do this, check if it supports broadcast wave format - BWF). 2/ use an off-the-shelf GPS logger app on your smartphone. 3/ Merge the two datasets, so that you can align the GPS data with the timeline of your audio file. 4/ If necessary, export the result as markers for the .wav file – pichenettes Jul 8 '14 at 0:25