P.S. I will not be offended , if you refuse for any reason
Possible description:
Library is cross-platform and comes for Windows, Linux, Dos
Author: angros47
Download link: https://sourceforge.net/projects/freeba ... ary/files/
Compile Library:
all the necessary scripts are in the archive, you just need to substitute the correct path to the compiler in them
Description:
Description of all functions is in the file readme.txt (in archive)
A brief description of the main (not all) functions:
1) SoundmidiSet - setting mode midi (needed for function PLAY)
2) SoundSet - setting mode PCM sound (needed for functions SOUND , PlayWave)
1) PLAY - command is for playing musical notes,octave. It can only play one note at a time. (for more information see command QBASICs play).
2) SOUND - command produces sound of a specific frequency for a specific duration
3) LoadMidi - load midi from file , returns a pointer MidiSequence ptr
4) PlayMidi - play midi , in parameters you need to pass pointer MidiSequence ptr
5) CreateMidi - creates MidiSequence ptr , then you can use the pointer using PLAY to write data , and then save in the file
6) SaveMidi - save data MidiSequence ptr in file, in format .mid
7) LoadWave - loads a file into memory WAV (supported only WAVE_FORMAT_PCM) , returns a pointer WaveHeaderType ptr
8) PlayWave - play wav , in parameters you need to pass pointer WaveHeaderType ptr
example Play
Code: Select all
#include "sfx.bi"
#inclib "fbsfx"
SoundmidiSet ()
PLAY "a4e4g4a4g4e4c2f4f4f2d4d4d2"
Code: Select all
#include "sfx.bi"
#inclib "fbsfx"
dim shared as any ptr mutex
mutex = MutexCreate
dim shared as Long iMusicExit
dim as Double dTimer
sub procThread(p as any ptr)
SoundmidiSet ()
PLAY "a4e4g4a4g4e4c2f4f4f2d4d4d2"
MutexLock(mutex)
iMusicExit = 1
MutexUnLock(mutex)
End Sub
dTimer = timer
threadcreate(@procThread)
do
? timer - dTimer
MutexLock(mutex)
if iMusicExit then
exit do
EndIf
MutexUnLock(mutex)
Loop
Code: Select all
#include "sfx.bi"
#inclib "fbsfx"
SoundmidiSet ()
dim as any ptr Midi=CreateMidi()
PLAY Midi,"a4e4g4a4g4e4c2f4f4f2d4d4d2"
SaveMidi "music.mid", Midi
Code: Select all
#include "sfx.bi"
#inclib "fbsfx"
SoundmidiSet ()
dim as any ptr Midi=LoadMidi("music.mid")
PlayMidi(Midi, 1)
sleep
Code: Select all
#include "sfx.bi"
#inclib "fbsfx"
SoundSet (44100,1,16)
sound SineWave(2000), 1 ' sine 2 kHz
sound NoiseWave(), 1 ' noise
sleep
Example LoadWave , PlayWave
Code: Select all
#include "sfx.bi"
#inclib "fbsfx"
dim as WaveHeaderType ptr pWave
SoundSet (44100,2,16)
pWave = LoadWave("1.wav")
if pWave = 0 then
print "pWave = 0" : end
end if
PlayWave(pWave)
sleep