From: Szabolcs Horvát on
Helen Read 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?

SoundNotes cannot be exported to WAV. Export to MIDI instead. The WAV
file can contain any kind of waveform, while the MIDI file contains the
sequence of notes to be played back. (The MIDI will sound different
depending on the equipment used for playback.)

--
Szabolcs

From: Jerry on
Sir, thanks for your tip on recording a midi file.

Funny though, when I use

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

Sound[ding]

I play it in V6 and I hear the note.
Then I record it to a file as you suggest:

Export["ding.mid", Sound[ding], "Sound"]

I then double click ding.mid in the directory where it was
placed and I get MediaPlayer and I hear a sound. But, it's
clearly not the same sound. It's the same length and type
but it's at a higher frequency. Any idea why?

Thanks

Hans Michel wrote:
> 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: Szabolcs Horvát on
Jerry wrote:
> Sir, thanks for your tip on recording a midi file.
>
> Funny though, when I use
>
> ding = SoundNote["F", 1, "Tinklebell"];
>
> Sound[ding]
>
> I play it in V6 and I hear the note.
> Then I record it to a file as you suggest:
>
> Export["ding.mid", Sound[ding], "Sound"]
>
> I then double click ding.mid in the directory where it was
> placed and I get MediaPlayer and I hear a sound. But, it's
> clearly not the same sound. It's the same length and type
> but it's at a higher frequency. Any idea why?
>

I think that Java has its own built-in synthesizer (it does not use the
one in Windows), and Mathematica plays MIDI through Java. So a
difference is expected, but you are right that the difference in this
case is striking.

--
Szabolcs

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

Thanks to everyone who suggested exporting to .mid. Unfortunately,
though, this doesn't compltely help. The sounds I'm working with are a
combination of sounds generated from SoundNote and sounds imported from
..wav files. EmitSound doesn't have any trouble with these combined
sounds, but it seems impossible to export them. So unless I can convert
the SoundNote (midi) sound into some other format, I'm kind of stuck,
since it's not possible to go the other way and convert the .wav into midi.

> 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?

Yeah, that's my question. I don't see how to get this to work. I could
not get the example in the documentation to work, let alone anything else.

> There must be an easier way?

What I finally ended up doing was to play my sounds with EmitSound in
Mathematica, and record them on a handheld digital audio recorder (which
I have anyway, for purposes of recording the various music groups that I
play in), then upload from my audio recorder to my computer, and save it
as one big happy .wav or .mp3. This did work, but was kind of a clunky
way to do it. I'd be happier if I had a direct way to convert from
SoundNote / midi into .wav (or other non-midi format) from within
Mathematica.

--
Helen Read
University of Vermont

From: Helen Read on
I wrote:

> Thanks to everyone who suggested exporting [sounds generated by
> SoundNote] to .mid. Unfortunately, though, this doesn't compltely
> help. The sounds I'm working with are a combination of sounds
> generated from SoundNote and sounds imported from .wav files.
> EmitSound doesn't have any trouble with these combined sounds, but it
> seems impossible to export them.
>
> What I finally ended up doing was to play my sounds with EmitSound in
> Mathematica, and record them on a handheld digital audio recorder (which
> I have anyway, for purposes of recording the various music groups that I
> play in), then upload from my audio recorder to my computer, and save it
> as one big happy .wav or .mp3.

OK, I just found a somewhat better way to do this. The audio editing
software that I use in conjunction with my audio recorder, Acoustica,
doesn't support midi, at least not directly. However, it can record
directly off the computer's sound card. So, I started it recording,
played my sounds (combining SoundNote / midi with WAV) with EmitSound
from within Mathematica, and voila, I have a sound I can save from
Acoustica as a .wav or .mp3 or .au.

Still:

> I'd be happier if I had a direct way to convert from SoundNote / midi
> into .wav (or other non-midi format) from within Mathematica.

--
Helen Read
University of Vermont