From: Helen Read on
Has anyone succeeded in exporting sounds (as .wav) from v.6? The
documentation indicates that this is possible, but I could not find a
single example of how to actually do it.

As a simple example (I'm actually working with far more complicated
sounds), try this.

ding = SoundNote["F", 1, "Tinklebell"];

Sound[ding] brings up a GUI for playing the ding sound.

EmitSound[Sound[ding]] can be used to play the sound programatically.

But what is it that I'm supposed to export?

Export["ding.wav",ding] does not work,

nor does Export["ding.wav",Sound[ding]]

nor does Export["ding.wav",EmitSound[Sound[ding]]]
(I admit this last was a longshot, but I tried everything I could think of.)

Depending on whether I try to export the SoundNote itself, or the Sound,
or the EmitSound, I get error messages like:

First::normal: Nonatomic expression expected at position 1 in First[None].

Or:

Export::nodta: "Null contains no data that can be exported to the WAV
format."

Or:

Export::nodta: <<1>> contains no data that can be exported to the
WAV format."

So again, what is that I'm supposed to export?

--
Helen Read
University of Vermont

From: Hans Michel on
Helen:
Try
ding = SoundNote["F", 1, "Tinklebell"];
Export["C:\ding.mid", Sound[ding], "Sound"]

What tipped me off to the format was what is in the General Help File for
SoundNote.

"Style ... represents General MIDI instrument"

Now how to get MIDI sound to a Wave format?

There is an example Under Sound > EXAMPLES > Applications
data = SystemDialogInput["RecordSound"]

This opens a dialog box to record a sound. The Input is a Sound Driver but
then how do you record the ding which you would play in Mathematica?

There must be an easier way?

Note that "Wav" format is primarily a Windows audio format that plays in
Windows Media Player, but Windows Media Player can also play MIDI files.

There are some free introductory software that can read MIDI files

Like http://www.finalemusic.com/notepad/ (can it export to Wave?)

There are many that will convert MIDI to Wave.

Hans

"Helen Read" <hpr(a)together.net> wrote in message
news:fireum$s1h$1(a)smc.vnet.net...
> Has anyone succeeded in exporting sounds (as .wav) from v.6? The
> documentation indicates that this is possible, but I could not find a
> single example of how to actually do it.
>
> As a simple example (I'm actually working with far more complicated
> sounds), try this.
>
> ding = SoundNote["F", 1, "Tinklebell"];
>
> Sound[ding] brings up a GUI for playing the ding sound.
>
> EmitSound[Sound[ding]] can be used to play the sound programatically.
>
> But what is it that I'm supposed to export?
>
> Export["ding.wav",ding] does not work,
>
> nor does Export["ding.wav",Sound[ding]]
>
> nor does Export["ding.wav",EmitSound[Sound[ding]]]
> (I admit this last was a longshot, but I tried everything I could think
> of.)
>
> Depending on whether I try to export the SoundNote itself, or the Sound,
> or the EmitSound, I get error messages like:
>
> First::normal: Nonatomic expression expected at position 1 in First[None].
>
> Or:
>
> Export::nodta: "Null contains no data that can be exported to the WAV
> format."
>
> Or:
>
> Export::nodta: <<1>> contains no data that can be exported to the
> WAV format."
>
> So again, what is that I'm supposed to export?
>
> --
> Helen Read
> University of Vermont
>


From: Steve Luttrell on
This is an example of what you need to do:

