importing from excel or text

Suppose I have a list of values generated in Excel. Example, sine wave at nyquist frequency at full amplitude (0,1,0,-1,0) How do I import it into Audacity? The actual list is of course much more complicated, and I’m not sure how to use the Nyquist Prompt to create the sound…that’s why I’m using Excel.

Thanks in advance!

Yowza, that’s quite a task. Unfortunately, Audacity isn’t going to be able to import an Excel file. Audacity can import raw data, but I’m not sure if you’ll be able to export the signal from Excel in a format that Audacity could easily read (I may be wrong though, I’m no Excel expert).

I can write samples in directly using a Hex editor. For instance the string “00ff00ff00ff00ff00ff00ff00ff00” when written into a Hex editor (not a text editor) and imported into Audacity as an unsigned 8-bit mono file will give me a 22.05 KHz sine (actually triangle) wave.

The problem with using a basic text file is that it’s encoded as ASCII characters, not as Hex values. You need a way to convert a list of ASCII chars into Hex values and I don’t know how to do that. It might be possible that Excel can do that, but I don’t know.

You best bet might be to PM either RichardAsh1981 or GailAndrews and see if they can help you out.

Audacity can import raw binary files, OK (though auto format can not work on nyquist-type sine signal :-), use nice sin first !).
Conversion can be done in any programing language. Well, just command prompt would be enough…

For example on Unix, I write

  echo 1234567 >> sample      
  bc prog < sample | bash > out

prog is the attached bc-program,
sample is an ascii file with numbers, ended with 1234567
out is the output file (I can check by od -t x1 out, what is inside the file)

On windows, I install CygWin ( → find Setup, RunIt), I make sure I have ‘bc’ installed (it might be in the small basic set or not)
(I install perl (if a lot of disk space) and chere , too :slight_smile: ), do cd /cygdrive/c/yourdirectory and do the same as on unix.
You might change big/little endian by exchangeing a and b on the print line.

If you would have some perl.exe, it could done similarly

Did not see attachment???, lets put it here

# input: a sequence of numbers on lines,
# each representing a 16bit sample
# each between -32777 and +32768 or
# each between 0 and 65535


define report_error_over(n) {
    # we don't know this
    # let's write something to the output and
    # skip the rest of the file
    # assume bash reads the output
    print "echo  THERE WAS AN OVERFLOW ERROR, ", n," is too large       >2n"
    obase=16 # for sure
    while (1) {
          n = read()
          if (n == 1234567) { halt }
while(1) {
  n = read()
  if (n == 1234567) { halt }
  if (n >= sixteen) { n = sixteen-1; report_error_over(n) }
  if (n < -fifteen ) { n = 0; report_error_over(n) }
  if (n < 0) { n += sixteen }
  print "printf 'x'", a, "'x'", b, "n"