0
0

hi guy i would like to know if someone knows where i can find tutorial to use fmod and specially spectrum
or if someone can send me a part of code
where we load a sample and analyse the sample with get_spectrum() function
in c.
very thanks to all

  • You must to post comments
0
0

thanks
but in fact i have done it i have put the setactive of the cpu when i play my sound
and the problem is when i call this fucntion

titi *float
int spectrum ()
{
titi=FSOUND_DSP_GetSpectrum();
printf(“%f\n”,titi[1]);
}

so it segfloat
i don’t undertsand why the last line is wrong
thanks for help
malo

  • You must to post comments
0
0

U can get a piece of code with the Fmod sample code, in the /samples/fmod directory, there is a spectrum and a oscilloscope exemple within the source code.

  • You must to post comments
0
0

where is the /samples/fmod directory ?

  • You must to post comments
0
0

In the root of the extracted zip file.

  • You must to post comments
0
0

hi, can you explain me how can i make an oscilloscope with fmod, gtk in C with linux?
it would be great to send some source code
tahnks a lot 😉

  • You must to post comments
0
0

Hi all!!! I’m new form here.

I have the same problem of eben, namely I don’t know where is
the /samples/fmod directory!!!
And I haven’t been able to find it!!!

Please help me and tell me the path to arrive in the folder /samples/fmod… LIKE:(http://52.88.2.202/………..)

Or if it’s in a file to download, tell me the name of the file and also if
into the file there is this folder!!!

I need some example about the spectrum.
:(

  • You must to post comments
0
0

hi
i ‘ve got the same problem
i have used the tutorial but the things is first i have a warning of the first argument of setactive like it used in the tut
and getspectrum does it return a float pointer?
thanks for help
malo

  • You must to post comments
0
0

hi, when i try to escape the sample stream with the key “esc”, i’ve got a segmentation fault can you tell me why if you’ve got an idea

this is the end of the main

FSOUND_Stream_Close(stream);

FSOUND_Close();

return 0;
}
View users profile

  • You must to post comments
0
0

Okay, here’s a small example for PureBasic:
all behind ; is a comment

[code:2tu356io];______________ Declarations ::

Declare updateFFT() ; declares the Proc

Structure fftarray ;the structure for the FSOUND_DSP_GetSpectrum()
value.f[512]
EndStructure

If InitSprite() = 0 ; Try to open DirectX
MessageRequester("","Sorry, problem with InitSprite() – no DirectX 7.0 ?",0):End
EndIf

hwnd=OpenWindow(1,0,0,520,264,#PB_Window_SystemMenu|#PB_Window_ScreenCentered, "Mini-FFT-Spectrum Visualization using FMOD by www.schalldesign.com")
OpenWindowedScreen(hwnd,4,60,512,200,0,0,0) ; opens a screen on the window

CreateSprite(1,512,200,0) ; creates a temporarily sprite

FSOUND_SetBufferSize(125) ;in- or decrease, if you want to

;initialize FMOD and create menu + gadgets
If hwnd <> 0 And FSOUND_Init(44100, 32, 0) And CreateMenu(1,hwnd) And CreateGadgetList(hwnd)
MenuItem(1, "open")
MenuItem(2, "play")
MenuItem(3,"stop")
TextGadget(1,5,10,512,20,"Music-File: " + soundfile.s,0)
resume.b=1
EndIf

;_____________ Main Prog ::
While resume
updateFFT()
Select WindowEvent()
Case #PB_EventMenu ; (select a menu item...)
Select EventMenuID()
Case 1 ;(Open)
temp_filename.s = OpenFileRequester("","","PCM-MusicFiles (.mp3, *.wav, *.mp2, *.ogg, *.raw)|.mp3;.wav;.mp2;.ogg;.raw|.|.",0,0)
If temp_filename
soundfile.s = temp_filename
SetGadgetText(1,soundfile)
EndIf
Case 2 ;(Play)
hstream = FSOUND_Stream_OpenFile(soundfile,0,0) ;open the soundfile
If hstream <> 0
FSOUND_DSP_SetActive(FSOUND_DSP_GetFFTUnit(), #TRUE) ;activate the FastFourierTransformation-DSP-Unit
FSOUND_Stream_Play(1,hstream) ;play the stream on channel 1
EndIf
Case 3 ;(Stop)
For i=255 To 0 Step -1 ;a small fast fade-out to prevent a clipping-sound
FSOUND_SetVolume(1,i)
Next
FSOUND_Stream_Stop(hstream) ;stop playing the stream
FSOUND_SetVolume(1,255) ;reset volume to max
EndSelect

Case #PB_Event_CloseWindow ; (systemmenu close...) 
  resume=0 
  FSOUND_Stream_Stop(hstream) ;stop playing the stream 
  FSOUND_DSP_SetActive(FSOUND_DSP_GetFFTUnit(), #FALSE) ;set the FFT-DSP-Unit inactive 
  FSOUND_Close() ;shut down FSOUND 

EndSelect
Wend

;The following procedure updates and displays the fft-visualisation
Procedure updateFFT()
If FSOUND_DSP_GetActive(FSOUND_DSP_GetFFTUnit())
CopyMemory(FSOUND_DSP_GetSpectrum(), hfft.fftarray, 4512)
EndIf
StartDrawing(SpriteOutput(1)) ;Starts Drawing on the sprite
Box(0,0,512,200,$000000)
For i=0 To 511
actfftvalue.f = hfft\value[i]
199 ;linear y-scale
Box(i,200,1,-1-actfftvalue, (255-actfftvalue) * $000100 + actfftvalue * $000001) ;Draw a line with various colors, linear x-scale
DrawingMode(1) ; sets Text background transparent
FrontColor(255,255,255) ;white of course
cpuusage.s="CPU: "+StrF(FSOUND_GetCPUUsage(),1)+" %" ;create CPU-String
Locate(508 – TextLength(cpuusage), 4) ;position upper right
DrawText(cpuusage) ;draw the text
Next
StopDrawing() ;Stops drawing on the sprite
FlipBuffers()
DisplaySprite(1,0,0) ; display the sprite
EndProcedure
; ExecutableFormat=Windows
; Executable=E:\Daten\PureBasic\FFTSpectrumAnalyser\FFT-Mini.exe
; EOF[/code:2tu356io]

Here you can see what it does:

[url:2tu356io]http://www.schalldesign.com/!opendir/FFT-Mini.zip[/url:2tu356io]

Hope I could help.

  • You must to post comments
Showing 9 results
Your Answer

Please first to submit.