Importing text as audio/exporting audio as text

This section is now closed.

Audacity 1.3.x is now obsolete. Please use the current Audacity 2.1.x version.

The final version of Audacity for Windows 98/ME is the legacy 2.0.0 version.

Importing text as audio/exporting audio as text

Permanent link to this post Posted by Roquentin » Thu Nov 24, 2011 2:42 pm

Looking through the general and Nyquist threads, I didn't see anything about this.

I'm generating series of random bits and storing them in an Excel spreadsheet (in the form of 20-place decimals ranging from -1 to 1). I'd like to be able to import them into Audacity in order to run spectral analysis and all the other cool stuff Audacity can do on them.

Likewise, I've been recording white noise from a synthesizer and running analysis on the noise in Audacity. I'd like to be able to export the audio in the format of decimals from -1 to 1, so I can import them into Excel and run numbers on them there.

Has anyone done anything like this?
Roquentin
 
Posts: 18
Joined: Sat May 01, 2010 5:29 pm
Operating System: Windows 10

Re: Importing text as audio/exporting audio as text

Permanent link to this post Posted by steve » Thu Nov 24, 2011 6:05 pm

Roquentin wrote:I'm generating series of random bits and storing them in an Excel spreadsheet (in the form of 20-place decimals ranging from -1 to 1). I'd like to be able to import them into Audacity in order to run spectral analysis and all the other cool stuff Audacity can do on them.

If you can convert the spreadsheet into raw data then you can use Import Raw.
Alternatively it would be possible to write a Nyquist script to read data from a text file. A plain text space separated list would be the easiest format to handle.

Roquentin wrote: I'd like to be able to export the audio in the format of decimals from -1 to 1, so I can import them into Excel and run numbers on them there.

This topic may be of interest viewtopic.php?f=42&t=34365
Note that the "latest version" of the plug-in in that topic is only an interface and not functional. I think this was the last functional version: download/file.php?id=1667
If you think this may be useful I may be encouraged to complete a "release version". ;)

[Update:] Audacity now ships with "Sample Data Export"
Last edited by steve on Fri Apr 24, 2015 3:50 pm, edited 2 times in total.
Reason: [Update:] Audacity now ships with "Sample Data Export"
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 45060
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Importing text as audio/exporting audio as text

Permanent link to this post Posted by Gale Andrews » Tue Mar 05, 2013 9:02 pm

Someone was asking about these two issues today on [email protected], so may write here.

I have a question too. Sample Data Export doesn't "seem" to produce any output that Audacity could accept as Raw Data. If this is true, is it an enhancement that would be useful?


Gale
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual
Gale Andrews
Quality Assurance
 
Posts: 26093
Joined: Fri Jul 27, 2007 12:02 am
Operating System: Windows 10

Re: Importing text as audio/exporting audio as text

Permanent link to this post Posted by Robert J. H. » Tue Mar 05, 2013 11:05 pm

Nyquist can export the numbers in a txt format or as bytes, ie.e. a binary file.
But I fail to see the advantage in this (over and ordinary audio file) unless it is for a totally different file format (e.g. midi to text and vice-versa).
I can't think of a concrete application of a pure data export unless the right header for a special program as a conversion plug-in is provided too.
Can one enlighten me on this?
Robert J. H.
 
Posts: 1813
Joined: Thu May 31, 2012 8:33 am
Operating System: Windows 7

Re: Importing text as audio/exporting audio as text

Permanent link to this post Posted by Gale Andrews » Wed Mar 06, 2013 12:39 am

I think the idea is to manipulate the data from Sample Data Export mathematically (for example in Matlab or even Excel) and then import it back into Audacity to see what it looks like as a waveform.


Gale
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual
Gale Andrews
Quality Assurance
 
Posts: 26093
Joined: Fri Jul 27, 2007 12:02 am
Operating System: Windows 10

Re: Importing text as audio/exporting audio as text

Permanent link to this post Posted by Robert J. H. » Wed Mar 06, 2013 6:26 am

That's quite clear so far, but I am not aware of a application that makes use of RAW data.
There are some situations imaginable though. But in most cases, a file header is needed anyway, I guess.
Either way, exporting normal sample data won't be much asked for (other than text or audio files). However, FFT streams, impulse responses vor convolution reververators, weird multi channel formats and so on are thinkable. But those demand some sample treatment in the first place and eventually specialized plug-ins (which are not written yet...).
Robert J. H.
 
