Bass23

Blitz3D Forums/Blitz3D Userlibs/Bass23

Abrexxes(Posted 2007) [#1]
http://www.blitzbasic.com/toolbox/toolbox.php?tool=207


_33(Posted 2007) [#2]
Thanks. I'll check it out.


ZJP(Posted 2007) [#3]
Thanks. Works well. ;-)


lo-tekk(Posted 2007) [#4]
Wow cool, last week i thought about making a bass wrapper.
Thank you ! Do you know how the mp3-free dll is different from the ordinary library ?


Abrexxes(Posted 2007) [#5]
In the nomp3 dll the source to decode mp3 is not includet. So you can not load mp3 files. Thats all.


Abrexxes(Posted 2007) [#6]
Update for dx8 commands. Now full supported.
=========================================================================
If successful, TRUE (1) is returned, else FALSE (0) is returned :

- BASS_FXSetChorus%(HFX,fWetDryMix#,fDepth#,fFeedback#,fFrequency#,lWaveform%,fDelay#,lPhase%)
- BASS_FXSetCompressor%(HFX,fGain#,fAttack#,fRelease#,fThreshold#,fRatio#,fPredelay#)
- BASS_FXSetDistortion%(HFX,fGain#,fEdge#,fPostEQCenterFrequency#,fPostEQBandwidth#,fPreLowpassCutoff#)
- BASS_FXSetEcho%(HFX,fWetDryMix#,fFeedback#,fLeftDelay#,fRightDelay#,lPanDelay%)
- BASS_FXSetFlanger%(HFX,fWetDryMix#,fDepth#,fFeedback#,fFrequency#,lWaveform%,fDelay#,lPhase%)
- BASS_FXSetGargle%(HFX,dwRateHz%,dwWaveShape%)
- BASS_FXSetParamEQ(HFX,fCenter#,fBandwidth#,fGain#)
- BASS_FXSetReverb%(HFX,fInGain#,fReverbMix#,fReverbTime#,fHighFreqRTRatio#)
- BASS_FXSetI3DL2Reverb%(HFX,lRoom%,lRoomHF%,flRoomRolloffFactor#,flDecayTime#,flDecayHFRatio#, lReflections%,flReflectionsDelay#,lReverb%,flReverbDelay#, flDiffusion#,flDensity#,flHFReference#)

The follow returns a float with the asked value :

- Bass_FXGetValue#(HFX,effect%,number%)
exemple: If you have an echo effect like - BASS_FXSetEcho(myecho,50,0,50,30,BASS_FALSE)
Use : Bass_FXGetValue(myecho,BASS_ECHO,3) to get the value of the left Delay, so 3 for the 3te effect value.
Bass_FXGetValue(myChorus,BASS_CHORUS,4) returns the frequency of the effect myChorus.

effect flags are the same as for BASS_ChannelSetFX
===========================================================================


Abrexxes(Posted 2007) [#7]
Another update.

I am sorry, bu i can not test all this , i need years ! So i am happy for every bug or error that you will find. :)

cu


Abrexxes(Posted 2007) [#8]
So, thats it for the moment (0.5).


@rtur(Posted 2007) [#9]
Hi, I've made BASS2.3 decls for my current project.
Here is it:
http://arthurostapenko.com/blitz/Bass23.rar

Problem with QWORDs I've solved like this:
BASS_ChannelSetPosition%(handle,pos%,posH%)
just put second integer parameter into function declaration and Blitz will not give MAV. To set position of playback use pos% variable.


Abrexxes(Posted 2007) [#10]
Hi,

commands like musikload i make this
BASS_MusicLoad%(Mem%,File$,offset%,length%,flags%,freq%) : "BASS_MusicLoad"
BASS_MusicLoadMem(Mem%,File*,offset%,length%,flags%,freq%) : "BASS_MusicLoad"
Works perfekt.
just put second integer parameter into function

Nothing else i do. ^^ about the 2.4 Mb i must see ^^


@rtur(Posted 2007) [#11]
>Nothing else i do.
Ok, I haven't seen your decls, just read about "QWORD Disaster" in first post and decided to tell how it can be resolved because I've spent whole day while figured out how to fix this bug :)

>but i use the first value, else you can only jump every >2.4MB, right?
Yes, pos% is the first value in my declaration :)


Abrexxes(Posted 2007) [#12]
At the moment i am a little confused about the flags/qword attributes. I will think about this later. :P

For the moment there are 98% of all bass functions and 7 plug-ins. I think its a "little" better then the original Blitz stuff. ^^

At the moment if you try to get w qword return value the bass.bb will give a runtimeerror, so no confusion.


@rtur(Posted 2007) [#13]
Basicaly returning QWORD value is not a problem. It returns low part of QWORD (that is equal to blitz Integer= 4 bytes). It is enough for usual needs of gameveloper.

TBH I dont understood why authors of BASS need 8bytes for position. It is 0...FFFFFFFFFFFFFFFFh :) or 16 777 216 TB of music file :)


Abrexxes(Posted 2007) [#14]
yeah its maybee for Blu-ray support (muarharhar).

No i mean the 1000 combinations of Lo/Hiword flags. I must take a look ,later. If there is a problem now, you can change the prioritys in the bass.bb at the end of file.


@rtur(Posted 2007) [#15]
And of course BASS is much better than inbuild B3D sound system. It allows playing mo3 files, not buggy with tracker music, allows to recieve ChannelPlaying(Channel%) for MOD muic(BASS_ChannelIsActive(Channel%)), Set/Get pyback position of channels(even on tracker music with BASS_MUSIC_PRESCAN flag), play samples well on all sound cards(b3d sometimes play usual mp3 or ogg with "clicks" on my integrated soundcard).

But it cost some money.


Abrexxes(Posted 2007) [#16]
Its free for non-commercial use.

For the rest, i have no problem to buy some money for good stuff if i can use it.

(Edit), what you say there is (ex.prescan) already in bassmod, its the half price, so 50$ for a shareware lizens.


@rtur(Posted 2007) [#17]
I know. I've already used BASS in last project(not released yet).


Abrexxes(Posted 2007) [#18]
Another update.


_33(Posted 2007) [#19]
Boy, you're on fire! I wish I'd be as productive!

2 things friend:
;.lib "User32.dll"
;GetActiveWindow%() : "GetActiveWindow"

;.lib "Kernel32.dll"
;RtlMoveMemory1%(Destination*,Source,Length) : "RtlMoveMemory" 
;RtlMoveMemory2%(Destination,Source*,Length) : "RtlMoveMemory"

Had to comment those out as I had the userlibs for those.

Also:
hWnd = api_GetActiveWindow()

The userlibs in blitzbasic.com point to api_blabla, not just the blabla... So I had to change that also. I suspect you'll have issues with the rookies.

CREAMOTE.MOD is one heck of a classic! I haven't heard that one since... 1992?

In demo_3D.bb, left and right should be swapped.


Abrexxes(Posted 2007) [#20]
Yep. Fixed. Reload the file.

No longer problems with other libs. ;)

Thanks


_33(Posted 2007) [#21]
OK, but maybe in your docs, state that the user will need these userlibs, or that they include your decls for the windows api (that's how I'd do it anyhow).

user32.decls http://www.blitzbasic.com/codearcs/codearcs.php?code=1179

kernel32.decls http://www.blitzbasic.com/codearcs/codearcs.php?code=1180

EDIT: ok I saw your trick... HAhah! It's a dirty patch but I agree that it does solve the problem.


Abrexxes(Posted 2007) [#22]
state that the user will need these userlibs


No they dont't. They can use the build in "BASS_GetActiveWindow" or the "api_GetActivewindow" or whatever they have includet as "User32" command.

All what bass need is in the bass.decls

.lib "User32.dll"
BASS_GetActiveWindow%() : "GetActiveWindow"

.lib "Kernel32.dll"
BASS_RtlMoveMemory1%(Destination*,Source,Length) : "RtlMoveMemory"
BASS_RtlMoveMemory2%(Destination,Source*,Length) : "RtlMoveMemory"



You can have now both libs in you userlibs without problems. OR you can use your api_X. If you want. Its the same

cu


Abrexxes(Posted 2007) [#23]
1.0 is out with new FX_DSP (plugin) Functions.

============================================================================================

BASS_FX_DSP_Echo%(han_dle,level#,elay%)
BASS_FX_DSP_Flanger%(han_dle,wetdry#,speed#,channel%)
BASS_FX_DSP_Volume%(han_dle,channel%,volume#)
BASS_FX_DSP_Equalizer%(han_dle,band%,freq%,bandw#,q#,center#,gain#,channel%)
BASS_FX_DSP_Reverb%(han_dle,level#,elay%)
BASS_FX_DSP_Lowpass%(han_dle,freq%,reson#,cutoff#,channel%)
BASS_FX_DSP_Damp%(han_dle,target#,quit#,rate#,gain#,elay#,channel%)
BASS_FX_DSP_AutoWah%(han_dle,drymix#,wetmix#,feedback#,rate#,range#,freq#,channel%)
BASS_FX_DSP_Echo2%(han_dle,drymix#,wetmix#,feedback#,elay#,channel%)
BASS_FX_DSP_Phaser%(han_dle,drymix#,wetmix#,feedback#,rate#,range#,freq#,channel%)
BASS_FX_DSP_Echo3%(han_dle,drymix#,wetmix#,elay#,channel%)
BASS_FX_DSP_Chorus%(han_dle,drymix#,wetmix#,feedback#,minsweep#,maxsweep#,rate#,channel%)
BASS_FX_DSP_APF(han_dle,gain#,elay#,channel%)
BASS_FX_DSP_Compressor(han_dle,treshold#,attack#,release#,channel%)
BASS_FX_DSP_Distortion(han_dle,drive#,drymix#,wetmix#,feetback#,volume#,channel%)

All = Returns TRUE or FALSE (1/0)

===========================================================================================

@_33 I removed the user lib command, so every body can do like he want. My demos use "0" default. The other 2 functions dont make problems as they have a BAS__x name and are only used in my sub functions.

bye

Edit: No longer QWORD problems with 1.1.


kinclong2(Posted 2007) [#24]
I always get "Illegal Type Conversion" but when I changed:

BASS_RecordStart(freq%,chans%,flags%,proc*,user%) : "BASS_RecordStart"

to

BASS_RecordStart%(freq%,chans%,flags%,proc*,user%) : "BASS_RecordStart"

I got MAV but successfull compilation.

Any example on how to record the microphone?

This is the version.txt from "blitz_bass_studio.zip"

===========
BLITZ_BASS_STUDIO V1.3
BASS 2.3 - Copyright (c) 1999-2007 Ian Luck. All rights reserved.
BASSMOD 2.0 Copyright (c) 1999-2007 Ian Luck. All rights reserved
Userlibs and includes for BASS & BASSMOD by Abrexxes 2007
===============


Abrexxes(Posted 2007) [#25]
@ kingclong2
Can you show how you call the function (code), what os do you have?
Try also BASS_RecordStart%(freq%,chans%,flags%,proc%,user%) : "BASS_RecordStart"
So : BASS_RecordStart(freq,chans,flags,0,0)

Update 1.3.2 for chiptune freaks ^^ new function added BASS_MakeBeep.
See demo_beep.bb


Function BASS_CreateBeep%(art% = 1 ,hz% = 900,time% = 100 ,freq% = 44100 , chans% = 1, max% = 1, flags% = 0, onlynew% = 0)

Local q%, y%, yy% , stemp%, length%, tbank%, hfinal%, hchannel%
length = (((freq*chans)*time) / 1000)*2

stemp = BASS_SampleCreate(length,freq,chans,max,flags)
If stemp = 0 Then RuntimeError "Stemp"
tbank = CreateBank (length*2)

For q = 0 To (length-1)
;this 4 are for 44100/mono/16bit (default values)
If art=1 y=Sin(q/44100.0*360*hz)*32767
If art=2 yy=yy+Rand(hz/8,hz*3):y=Sin(yy/44100.0*360)*16384
If art=3 yy=yy+Rand(1000.0*hz/(q+1),1000.0*hz/(q+1)*10):y=Sin(yy/44100.0*360)*16384
If art=4 y=y+hz*1.45:If y>32767 y=-32767

;feel free to add your one stuff. :)

PokeShort tbank, q*2, y
Next
BASS_RtlMoveMemory2(stemp, tbank, length)
FreeBank tbank
hfinal = BASS_SampleCreateDone()
hchannel = BASS_SampleGetChannel (hfinal, onlynew)
Return hchannel

End Function



Have fun with this. ;)


Panno(Posted 2007) [#26]
is there a way to find out if a sample playing (mod files) ??


Abrexxes(Posted 2007) [#27]
Hi,

you can load the modfile into a bank and load it from there to bass. The same time you play the mod, get the playposition and read the pattern information from the header.

With bass i know only the way to control volume of each channel and (or) instument with BASS_MusicSetAttribute.

I will write a function like this later because i need somethink like that also, but at the moment i dont have much time. the format of the modfile you can find here.

ftp://ftp.modland.com/pub/documents/format_documentation/

Look for Protracker 2.3 specs.
So you only need the pattern infos and the mod format (channels) you can find at position 1080.


Today i will make 1.3.3 with a new record function (without callback) and a mp3player with sourcecode from hectic. :) Also i will make a new folder with some stuff. There you will find more information about the modformat. So you can make whatever you want. All you need is Createbank and Peek/writebyte. ;)

bye


Abrexxes(Posted 2007) [#28]
1.3.3 now online , new demo see first post. I have added now BASS_RecordStartSimple to record without callbacks (see help functions). But i dont have time to test and i have no mic (never have used a mic in 18 years ^^)


Boiled Sweets(Posted 2007) [#29]
@Abrexxes

AWESOME WORK!

Many thanks....


jfk EO-11110(Posted 2007) [#30]
Thanks a lot dude. I already worked with the Bass lib some time ago (there may be version conflicts in the decls files!). I made a nice spectrum analyzer that worked with a WAV file, but I never managed to make it work with the direct MIC input, a realtime spectrum analyzer, so to say.

Any ideas?


Abrexxes(Posted 2007) [#31]
Hi and thanks. :)

Yes, there will be problems with older versions. For example PLAYMUSIC no longer exists. Everything is now managed by channels.

But for this you have all the channel commands for each object (Music/Stream/Sample).

Old -> Load Music -> Play Music
New -> Load Music (returns a channel handle)-> Channel Play

I am sorry, i have only 3 keyboards and 2 mixtables but not 1 mic. I am not a rapper (haha). No serious, maybee there is someone find this out.

BTW @jfk If you have every time the message "command not found in userlib" look if there is an old version of bass in your windows/system32 folder. If yes delete them.


Abrexxes(Posted 2007) [#32]
hi folks. 1.4 is out.

See the new demo (exe) modinfo.zip. (first post)

ModInfo works with blitzbasic and/or bass/bassmod
Modinfo will give you "every" information about a mod in "realtime"

have fun!


Abrexxes(Posted 2007) [#33]
1.5 is out.

Bass 2.3.0.3 + SOX

see versions.txt for new bass stuff.

bye


LineOf7s(Posted 2007) [#34]
Loving your work. Carnally.

Please keep it up (so to speak). :o)


Abrexxes(Posted 2007) [#35]
hi, 1.5.1

----- v.1.5.1
- update plugins (current versions)
BASSWMA 2.3.0.3
BASSCD 2.3.0.3
BASSFLAC 2.3.0.4
BASSMIDI 2.3.0.3
BASSenc 2.3.0.3
BASSmix 2.3
BASSFX 2.3.0.3
BASSAC3 2.3.0.2
TAGS 13


bye


Abrexxes(Posted 2007) [#36]
1.5.5

For all who wants to stream url Radio and files ;)
In the first post a new demo (win32/exe) with mp3 and live stream (SkyFM the80s) in low quali, so also ISDN user will hear something.


----- v.1.5.5
* This update is only for url streaming & new source code from hectic
- added dreamplayer2.3 source code (thanks to hectic)
- fixed Bass_CreateStreamUrl (bass.decls)
- added demo_stream_url (bass)
- added demo_stream_url_live (bass)
- added links 4 streams (stuff)



have fun


ervin(Posted 2007) [#37]
Spectacular stuff.
Thanks very much for your efforts.

I'm still new to this, and I was just wondering if BASS (and indeed this lib) offer a way to time game events to music.
Can this lib capture the BPM of a piece of music?


Abrexxes(Posted 2007) [#38]

I'm still new to this, and I was just wondering if BASS (and indeed this lib) offer a way to time game events to music.


So, welcome! Yes, you can change in ever stream/sample/music the playback position in realtime, and you have goodies like speedadjust, realtime_sfx etc..whatever you need. Also you can give every channel a 3D position in a scene. Millions of combinations. :)

And if you are very hard you can work with 5.1 or 7.1 speakers or stream AC3 dolbydigital .



Can this lib capture the BPM of a piece of music?

Music? If you mean modules like mod xm etc yes. See the demos for this.
If you mean streams like mp3 ogg flac ...omfg...yes...but its not like BASS_MakeTempo(fast) :) Look into the bass_fx.chm(docs). There you will find thinks like "Tempo, Pitch and Samplerate"


A little problem with 1.5.5 btw
this:
url$= "http://www.volldiemuke.fsdfsdfsdf.m3u"
music = BASS_StreamCreateURL(url,0,0,0,0) 

works not at the moment, will be fixed next version.
So use always the full name for the first parameter.
music = BASS_StreamCreateURL("http://www.volldiemuke.fsdfsdfsdf.m3u",0,0,0,0) 


EDIT : No sorry, it works. Maybe the stream was down this time. ^^

bye


ervin(Posted 2007) [#39]
Excellent! Thanks very much for the information.


Abrexxes(Posted 2007) [#40]
np

@kinclong2

Next version will have a tutorial how to record .
you can save (i hope) wav , ogg, mp3 and flac files

bye


Abrexxes(Posted 2007) [#41]
Important update ! Please replace all the files


----- v.1.5.8
* Important update !!! (bass.bb/bassmod.bb)
- files changed : bass.decls/bass.bb/bassmod.bb/all the demos (bass/bassmod)
- added some stuff to demo_stream_url and _live
- fixed lo/hiword (was inverse)(bass & bassmod) -.-
If you use already BASS_LoWord in your code, change it to BASS_HiWord
If you use already BASS_HiWord in your code, change it to BASS_LoWord
- fixed all the demos (Lo/Hi used for vumeters & *.mod positions) (bass/bassmod)
* only bass from here
- added new gfx vumeter to demo_start & others
- fixed BASS_GetDeviceCount() returns now the right number
- fixed BASS_RecordGetDeviceCount() returns now the right number
- added blitz_bass_record_functions.txt to the docs
- added new include bassrecord.bb (only include that to record)
- added tut_record_1.bb (init the hardware)
- added new functions to decls for syntax & syntaxhighlighting
- New and fixed functions for recording, see includes\bassrecord.bb
- added tut_record_2.bb (start a record handle)
- more recording stuff comming soon (stream handle and save files)



bye


caff_(Posted 2007) [#42]
Excellent, thank you very much!


Abrexxes(Posted 2007) [#43]
***


LineOf7s(Posted 2007) [#44]
err...

1.6 - cool!




*focusses on the positive*


Abrexxes(Posted 2007) [#45]
Absolutely,

At the moment i dont know if we will have 2.3.0.X or 2.4 ;) So , at the moment i am waiting... :) But i am still alive, ;)

For the moment : http://www.blitzbasic.com/toolbox/toolbox.php?tool=207

i will made the new version as soon as possible, but at the moment we are uptodate and we are waiting for Ians new VISTA....öhm....2.4...:))
At the same moment i am waiting for a linux port to add...you now..;)

And btw:
;)


Filax(Posted 2007) [#46]
Is there a way to know the music time in hour:minute:second ?


hectic(Posted 2007) [#47]
I have programing the Player based on Blitz-Bass-Studio 1.5.8. The Display - minute:seconds:1/100seconds


Filax(Posted 2007) [#48]
Ok a got it :) many thanks :) really nice lib Draw3D :)


.rIKmAN.(Posted 2007) [#49]
Hi, I`m having a problem using BASS with some MIDI files, and I`m stumped.

I can load the MIDI, play it fine, and display the length in both bytes and seconds using BASS_ChannelGetLength() and BASS_ChannelBytes2Seconds() respectively - just to test I can get them really.

However, when I try to use BASS_ChannelGetTags and the BASS_TAG_MIDI_TRACK (defined at bottom of bass_midi.bb) I get an "illegal type conversion".

The docs say that "If successful, the requested tags/headers are returned, else NULL is returned", however I am not getting that far - Blitz is refusing to compile it.

I have tried making title a string, float, int - maybe I have to use banks and peek/poke, but I would like this confirming if possible.
I have also tried varying combinations of using "rp" instead of "midi" in the BASS_ChannelGetTags() call, but all to no avail.

If I comment out the offending line, it compiles and runs fine.

Does anyone have any idea why?

; Includes
Include "bass.bb"
Include "bass_midi.bb"

; Initialise
HWND = BASS_HWND()
BASS_Init(-1,44100,0,HWND,BASS_NULL)

; Setup
midi=BASS_MIDI_StreamCreateFile(0,"midiFile.mid",0,0,0,44100)

rp=BASS_ChannelPlay(midi,True)

midiSize#=BASS_ChannelGetLength(midi) 
midiSecs#=BASS_ChannelBytes2Seconds(midi,midiSize)

; *** Problem Line
title=BASS_ChannelGetTags(midi,BASS_TAG_MIDI_TRACK)

; Main Loop
While Not KeyDown(1)

	Cls

	BASS_Update()

	; Test info
	Text 10,10,midiSize
	Text 10,30,midiSecs

	Flip

Wend

BASS_Stop()
BASS_Free()



Abrexxes(Posted 2007) [#50]
Hi,

I have started a new job, so i dont have much time at the moment, and i know that here you must spend some time. :(

Edit: Try this
buffer = Createbank (1024)
buffer = BASS_ChannelGetTags(midi,BASS_TAG_MIDI_TRACK)


If these compiles i must write a workarount for this command.

(I see, i must spend some time in the midi specs, next days :P )


.rIKmAN.(Posted 2007) [#51]
Thanks for the suggestion, but unfortunately no - I still get the same error "illegal type conversion".

This is such a shame as BASS looks so promising, I hope you can get some work done on ironing out the problems over xmas :)

I guess I will wait and see on your progress with the BASS lib, and have to have a play with FMOD in the meantime, as I need to get some work done while I am off work over xmas.

I look forward to your updates, if you need any testing / help done please get in touch on here or by email.

Thanks.


Abrexxes(Posted 2007) [#52]
BASS is absolutely fantastic stuff. The problems are always the "limitations" of Blitzbasic, not some limits of BASS. I will work an your problems(2) in the next days. It is possible that i must write some new "Helpfunctions" to get all your requests working with Blitz. Also i will search for a solution how to display hh,mm,ss,1/100seconds (hectic).

BTW: If you want to work with fmod you will have the same problems and a lot more because EX makes 80% of the stuff with structs&pointers. ;) (And Bass 2.2+ is more powerfull then Fmod 3.x as it works also (like EX) with channel managment.

bye


.rIKmAN.(Posted 2007) [#53]
Thanks for the reply abrexxes :)

I have looked into FMOD and you are right, I will have the same problems.

It`s great that you are so active in developing the lib, and I would love to give you any help I can on implementing the functions, so if you want to chat grab me on MSN: rik187@... or send me an email at the address you already have mail from me at (ram interactive).

Look forward to hearing from you :)


.rIKmAN.(Posted 2007) [#54]
OK I had a reply from Ian @ the un4seen, and he has said:

"I'm afraid it is not possible to get the currently playing note like that. The reason being that there could be multiple notes, but only 1 return value

To be informed of when a note is played, you can use an BASS_SYNC_MIDI_EVENT sync for the MIDI_EVENT_NOTE event. See the "MIDI syncs" section of the docs for further details."

So.....

I have played around with some code and having failed miserably I think as you say you may need to update your library to support some of the stuff in BASS.

I tried stuff like:

ms=BASS_ChannelSetSync(midi,BASS_SYNC_MIDI_EVENT,MIDI_EVENT_NOTE,60,1,0)
ms=BASS_ChannelSetSync(midi,BASS_SYNC_MIDI_EVENT,MIDI_EVENT_NOTE,BASS_MakeHiWord(12),1,0)

etc etc, but keep getting errors - I think because of the return value or the HIWORD/LOWORD thing - also the docs confilct somewhat saying in 1 page that the HIWORD represents the channel, and in another saying the HIWORD represents the Velocity....hmmmmmm.

I keep getting MAVs and errors when I am using the commands as per the BASS docs.

So - let me know when/if you have some free time and I would be glad to help you iron these out.

Thanks!


Abrexxes(Posted 2007) [#55]
Sunday i will see..if not we must do the same as in "MODINFO". So read the mid file in a bank and sync that with the playback of Bass. (I see callbacks in the horizon -.-)

bye


.rIKmAN.(Posted 2007) [#56]
Email me or grab me on MSN whenever you have time, I`m usually always available on one or the other.

Speak to you soon!


Abrexxes(Posted 2007) [#57]
My machine is absolutely "MicroSoftN" free. XD. But dont panic, i will speak you this week on ICQ. If you want, mail me your ICQ number and a MIDI File that you use, so i have a recent file from you. (I will use the finalfantasy7 and 9 MIDIs for my tests (spec 1.1).

bye


Abrexxes(Posted 2007) [#58]
Important: !!

From this moment it is possible that some demos like "wwwstream" not longer works(some hours). The demos are removed and i now this*. All this will be fixed for christmas. ;) (dont panic, we will back soon)

At the moment you can download the last supported version in the toolbox (on this sit1.5.9).

* ok..fuck...vista. I will return to XP bevore moving to 1.6 ;)

But as i known at the moment, 1.6 will be only for MIDI Freaks..so no important BASS update (if you normely dont need *.mid files.(The others will have a new dimension of Party. :P


.rIKmAN.(Posted 2007) [#59]
Looking fortward to it, you have mail :)


Abrexxes(Posted 2007) [#60]
Hmm.....hmmmmm..well i dont have a creative card....but here a first demo. Read the first lines. I you hear nothing download the 4mb soundfont from the (new) toolbox entry as shown.
http://www.blitzbasic.com/toolbox/toolbox.php?tool=207
(Dont forget to use "your" midifile.) Next will be a demo how to load soundfonts (a 30mb soundfont monster XD) and a tutorial how to work with midi_events (BASS_MIDI_StreamGetEvent).

@ .riKmAn. The BASS_ChannelGetTags command only returns tags, a midi file has only chunks. But the tutorial about StreamGetEvent will fix your problems in "some" hours.

; Important !!
; BASS use "a" default soundfont from "creative labs"  (like "CT4MGM.SF2") from the windows/system32 folder to
; play midi files. If you dont have a creative card or no compatible file is present, you can download one from the toolbox
; (http://www.blitzbasic.com/toolbox/toolbox.php?tool=207) and copy (unzip it)it into this folder 
; (windows/system32). To avoid any problems you can also "load" other soundfonts (see demo_soundfont.bb)

Include "includes\bass.bb"
Include "includes\bass_midi.bb" ;plugin

HWND = BASS_HWND() 
If Not BASS_Init(-1,44100,0,HWND,0) RuntimeError " Bass Init error"

midiplug = BASS_PluginLoad("bass_midi.dll",0)  ; load plugin for midi

Timer=CreateTimer (60)
Graphics 640,480,0,2
SetBuffer BackBuffer()		
Global vubar = LoadImage ("media\vumeter.png") 
MaskImage vubar,255,0,255
Global peakl, peakr
music  = BASS_MIDI_StreamCreateFile(0,"media\ff8piano.mid",0,0,0,0) ; we load a midi file

If Not BASS_ChannelPlay (music,0) RuntimeError "There was a problem" ; we play the file

While Not KeyHit (1) ; mainloop
Cls
Color 255,0,255
Text 0,0,"Bass midi demo (ESC to quit)"

time = BASS_ChannelGetPosition(music)
Text 0,20, "Position: " +time +" bytes"
Text 0,40, "Titel: 'Piano' from FinalFantasy 8"

; More visualisation ;)
Local vumono = BASS_ChannelGetLevel (music)
Local vuleft = BASS_MakeLoWord (vumono)
Local vuright = BASS_MakeHiWord (vumono)
Color 255,0,0
Text 0,170,"Left channel : "+vuleft
DrawImageRect vubar,0,200,0,0,vuleft/52,20
DrawImageRect vubar,0,240,0,0,vuright/52,20
Text 0,270,"Right channel : "+vuright
Color 255,255,0
peakl = peakl - 2
If peakl < (vuleft/52) Then peakl = vuleft/52
If peakl >350 Color 255,0,0
If peakl <150 Color 0,255,0
Rect peakl,200,3,20,1
Color 255,255,0
peakr = peakr - 2
If peakr < (vuright/52) Then peakr = vuright/52
If peakr >350 Then Color 255,0,0
If peakr <100 Then Color 0,255,0
Rect peakr,240,3,20,1
; end visualisation

WaitTimer Timer 
Flip 0
Wend

BASS_PluginFree(midiplug) ; unload plugin
BASS_Free() ; unload bass
End


Yes! I love vumeters. XD

BTW: You dont need BASS_update() , this is only used in some special cases if you want "force" updates of the engine. In 99% of cases the autoupdate function of bass is enought.

@hectic
1) There is no fast and easy way to get 1/100 seconds on playback. But i recommand to write a litle timer with millisecs after each second has started. So you can see in every frame the millisecs passed. If a new second starts, reset the counter. This will be more fast and makes only what is necessary. (You dont need 1000 or 100 steps if your framerate ist only 60). Else you must "force" updates with BASS_update and this is only cool if you have 100 or 1000 frames ;) )

2) You can get the sample rate of a playing channel with BASS_ChannelGetAttributes or BASS_ChannelGetInfo (with a Type). If you have problems with this pointers tell me and i will write a function. I you do so, feel free to post it so i can include it. (hehe)

Mery Chrismas. :)

PS: If someone wants the finalfantasy midi files (from FF1 to FF9), feel free to ask and i will upload them. ;)


Abrexxes(Posted 2007) [#61]
Version: 1.6.0

----- v.1.6.0
* This is only for midi files
- added new demo_midi.bb
- added new demo_midi_event.bb
- some new links in "stuff"



@ rIKmAN

Yep, if you want to get all the notes in realtime (i have only made an example to show the banks used) you must write a complet midi importer for GM/GS standard. If i do that, i do nothing else than write your application. But you can find the descriptions of the GM Standard in the stuff folder. The "soundfont" demo i must also make later.

For the moment, thats all about midi.


.rIKmAN.(Posted 2007) [#62]
Good stuff abrexxes!

I have some time to spend coding in the next few days so will have a look at what you mentioned above.

I don`t want to get "all" notes in realtime, just 1 note (#1 piano) from 3 channels (0-2) and tell me if its being played (on) or not (off), unless I misunderstand what you mean.

I will have a good look round the internet at the GM/GS standards and see whats what.
I don`t ideally want to spend my time messing with file formats, but more the game, so I`ll do some good research today and see which route is going to be the best.

I look forward to the StreamGetEvent example/tutorial you mentioned.

I`m also looking into using MODs for the same thing (reading on/off status of channels playing) - don`t know why this didnt occur to me before.

ModInfo seems more fully featured than the MIDI stuff at this point, so maybe it will be better/easier if I use that....I shall see!

Happy Xmas :)


.rIKmAN.(Posted 2007) [#63]
Ok I`ve been playing with some MODs and tracking software - what a blast from the past! :)

It seems that on the surface I can use a mod file to do what I want, however I am now going to look into the timing issues and the difficulties of creating a mod file from an mp3 (or other sampled audio, as opposed to other sequenced music).

I know you can`t convert mp3 -> mod, but I`m hoping there is some way in which I can get the melodies etc into a mod file without too much hassle.

Updates to come, so far it is looking good though....


Abrexxes(Posted 2007) [#64]
Yep, modinfo gives you ALL the informations stored in the mod file (ex, the samples are not stored). You must know that i use this format since amiga times, so it was not really a hard work for me to "decode" the informations into banks and read them in realtime. But i have never worked with midi(Ok....i hate midi *lol*). What i have seen is that the informations are stored in "blocks" like the "wav" format, and as Ian says, there can be more notes at the same channel at the same time. Also i have discovered that some kinds of programms writes more "blocks" with her own informations and so on and so on.

I dont know exactly what kind of music do you will use for your game(?). If MOD is enough you will happy with modinfo. If you want to use the XM format (an extended mod format with volume envelopes and no 22050hz limit) i think i can write the same for XM (xminfo). So (in a first version) i can make you a "getnote" info, so you will see what for an "instrument" is playing an each channel. Later i will include the rest (to complet this).

Note: I have made the decision to move also to BASS 2.4 in the next weeks. That takes a lot of time but modinfo works on 2.3 and 2.4 without changes. As the api has changed i must rewrite some stuff and make a "bigger" description how to update from 2.3 to 2.4. I will take the chance to rewrite also my "helpfunctions" a little to make it easier to use. Thats why i am not shure at the moment if i will write the tutorial for 2.3 or for 2.4. If you work only with playback functions there is no need to update to 2.4 (for this the 2.3 version will also be available also in the BBS toolbox for older projects). But if you use plugins, samplefonts and also record functions (AND FUCKING VISTA), i recommand to update to 2.4. if it is done.

We will see next weeks what happens :)

Happy new year ;)


.rIKmAN.(Posted 2007) [#65]
Hi abrexxes!

Yeah I remember MED/octaMED from the Amiga days, that was what my blast from the past was all about hehe!

I will not actually be using the mod file for the actual music in my game, the mod will be silent whilst the actual music plays normally.
However I will be using it for "level data" - checking against input from the player to see if they have pressed a button at the correct time - the correct time being when the notes in the mod play (within a small level of accuracy).

So, in essence, as long as I can see whether a note in the mod is not being played at all, should be played now or has already started playing (ie. too late to press now) then it should be fine.

What I now need to work on is creating the mod file from an mp3 source, and keeping it all in time.
Nothing worse than an out of synch Guitar Hero track!

Thanks for all your work with the midi, but I think it will be better for me to use MOD - as it is easier for you and me overall.


Abrexxes(Posted 2008) [#66]
1.6.1


----- v.1.6.1
* Changed file: bass.decls
- Fixed BASS_ChannelSetLink Error
- Fixed BASS_ChannelSetFlags Error
(You dont need to reload if you have still 1.6.0, just edit this lines in your bass.decls)
-->BASS_ChannelSetLink%(Handle, chan%) : "BOOL BASS_ChannelSetLink"
to : BASS_ChannelSetLink%(Handle, chan%) : "BASS_ChannelSetLink"
-->BASS_ChannelSetFlags%(Handle,flags%) : "BOOL BASS_ChannelSetFlags"
to : BASS_ChannelSetFlags%(Handle,flags%) : "BASS_ChannelSetFlags"
(WTH i have made there -.-, sorry for this guys and thanks to Roland to report this!)




ervin(Posted 2008) [#67]
Oustanding.
Thanks very much!


_33(Posted 2008) [#68]
Fantastic update as usual Abrexxes, thank you very much! Appreciated!


Abrexxes(Posted 2008) [#69]
Thanks :) (But..ok, i was really stupid there, next time i will check all the decls for *.h keywords before a release XD).

cu


_33(Posted 2008) [#70]
Hey ho, I'm trying to get the record channel and display a spectrum of it. I truely need help for this one ! Right now I get an error on BASS_RecordStart :/




Abrexxes(Posted 2008) [#71]
Hi, the problem is that the original BASS_RecordStart want a pointer of a RECORDPROC Structur (Flag number 4). But with "0" you return only an INT value.

Use BASS_RecordStartInt (48000,2,BASS_SAMPLE_FLOAT,0,0) , or BASS_RecordStartSimple (see blitz_bass_record_functions.txt for this, its the same as BASS_RecordStart but without callbacks)

Btw, Bass 2.4 is out now, but it is not longer compatibel to the versions 2.3.x.x. (and so to BBS) For the moment i recommand to keep the version 2.3.x.x as the new api use a lots of pointers und structs..so not really B3D or B+ friendly. Another point is that 2.3.x.x is very stable and i have not the time at the moment to work on a 2.4 port, but.....we will see....

bye


_33(Posted 2008) [#72]
Thanks Abrexxes, but somehow, with the SBLive, I can't seem to get thr recording channel. Maybe what i think I should try to get the main audio out channel and use that for a spectrum display thingy. I just don't know how to do it! How do you get HMUSIC?

Thx for any help

EDIT: Oops HMUSIC is when playing MODs, and I don't want to do that. I want to get either Line-In or Microphone. Following code doesn't work, because it doesn't want to use the device for some reason.



Abrexxes(Posted 2008) [#73]
Hi, are you using Vista? If yes, you can only use the input device selected in your vista panel, so you must always use device "0" (default). Thats because the "mixer" that alows a programm to switch the input channels in XP (or 98) is no longer present in vista. (Thanks microsoft) So select in your vista/creative software the channel (input) that you want to capture and use device 0 to capture it.

You can use the 2 demos in the download (record) to see what your soundcard answer if bass ask for the inputs available. If you use vista you will have no values, if you use XP or 98 you will see the deviceIDs and the "real" flag names of your soundcard (mic,audio,waveout,analog and so on)

Or are you using XP or 98(se)?

cu


_33(Posted 2008) [#74]
I have XP sp2 installed.

The first recording demo gives me this:
Bass Record Tutorial 1
Bass version : 02030003
First (real) Hardware : kX Wave SB0102 5.1 [ac00] 0/1 / Number of sounddevices
Inputs found on the first device : 1
Recording hardware : kX Wave SB0102 5.1 [ac00] 0/1 found on ID : 0


Input list :
Device : Wave In / Volume : 0 / Flag : 02000000 BASS_INPUT_TYPE_LINE 1

ESC to exit



The next demo I have the following:
Bass Record Tutorial 2
First (real) Hardware : kX Wave SB0102 5.1 [ac00] 0/1
Recording Hardware : kX Wave SB0102 5.1 [ac00] 0/1
Selected Input : Wave In


Use keys 1<->8 to select an input. Now you have input 1 of 1
Use keys 9 and 0 to change the input volume : 90
ESC to exit


Changing the volume on that device works. Funny thing is it doesn't give me the mic, I should have two in there. But I dunno kX Project driver works fine on it's own, and ASIO is really fast too. AC97 works fine too.

EDIT: Also I went in the kX 10K1 Audio (3538) - 5.1 Model SB0102 properties, and what I see is this:
Audio Peripheral
- kX Wave Device
MIDI peripheral and instruments
- kX Synth Device
Mixing peripheral
- kX Mixer Device
Line in peripheral
- kX Aux Device


Also I realized that in Tutorial 2 there is supposed to be graphic analyzer that should display from the Line In, but it is not, even thoe I clearly hear it in my headphones through AC97. The Wave In seems completely detached from the kX audio device!

EDIT 2: OK, my install of kX was breaking the windows sound management. Uninstalled, it works. But, I have a huge lag in the spectrum display (about 1.5 seconds!). I'm trying to get a DIRECT way of reading the actual spectrum with max 50ms. This is very important for my work. because, even 50ms is too much lag, but it is still managable.

Quote from BASS_CONFIG_REC_BUFFER:
The buffer length for recording channels.

BASS_SetConfig(
BASS_CONFIG_REC_BUFFER,
DWORD length
);


Parameters
length The buffer length in milliseconds... 1000 (min) - 5000 (max). If the length specified is outside this range, it is automatically capped.


Remarks
Unlike a playback buffer, where the aim is to keep the buffer full, a recording buffer is kept as empty as possible and so this setting has no effect on latency. The default recording buffer length is 2000 milliseconds. Unless processing of the recorded data could cause significant delays, or you want to use a large recording period with BASS_RecordStart, there should be no need to increase this.

Using this config option only affects the recording channels that are created afterwards, not any that have already been created. So you can have channels with differing buffer lengths by using this config option each time before creating them.

See also
BASS_GetConfig, BASS_RecordStart, BASS_SetConfig


Also, I'm trying to study Dream Player 2.5 but I can't run it as it is saying there are some missing functions.
dp_init() and also dp_AcceptFiles()


_33(Posted 2008) [#75]
Managed to port the graphic spectrum of the player to the example, but am still stuck with a 1.5 second delay, which is unbearable.


EDIT: I noticed that if you put two times BASS_ChannelGetData, it seems to clear the buffer and the spectrum display is immediate. But when pressing escape, the program crashes :P

Note that what I find irritable is this:
Not using a callback (proc = NULL) allows lower latency for full-duplex recording (ie. playing the data as it's being recorded), as you get the recorded data on demand via the BASS_ChannelGetData function. To keep latency at a minimum, the amount of data in the recording buffer should be monitored (also done via BASS_ChannelGetData, with the BASS_DATA_AVAILABLE flag) to check that there's not too much data. If there is too much data in the buffer, then that means the data currently being recorded will be delayed by the older data in the buffer being retrieved first.

They are not giving any solution as to how I should make the buffer shorter or fix it so there is no delay!


_33(Posted 2008) [#76]
Haaa!!!! Found a trick to make it work!

It gives immediate results, doesn't crash, doesn't mess anything really :P Basically what it's doing to the buffer is empty it every 1/60th of a second (screen refresh).


Abrexxes(Posted 2008) [#77]
Hi, nice work!

About AC97/SB Driver problems. These devices are not really made to work on the same system. If you want to work with more than one soundcard look for prof. solutions like EMU or EDIROL. They have some cards (and USB systems) with special drivers to work on the same system.

In your case i really recommand to uninstall the SB. Switch off (Disabled) the AC97 onboardchip in your BIOS, and reinstall the SB drivers. After this all your problems are gone ;) The drivers of onboardchips and casual creative products are not made to "share" and organize multiaudiosystems.

Also, I'm trying to study Dream Player 2.5 but I can't run it as it is saying there are some missing functions.

I will see this later, no idea as i dont have the source here (Work)

I will include your last example in the next release of BBS...yes!

bye


chwaga(Posted 2008) [#78]
sorry to ressurect a dead thread, but how can I pick the volume at the point being played of a channel, and compare it to the peak volume of the channel?

Also, how can I sample every point in a music file to find the average volume? And how do I check the average pitch of a song (figure out if the song is generally high pitch or generally low pitch)? I'm working on a 2D defend-your-wall game where the levels are autogenerated by music, it works perfectly with Requiem For A Dream, but not much else without entire-file-pitch-and-volume analysis and comparison.


Abrexxes(Posted 2008) [#79]
Hi, i will answer in 12 hours, i dont have the docs here at work. But all this works. (öhm...channelpeak...channelgetattributes...channelsetattributes...öhm...
To resample a channel you need the fx or the mix plugin..? Not shure now)

bye


Abrexxes(Posted 2008) [#80]
Hi, the peak values of a stream you can ask with BASS_ChannelGetLevel (see bass.chm) A channel has no peak, but you can change the volume of the channel and the final mix in realtime. (BASS_SetConfig / BASS_ChannelSetAttributes)

I dont now at the moment how to resample a stream only to avoid peak problems. You can ask in the un4seen forum or write your own DSP function for this.

About "pitch" you must read the bass_fx.chm. There you will find functions for tempo, pitch and samplerate.

bye


chwaga(Posted 2008) [#81]
I dont get how to use all those functions, how can I get the average pitch/volume of a stream, and compare that to the current playback pitch/volume?


Abrexxes(Posted 2008) [#82]
If you load a sample or a stream, bass takes the original datas at 100%. This way you can make a stream faster or slow down, but bass can not see if the stuff loaded has been pitched before (and saved). Also bass will not calculate you an average Volume. If you make your volume to 100%, bass will play the datas loaded (stream, samples) with the maximum off amplitude.

What you can do is write a function that can calculate the average amplitude of a stream, but for this you dont need bass, you must see what for a stream you have (16bit,2 channels, unsigned, 44,1 khz, mp3 and so on) and you need some skills in DSP (DigitalSoundProcessing)

If you search for stuff about all this, search here: http://www.musicdsp.org/

bye


chwaga(Posted 2008) [#83]
I can get a fake average amplitude of a sample using:


but is there anyway I can calculate "ave" for the entire file? Using BASS_ChannelSetPosition in a for loop, doing the above, and getting the average of that doesn't work. I though I had beat the system, but alas, there's something I don't know...


Abrexxes(Posted 2008) [#84]
hmmm....i have never tried this, but if i must do that one time, the first think is to search a REAL formula to calculate this. Maybee it is enought to search the hightest and lowest amplitudes...but in 99% the lowest will be 0......hmmm....

http://en.wikipedia.org/wiki/Amplitude

but if you must work with "clear" datas (raw, wav, iff) you can use Bass to decode (ogg, mp3,...)


Abrexxes(Posted 2008) [#85]
Bug in BBS 1.6.1 and previous (modinfo.bb)

Modinfo "can" crash if you try to get informations (note/fx) of the last pattern in a mod. Please search this codelines in modinfo.bb (from line 212)

SeekFile (tempmod, 952)
	Dim MOD_OrderList%(MOD_Orders-1) ;get orders and last pattern
		MOD_Patterns = 0
		For i = 0 To (MOD_Orders-1)
			temp = ReadByte (tempmod)
			If temp > MOD_Patterns  Then MOD_Patterns = (temp+1)
		MOD_OrderList (i) = temp
		Next


and replace it with this

SeekFile (tempmod, 952)
	Dim MOD_OrderList%(MOD_Orders-1) ;get orders and last pattern
		MOD_Patterns = 0
		For i = 0 To (MOD_Orders-1)
			temp = ReadByte (tempmod)
			If temp > MOD_Patterns  Then MOD_Patterns = temp
		MOD_OrderList (i) = temp
		Next
		MOD_Patterns=MOD_Patterns+1; add last pattern


bye


Abrexxes(Posted 2008) [#86]
The last off. version from modinfo.
This is compatible to BBS 1.6.1...so only replace it.

NEW COMMANDS:

Global MOD_Amiga = 0 ( If 1, returns only first 3 octaves)
MOD_GetRSample$(pattern%,row%,channel%) ; returns a $ Sample from 01 to 31
MOD_GetRFx$(pattern%,row%,channel%); retunrs a $ (ex .F06)

; 1.5 = added Function MOD_GetRSample$(pattern%,row%,channel%)
; 1.4 = added Function MOD_GetRFx$(pattern%,row%,channel%)
; 1.3 = added AMIGA mode
; 1.2 = fixed "last pattern" bug
; 1.1 = fixed "createbank" bug"





All this will be includet in a next version off BBS, but not now (no time)

cu


Abrexxes(Posted 2008) [#87]
News

Jan/feb a new version will come out.

- 100% support of "tag" und track informations
- minor fixes
- bass_tag = removed (out of date)
- new tutorials (some new stuff, some from _33, an a new Sony_Vu_Meter XD)

bye


ervin(Posted 2008) [#88]
Excellent! I look forward to trying it.
Thanks!


Guy Fawkes(Posted 2009) [#89]
whats up w/ BASS_ChannelGetLength() ?


Abrexxes(Posted 2009) [#90]
Nothing, works perfekt for me. Read the bass.chm for some remarks.

bye


Guy Fawkes(Posted 2009) [#91]
No wonder. its b/c its BASS_ChannelGetPosition() . thanks abrexxes :)


Abrexxes(Posted 2009) [#92]
np..i know..the api of bass is bigger (with plugins) than the original B3D or B+.

Thats also my problem, i dont try to wrap some commands, i am wrapping an engine. ;P


Abrexxes(Posted 2009) [#93]
sorry, i need more time. I hope this we (yes we can!)

I have had problems with some blitz limitations (pointers)

Edit: F***, wrong topic, ...this is for John Blackledge


Abrexxes(Posted 2009) [#94]
@mod Please close this!

Thanks