Save Noteplayer output to a sound file?

I made a small XOJO app to convert text into Morse Code, and then use the Noteplayer to output the audio tones. I was wondering if there is any way to save the Noteplayer output to a sound file.

If you mean the text itself to sound file, then I too have been looking in the same direction for a long time, but it seems that without plugins it cannot be done. But even in this case I think one has got to generate a MIDI sequence. At least on the Mac.

But if you want to save the sound output of your app, than QuickTime and other apps can do it; but to my ears, the effect is a disaster since such apps (rightly) record also any other sound/noise in the room (I guess the internal microphone picks up the sound generated by the speakers + room-noise).
I may be wrong, but I think Windows has got a way to save sounds to sound/audio.file before they reach the speakers.

Thanks. I suspected there wouldn’t be anything straightforward. I may play around with Audacity a bit, and see if it can capture audio from another application.

Can’t you capture the output of your Mac with SoundFlower?

Yes, now that you’ve told me about it. :slight_smile:

A long while ago I was playing with “on-the"fly” tone generation, and WAV file generation seemed to be the way to go. You can find some good information on this post:
For the actual WAV file creation I adapted something Will Shank provided (

Thanks. I’ll keep Will’s code for future reference, I’d never thought of generating the wav file directly. That will come in handy.

The NotePlayer works well enough for what I’m doing at the moment, and SoundFlower is capturing the audio to a file. I’m running this on a Mac which doesn’t appear to have the problems that Windows does with NotePlayer. If I need to make this thing any fancier, I’ll try generating the wav file directly.

BTW, if anyone needs to convert from frequency in Hz to the pitch value used by NotePlayer, I came up with this formula:
Pitch as Integer = 0.5+256*(Log(freqHz) *17.3123404906675-36.3763165622957)

This one allows for fractional steps, but it still has to round to the closest value that can be expresses by a 16 bit number. For the other pitch format in the range 0…127, replace the factor of 256 with 1.