Posts: 1813
Joined: Thu May 31, 2012 8:33 am
Operating System: Windows 7

Re: Importing text as audio/exporting audio as text

Permanent link to this post Posted by steve » Wed Mar 06, 2013 9:49 am

I see we are resurrecting an ancient topic.
I wrote some experimental code for importing text data that had been previously exported with "Sample Data Export" (in the Analyze menu). I think that this could be useful (though definitely of minority interest) for things like Gale's case:
Gale Andrews wrote:... to manipulate the data from Sample Data Export mathematically (for example in Matlab or even Excel) and then import it back into Audacity to see what it looks like as a waveform.


This can be done with sensible results because the text file is in a known format. The downside is that importing a large amount of text tends to be very slow and memory hungry. I managed to get this working reasonably well as a proof of concept by treating the file as an "object" which allowed much faster looping through lines of data (about 50 times faster than a standard LISP loop). However, Object Orientated Programming in Nyquist, though possible, is not nice, so this code is somewhere on the back shelf. If there is interest I can dig it out again.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 45060
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Importing text as audio/exporting audio as text

Permanent link to this post Posted by JimMyskin » Wed Mar 06, 2013 5:21 pm

Hi,

This is Jim, the person to whom Gale refers from the @feedback, above.

I am looking to do with Audacity that which I used to do with Matlab:

I could record a .WAV file, import it, manipulate it, then export it.

More importantly, I could generate a matrix (wave data), export it, use CoolEditPro to add effects, export that as a .CSV file and study the result in Matlab.

Thsi was useful in background analysis and has many applications.


What I trying to do now is much simpler: I have a sampler that imports wave data from CD quality down to 8 kHz mono.

I wish to generate waveform data in Excel, export it a CSV, import it to Audacity and hear the results before moving the file into the sampler.

I am able to generate tone data in audaicty and export to csv to open in Excel, and I get the results I expect.

After I manipulate the numbers in Excel, how do I get the .CSV data back into audacity.

To keep things as simple as possible, I have created 1 second of a 440 Hz tone at 44.1 kHz exporting linear (+/- .9).
I get 44,100 values ranging from -0.9 to +0.9 in the .CSV file when I open it in Excel.
When I graph the resulting wave, it is indeed a sine wave (with 0.0013% distortion, according to my macro).
I then scale it to +/- .5, and write the result back to a .CSV file with the same header information as the original "sample-data.csv" file.

Using Audacity 2.0.3 on Win7, Under File -> Import -> Raw Data ... what settings do I use to recover the wavform into audacity and hear the same sine wave previously exported?

Sorry for re-writing "War and Peace" to the forum but I hate to give you as much information as possible.

Thank you so very much in advance,

Jim
JimMyskin
 
Posts: 4
Joined: Wed Mar 06, 2013 3:42 pm
Operating System: Please select

Re: Importing text as audio/exporting audio as text

Permanent link to this post Posted by Robert J. H. » Wed Mar 06, 2013 5:58 pm

Sounds very interesting.
It would be nice if we could come up with a definite project.
For example, we could export FFT frames such that they could displayed in Excel as a 3D surface diagram (a speech finger print).
It hasn't to be Excel of course, there are a lot of open source programs that could be used for those fancy applications.
One could - as another example - display long term heart beat recordings in a 3D cube with POVRAY. The visuall deviation of single branches is an indicator for irregularities and corresponding risks of heart failure.
Robert J. H.
 
Posts: 1813
Joined: Thu May 31, 2012 8:33 am
Operating System: Windows 7

Re: Importing text as audio/exporting audio as text

Permanent link to this post Posted by JimMyskin » Wed Mar 06, 2013 6:27 pm

Hi Robert J. H.

A definite project would be nice.

How about some import settings for now (specifically Encoding and Byte Order)?

Thanks again,

Jim
JimMyskin
 
Posts: 4
Joined: Wed Mar 06, 2013 3:42 pm
Operating System: Please select

Next

Return to Windows



Who is online

Users browsing this forum: Bing [Bot] and 9 guests