Export[file,Sound[SampledSoundFunction[Sin[2\[Pi]
0.125#]&,5*440,8*440]],"WAV"]

This first generates a sampled sound, and then exports these samples in WAV
format.

Steve Luttrell
West Malvern, UK

"Helen Read" <hpr(a)together.net> wrote in message
news:fireum$s1h$1(a)smc.vnet.net...
> Has anyone succeeded in exporting sounds (as .wav) from v.6? The
> documentation indicates that this is possible, but I could not find a
> single example of how to actually do it.
>
> As a simple example (I'm actually working with far more complicated
> sounds), try this.
>
> ding = SoundNote["F", 1, "Tinklebell"];
>
> Sound[ding] brings up a GUI for playing the ding sound.
>
> EmitSound[Sound[ding]] can be used to play the sound programatically.
>
> But what is it that I'm supposed to export?
>
> Export["ding.wav",ding] does not work,
>
> nor does Export["ding.wav",Sound[ding]]
>
> nor does Export["ding.wav",EmitSound[Sound[ding]]]
> (I admit this last was a longshot, but I tried everything I could think
> of.)
>
> Depending on whether I try to export the SoundNote itself, or the Sound,
> or the EmitSound, I get error messages like:
>
> First::normal: Nonatomic expression expected at position 1 in First[None].
>
> Or:
>
> Export::nodta: "Null contains no data that can be exported to the WAV
> format."
>
> Or:
>
> Export::nodta: <<1>> contains no data that can be exported to the
> WAV format."
>
> So again, what is that I'm supposed to export?
>
> --
> Helen Read
> University of Vermont
>


From: dflatin on
On Dec 1, 6:01 am, Helen Read <h...(a)together.net> wrote:
> Has anyone succeeded in exporting sounds (as .wav) from v.6? The
> documentation indicates that this is possible, but I could not find a
> single example of how to actually do it.
>
> As a simple example (I'm actually working with far more complicated
> sounds), try this.
>
> ding = SoundNote["F", 1, "Tinklebell"];
>
> Sound[ding] brings up a GUI for playing the ding sound.
>
> EmitSound[Sound[ding]] can be used to play the sound programatically.
>
> But what is it that I'm supposed to export?
>
> Export["ding.wav",ding] does not work,
>
> nor does Export["ding.wav",Sound[ding]]
>
> nor does Export["ding.wav",EmitSound[Sound[ding]]]
> (I admit this last was a longshot, but I tried everything I could think of.)
>
> Depending on whether I try to export the SoundNote itself, or the Sound,
> or the EmitSound, I get error messages like:
>
> First::normal: Nonatomic expression expected at position 1 in First[None].
>
> Or:
>
> Export::nodta: "Null contains no data that can be exported to the WAV
> format."
>
> Or:
>
> Export::nodta: <<1>> contains no data that can be exported to the
> WAV format."
>
> So again, what is that I'm supposed to export?

For what it is worth, I successfully tried the example in the help
exporting to an AIFF file format:

s = Play[ Sin[4 (2 + Sin[1500 t]) t], {t, 0, 1}]
Export["sound.aif", s]

and

Export["sound24.aif", s, "AudioEncoding" -> "Integer24"]

$Version
"6.0 for Mac OS X PowerPC (32-bit) (June 19, 2007)"

-- Dan

From: Ingolf Dahl on
Helen,
The Mathematica Help is not very pedagogic in this issue, but there are two
types of sounds, represented by Mathematica, and they cannot mix. The
difference is analogous to the difference between raster graphics and
vectors graphics:

1. Waveform sound, type recorded sound or sound generated by
Play[(2 + Cos[20 t]) * Sin[3000 t + 2 Sin[50 t] ], {t, 0, 2}]
correspond to raster graphics.
Such sounds can be exported to WAV files without problems. They are sent to
the sound card as a stream of sampled voltage levels, and directly fed to a
DA converter. Reading was a problem with early versions of Mathematica,
since the reading was stopped as soon as a end-of-file sign was found, and
it is a plenty of such signs in these files.

2. Note-based sound of type
SoundNote["F", 1, "Tinklebell"]
is similar to vector graphics.
Here the sound is sent to the sound card as MIDI commands, which is just a
simple conversion of the Mathematica commands. The sound card uses the
built-in synth to produce the sound. If such sounds are to be exported from
Mathematica, .MID is the relevant file format.

For note-based sound Mathematica does not "know" what the waveform is, and
thus cannot translate the second type to the first. I guess that this
ability already is placed on the to-do list at Wolfram, but with low
priority. The simplest way to achieve the transformation is to hook-up two
computers, one playing the sound and the other recording. If you are more
clever, you might do the same trick with one computer. You could also find
(free or shareware) software on the net, doing the conversion inside the
computer. Maybe someone has written a Mathematica package? Search for
"software synth" or "mid2wav" to get started, and check also what Winamp can
do. To go in the other direction is trickier, but not completely impossible
(requires commercial software).

Best regards

Ingolf Dahl




> -----Original Message-----
> From: Helen Read [mailto:hpr(a)together.net]
> Sent: den 1 december 2007 11:48
> To: mathgroup(a)smc.vnet.net
> Subject: Exporting Sound
>
> Has anyone succeeded in exporting sounds (as .wav) from v.6?
> The documentation indicates that this is possible, but I
> could not find a single example of how to actually do it.
>
> As a simple example (I'm actually working with far more
> complicated sounds), try this.
>
> ding = SoundNote["F", 1, "Tinklebell"];
>
> Sound[ding] brings up a GUI for playing the ding sound.
>
> EmitSound[Sound[ding]] can be used to play the sound programatically.
>
> But what is it that I'm supposed to export?
>
> Export["ding.wav",ding] does not work,
>
> nor does Export["ding.wav",Sound[ding]]
>
> nor does Export["ding.wav",EmitSound[Sound[ding]]]
> (I admit this last was a longshot, but I tried everything I
> could think of.)
>
> Depending on whether I try to export the SoundNote itself, or
> the Sound, or the EmitSound, I get error messages like:
>
> First::normal: Nonatomic expression expected at position 1 in
> First[None].
>
> Or:
>
> Export::nodta: "Null contains no data that can be exported to
> the WAV format."
>
> Or:
>
> Export::nodta: <<1>> contains no data that can be exported to
> the WAV format."
>
> So again, what is that I'm supposed to export?
>
> --
> Helen Read
> University of Vermont
>
>