Responding to audio stream?

Miscellaneous Forums/General Discussion/Responding to audio stream?

Hi,

does anyone know of a way to be able to 'read' an audio stream so you can repsond to it.

Let me explain, I would like to write a tiny MP3 type player that has it's own visualisations like media player but you have to be able to 'listen' to the music peaks etc.

Any thoughts?

Bass.dll or Fmod

What he said.

ta - fdmod looks too expensive.

Any idea how you do this in BASS and is there a userlib?

This does a little vumeter type thing in BlitzBass but the Bass license isn't free for commercial...
;
; BLITZBASS - V1.00 - Written and (C)opyright, Rob Hutchinson 2002!
; -----------------------------------------------------------------
;
; Tests the Blitz interface to bass.dll...
; OGG/MP3/MP2/MP1/WAV Streaming Test... Streams from disk. Change file at time of source..
;

sFileToStream$ = CurrentDir() + "chain.mp3" ; Your mp3 here.

; Required include...
Include "blitzbass.bb"

Graphics 600,500,0,2
AppTitle "Blitz BASS - Disk Music Stream Test V1.00"

; Enumerate devices on system...
Global iDeviceCount = 0
While BASS_GetDeviceAvailable(iDeviceCount)
	Print "Device #" + (iDeviceCount + 1) + " - " + BASS_GetDeviceDescription$(iDeviceCount)
	iDeviceCount = iDeviceCount + 1
Wend

If iDeviceCount = 0 Then RuntimeError("No sound driver installed!")

Print ""

Global userdevice = 0
While userdevice = 0 Or userdevice > iDeviceCount
	userdevice = Input("Select A Device (1-" + iDeviceCount + "): ")
Wend
userdevice = userdevice - 1

Print ""
Color 255,0,0 : Print "Using Device #" + userdevice + " - " + BASS_GetDeviceDescription$(userdevice) : Color 255,255,255

Print ""
Print "Initialising BASS: "
If BASS_Init(userdevice,44100,BASS_DEVICE_OGG,0)
	Print "BASS Initialised Correctly!"
Else
	RuntimeError "Initialisation of the bass.dll went tits-up! Something bad is a-foot :)"
EndIf

Print ""
If BASS_Start()
	Print "Digital Output Started!"
Else
	Print "Unable To Start Digital Output!"
	Print "[Any Key to Terminate]"
	BASS_Free()
	WaitKey
	End
EndIf


; Load the OGG test file...
Global stream = BASS_StreamCreateFile(0,sFileToStream$,0,0,0)
	If stream
		channel = BASS_StreamPlay(stream)
	EndIf
		Print "File '" + sFileToStream$ + "' Playing..."
	Print "[Press Any Key]"
BASS_MusicSetPositionScaler(stream,10) 
SetBuffer BackBuffer()
While Not KeyHit(1)
    Cls
	Print "File '" + sFileToStream$ + "' Playing..."
	drawfft(200)
	Flip	
Wend

BASS_StreamFree(stream)
BASS_Stop()
BASS_Free()
End
Function DrawFFT(coloring)
	sdbank = BASS_ChannelGetData(stream,BASS_DATA_FFT2048)
	
	For a = 0 To 1024
		fftd# = PeekFloat(sdbank,a * 4)
		ncl = coloring + (fftd# * (255 - Float(coloring)))
		Color ncl,0,ncl
		If fftd# <> 0.0 Then Line a,(GraphicsHeight() / 2),a,(GraphicsHeight() / 2) - (fftd# * (GraphicsHeight() / 1.5))
		Color 255,255,255
	Next

	FreeBank sdbank
End Function

Might be what you want.

Any ideas where I can find the latest Blitz Bass?

BlitzBass 1.6

Is the BlitzBass author still around, the reason I ask is Bass is now on version 2.x

Is there a way with BlitzBASS to 'listen' to an incoming stream or even the output stream. For example if you were listening to an internet radio station or line in on your sound card how could you track that?

It seems the lastest BASS does this through BASS_RecordInit and BASS_RecordStart. These functions are not exposed/available in BlitzBASS.

HELP! Any thoughts?

Anyone?

bump

The latest post from Rob Hutchinson was 7 months ago, so one might guess that he has moved on to something else?
Either that, or he's just too busy actually making stuff, rather than posting here.. :p

*** SOLVED IT ***

Can get at the sample data from ANY input (internet radio, audio in, mic etc etc).

I am so happy!

If you want something done, do it yourself :-)

There was an example with BlitzBass, wasn't there?

nope!

BlitzBass used BASS 1.6, BASS 1.6 does not have the record functions needed to do this.

Yes with BlitzBASS you could start a MP3 playing then get at the sample data BUT you could NOT get a Blitz app to get the sample data coming from an externally started source.

For example if you plug you hi fi into your audio in on your sound card, with Blitz BASS you could not draw a VU meter based upon that input. At least I could not find a way to do it without the record functions.

I can do this now as I have BASS 2.3 working with Blitz through the userlibs mechanism.

[edit]
Now I wonder if there would be any interest in a BASS 2.3 decls file?