MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: WAV file Export and Import

  • To: mathgroup at smc.vnet.net
  • Subject: [mg107638] Re: WAV file Export and Import
  • From: Hugh Goyder <h.g.d.goyder at cranfield.ac.uk>
  • Date: Sun, 21 Feb 2010 04:23:38 -0500 (EST)
  • References: <hk8nff$8a4$1@smc.vnet.net> <hllif3$rh$1@smc.vnet.net>

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... at 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... at 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 -



  • Prev by Date: Re: Re: Re: Arctangent approximation
  • Next by Date: Re: Re: A few newbie questions
  • Previous by thread: Re: WAV file Export and Import
  • Next by thread: Normality test