Sine wave generator ?

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Simon Knight
Posts: 854
Joined: Wed Nov 04, 2009 11:41 am
Location: Gunthorpe, North Lincs, UK

Sine wave generator ?

Post by Simon Knight » Sun Jan 09, 2022 11:11 am

Hi,

One of my hi fi speakers is distorting at certain frequencies and looking at the web it is suggested that a tone generator may be useful in identifying where the distortion is originating. My first thought was to write a tone generator using Livecode but having searched the dictionary I can not find any method of generating a given tone on the fly. Livecode appears to have the commands as part of the Beep commands but they do not work on desktop. Have I missed something obvious ?

This is what I would like to create : https://onlinetonegenerator.com/. It seems a pity that that it is possible in html but not in Livecode. Any thoughts?

best wishes

Simon
best wishes
Skids

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9645
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Sine wave generator ?

Post by dunbarx » Sun Jan 09, 2022 5:26 pm

The beep command is far to granular to generate a tone. You have to import a sound file and play it.

Craig

stam
Posts: 2679
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Sine wave generator ?

Post by stam » Mon Jan 10, 2022 6:54 pm

dunbarx wrote:
Sun Jan 09, 2022 5:26 pm
The beep command is far to granular to generate a tone. You have to import a sound file and play it.

Craig
Or would a MIDI library be able to generate it? (thinking of the example with sine/square/triangular etc -- should all be doable with MIDI?)

It's outside of my comfort zone, but i know Paul McClernan has created a MIDI library and shared on github - https://github.com/PaulMcClernan/OpenXT ... e-CoreMIDI

As the link suggests however, this is pretty much MacOS only - but hopefully that helps?
Stam

PaulDaMacMan
Posts: 626
Joined: Wed Apr 24, 2013 4:53 pm
Contact:

Re: Sine wave generator ?

Post by PaulDaMacMan » Thu Nov 02, 2023 1:57 am

Simon Knight wrote:
Sun Jan 09, 2022 11:11 am
Hi,

One of my hi fi speakers is distorting at certain frequencies and looking at the web it is suggested that a tone generator may be useful in identifying where the distortion is originating. My first thought was to write a tone generator using Livecode but having searched the dictionary I can not find any method of generating a given tone on the fly. Livecode appears to have the commands as part of the Beep commands but they do not work on desktop. Have I missed something obvious ?

This is what I would like to create : https://onlinetonegenerator.com/. It seems a pity that that it is possible in html but not in Livecode. Any thoughts?

best wishes

Simon
Sorry, missed this (a year and a half ago)
You'd probably not want to use the CoreMIDI extension, since that only does MIDI data, which is NOT sound, it's musical performance data.
To output sound while adjusting pitches on a microtonal level, on Mac for this I would say use my other extensions like AVAUnamplerIntrument library along with a sine wave sample, on Windows or Linux the only thing I've worked on is a FluidSynth wrapper, which IIRC could similarly be used with a sine wave with microtonal adjustments.

https://github.com/PaulMcClernan/OpenXT ... dioSampler
https://github.com/PaulMcClernan/OpenXT ... Instrument
https://github.com/PaulMcClernan/OpenXT ... MidiPlayer
https://github.com/PaulMcClernan/OpenXTalk-FluidSynth
My GitHub Repos: https://github.com/PaulMcClernan/
Related YouTube Videos: PlayList

Post Reply

Return to “Talking LiveCode”