Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.
|
|
|
|
Re: WAV file Export and Import
Posted:
Feb 21, 2010 4:23 AM
|
|
Dear Roger,
I sent the question to Wolfram Technical Support and got some useful help. Apparently there is some difficulty with SampledSoundList and a better approach is to use ListPlay as I give in the example below. This example works perfectly except that the waveform is rescaled to lie between -1 and +1 as it is exported. My suggestion is that there ought to be an option that allows the user to scale the value to whatever they wish but that if it is outside -1 to +1 then the data is clipped.
With regard to why I extract the data using g[[1,1,1]] try examining the input form of g as I do below. You will see that the data is held within a nested set of lists and functions. This is a standard way of extracting data when held in this form.
Hope that helps
Hugh Goyder
d = Table[8*Sin[100*2*Pi*t], {t, 0, 2. - 1./4000, 1./4000}];
Length[d]
ListPlot[d[[1 ;; 100]]]
d1 = ListPlay[d, SampleRate -> 4000]
Export["try1.wav", d1]
g = Import["try1.wav"]
ListPlot[g[[1, 1, 1]][[1 ;; 100]]]
g // InputForm // Short
On 19 Feb, 08:34, divisor <congruentialumina...@yahoo.com> wrote: > Hello Hugh: > > Did you figure this out? And why should [[1,1,1]] have the source > data? > > TIA. > > Roger Williams > Franklin Laboratory > > On Feb 2, 12:24 am, Hugh Goyder <h.g.d.goy...@cranfield.ac.uk> wrote: > > > > > I am trying toExportand ImportWAVfiles. Unfortunately, in the > > example below the file that Iexportbecomes garbled and is not the > > same when re - Imported. Am I doing something wrong? Is there a work > > around? You can tell from both the sound and the data that something > > is going wrong. The imported data is completely different to that > > which is generated initially. > > > Version 7 Windows > > > Thanks in advance > > > Hugh Goyder > > > d = Table[8*Sin[100*2*Pi*t], {t, 0, 2. - 1/4000., 1/4000.}]; > > > Length[d] > > > ListPlot[Take[d, {1, 100}]] > > > d1 = Sound[SampledSoundList[d, 4000]] > > > Export["try1.WAV", d1] > > > g = Import["try1.WAV", "SampleRate" -> 4000] > > > ListPlot[Take[g[[1, 1, 1]], {1, 100}], Joined -> False, > > PlotRange -> All]- Hide quoted text - > > - Show quoted text -
|
|
|
|