MusicFreq
MusicFreq Index, FreqValue
 
Parameters:

    Index = The Index of Music you wish to alter
    FreqValue = The Freq of this music channel (0 to 44000)
Returns: NONE
 

MusicFreq will set the play back frequency of this Music. Frequency lets you manually control the speed at which a sound is played back. By changing the speed, your changing the pitch of the music. Playing it faster will make it higher, slower will be lower.

By default Musics get their play back frequency during loading with LoadMusic. Frequencies range from 0 through 44000.



FACTS:


* MusicFreq values range between 0 to 44000

* MusicFreq will NOT effect MOD format musics

* Changing MusicFreq while a music is playing, will alter the played musics frequency also.

* You can find this Example in the PlayBasic\Projects\Music folder





Mini Tutorial:


This example will load a music file then let the user control the musics playback with various keyboard controls.

  
; Set the app to run no faster than 30 frames per second
  SetFPS 30
  
; Ask PlayBASIC for the Music Index that is currently free for use.
  MyMusic=GetFreeMusic()
  
; Load a Sound File into this Free Music
  LoadMusic "..\..\..\sfx\out.wav",MyMusic
  
;  Play the Music
  PlayMusic MyMusic
  
  
; Start a Do/loop
  Do
   ;Clear the Screen top black
     Cls RGB(0,0,0)
     
   ; display a message
     Print "Music Freq Is Panning"
     
   ; Bump the Angle# variable by 1
     angle#=WrapAngle(angle#,5)
     
   ; Bend the music freq by a sine wave.
     MusicFreq MyMusic,22000+CosRadius(angle#,22000)
     
   ; Display the Music curremt Freq value
     Print GetMusicFreq(MyMusic)
     
     If GetMusicPlaying(MyMusic)=0
        PlayMusic MyMusic
        angle#=0
     EndIf
     
   ; display the screen
     Sync
   ; Loop back to the DO statement.
  Loop
  
  




 
Related Info: DeleteMusic | GetFreeMusic | LoadMusic | LoopMusic | MusicVolume | PlayMusic | StopMusic :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com