Just starting out? Need help? Post your questions and find answers here.
SPH
Enthusiast
Posts: 566 Joined: Tue Jan 04, 2011 6:21 pm
Post
by SPH » Sun Jun 01, 2025 2:24 pm
Hi,
Can we create a musical note using mathematical calculations?
If not, can we convert them to Data?
Do you have an example?
Thanks
PS: I would like to put the program and the sound in a single EXE.
!i!i!i!i!i!i!i!i!i!
!i!i!i!i!i!i!
!i!i!i!
//// Informations ////
Portable LENOVO ideapad 110-17ACL 64 bits
Version de PB : 6.12LTS - 64 bits
NicTheQuick
Addict
Posts: 1517 Joined: Sun Jun 22, 2003 7:43 pm
Location: Germany, Saarbrücken
Contact:
Post
by NicTheQuick » Sun Jun 01, 2025 3:16 pm
Do you wanna render a note graphically or do you wanna make a sound using mathematical functions, like for example a simple sine wave?
For rendering notes you can use a free font like this one:
https://github.com/MuseScoreFonts/Leland
For creating a sine wave, just use `Sin()` a create an array of as many samples you need in the right frequency. Here's a simple example:
Code: Select all
EnableExplicit
Define seconds.f = 1
Define frequency.f = 1234
Define samplerate.i = 44100
Define samples = samplerate * seconds
Dim samples.f(samples - 1)
Define sample.i, time.f
For sample = 0 To samples - 1
time = sample / samplerate
samples(sample) = Sin(time * frequency)
Next
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
AZJIO
Addict
Posts: 2183 Joined: Sun May 14, 2017 1:48 am
Post
by AZJIO » Sun Jun 01, 2025 3:54 pm
SPH
Enthusiast
Posts: 566 Joined: Tue Jan 04, 2011 6:21 pm
Post
by SPH » Sun Jun 01, 2025 8:58 pm
I would like to create simple "BLIIING"
Thank you for your answers...
!i!i!i!i!i!i!i!i!i!
!i!i!i!i!i!i!
!i!i!i!
//// Informations ////
Portable LENOVO ideapad 110-17ACL 64 bits
Version de PB : 6.12LTS - 64 bits
idle
Always Here
Posts: 5888 Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand
Post
by idle » Sun Jun 01, 2025 10:27 pm
Pb supports mod sounds natively. I'm sure a Google search will turn up a trove of free retro mod sounds.
There's also ym and sndc player if you want Amiga like sounds in addition to mod xm sounds but they require a dll. For the chip emulator.
Or you can use PBSpotFX by Demivec compile with x86 ASM backend
https://atomicwebserver.com/PBSpotFX.zip
SPH
Enthusiast
Posts: 566 Joined: Tue Jan 04, 2011 6:21 pm
Post
by SPH » Mon Jun 02, 2025 8:44 am
I know MODs; I have Mod Anthology (the complete Amiga series).
I'm not looking for music, but sound effects like stones colliding and the like.
Above all, remember one thing: I want to put them as data in my exe so that my program fits in a single exe.
Or, if you know how to put WAV sound effects as data, I'd love some PB code.
Thanks.
!i!i!i!i!i!i!i!i!i!
!i!i!i!i!i!i!
!i!i!i!
//// Informations ////
Portable LENOVO ideapad 110-17ACL 64 bits
Version de PB : 6.12LTS - 64 bits
idle
Always Here
Posts: 5888 Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand
Post
by idle » Mon Jun 02, 2025 9:54 am
SPH wrote: Mon Jun 02, 2025 8:44 am
I know MODs; I have Mod Anthology (the complete Amiga series).
I'm not looking for music, but sound effects like stones colliding and the like.
Above all, remember one thing: I want to put them as data in my exe so that my program fits in a single exe.
Or, if you know how to put WAV sound effects as data, I'd love some PB code.
Thanks.
Cant PBSpotFx do that?
and if not there are tons of sound FX samples to be found for free online.
NicTheQuick
Addict
Posts: 1517 Joined: Sun Jun 22, 2003 7:43 pm
Location: Germany, Saarbrücken
Contact:
Post
by NicTheQuick » Mon Jun 02, 2025 10:11 am
SPH wrote: Mon Jun 02, 2025 8:44 am Or, if you know how to put WAV sound effects as data, I'd love some PB code.
That's easy. Just look for `CatchSound()` in the help. There's also a mini example.
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.