Recent

Author Topic: Tone generator  (Read 852 times)

julz57

  • Newbie
  • Posts: 5
Tone generator
« on: October 09, 2022, 10:36:15 pm »
Hi,

I’ve searched the forum for code for a simple audio tone generator but came up blank. My need is for a cross platform solution which allows generations of tones of specific frequency. I want to use it for subject testing of audio discrimination between two presented pure tones. Ie, are these the same or different. So ideally I need to specify duration as well. I only need to present a single tone at a time. So no complex mixing.

It’s one of a battery of tests. All the others are easy to code; well spaghetti code in my case.

I need it to be cross platform as I want it to be under public domain licence once complete with anyone able to use and access the testing battery. So Windows, macOS and Linux releases.

I’d even be happy to load a pure tone  .wav file and do frequency shifts if that’s easier.

Thanks in advance

Bart

  • Hero Member
  • *****
  • Posts: 5290
    • Bart en Mariska's Webstek
Re: Tone generator
« Reply #1 on: October 09, 2022, 11:18:22 pm »
Maybe Uos?
Quote
Produce sound with built-in synthesizer.

Bart

Fred vS

  • Hero Member
  • *****
  • Posts: 3168
    • StrumPract is the musicians best friend
Re: Tone generator
« Reply #2 on: October 09, 2022, 11:27:54 pm »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

julz57

  • Newbie
  • Posts: 5
Re: Tone generator
« Reply #3 on: October 09, 2022, 11:35:20 pm »
Thanks.

Yes I had read about this but it seemed like a very complex solution.

I was after a KISS solution.

But probably not possible. lol

jamie

  • Hero Member
  • *****
  • Posts: 6133
Re: Tone generator
« Reply #4 on: October 09, 2022, 11:51:09 pm »
In windows its a simple matter of using the PlaySound function where you can specify a WAV file or just a tone.

but in other OSes, I don't see that simple option however, I do See the ACS package claims to be cross platform
and its graphical with loads of goodies.

  Using lazarus you should be able to use the Online package tool to download and install it.

 
The only true wisdom is knowing you know nothing

Fred vS

  • Hero Member
  • *****
  • Posts: 3168
    • StrumPract is the musicians best friend
Re: Tone generator
« Reply #5 on: October 10, 2022, 12:16:43 am »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

wp

  • Hero Member
  • *****
  • Posts: 11916
Re: Tone generator
« Reply #6 on: October 10, 2022, 01:19:23 am »
I once wrote the attached stand-alone wav writer for sine, triangular and rectangular waves. Tested on Windows, but since it does not contain platform-specific code, it should work on other widgetset as well.

julz57

  • Newbie
  • Posts: 5
Re: Tone generator
« Reply #7 on: October 10, 2022, 02:52:08 am »
Thank you to all who have responded. The auditory component is a big part of what I need to do. I’ll have to try and get my head around how to best implement what needs to be done.

Time to put my thinking cap back on.

Cheers

Julz57

 

TinyPortal © 2005-2018