GM Audio Save

GM Audio Save is a new extension for Gamemaker Studio Devs!!

GM Android Audio Modder can be used in GMS 1.4+, GMS 2x .
Project minimum SDK is 14 or higher, recomended target sdk & build tools is 26. This extension is also compatible with Android OS 6 and up's permissions rules and regulations.

The asset can be found on the marketplace here.
The GM Audio Save homepage can be found here.
And here is the homepage for using the music player part of the extension.
And a Test apk can be download here.

HIGHLIGHTS:
- Total of 30 functions available
- Automatic permission handling in case OS >=6
- Create player accessible file system including folders and files
- Record audio and save as .wav, .raw, .mp3 or set to ringtone
- Find audio and music on Android device
- Set any audio found or recorded as Android Device's default ringtone
- Move any found music files to public or game folder(s) of your choice including your game's included files
- Get the path address to audio files found
- Get file extension type for audio files found (Very useful to import .ogg on the fly in your game!)
- Alert the Android operating system that a new file is available for other apps to find
- Play audio
- get all types of info about audio tracks found
- Pause
- Next
- Previous
- Go to specific track
- Go to specific time in track
- Resume

Recomended developer skill level: COMPATANT to ADVANCED
To use this extension to it's full potential you need to know your way around Arrays, string manipulation, maths and other common programming criteria. Altho the asset package has an included example project, it is large and involved to show off everything the extension can do, and a noob/novice programmer will have difficulty figuring it all out and how to best use these functions.

GM Android Audio Modder lets you move copy, record audio files, and move and access your games included files for game moddability!
This extension can be used in GMS 1x, GMS 2x and with any other extensions EXCEPT my extension GM Android Music, for
that reason all the functionality of GM Android Music is included in this extension!
Project minimum SDK is 14 or higher, recomended target sdk & build tools is 26. This extension is also compatible with
SDK 25+ permissions rules and regulations.
GM Audio Save - Modder's edition alows you to do the following things:
Find music on Android device
Move music files and any file type recoginzed by GMS'S to public folder that you or the player named
Make your own public game folders
Get file extension type for audio files found
Get the path to audio files found
Move files from the Included files folder to public folder that you or the player named
Alert the Android operating system that a new file is available
Record audio and save as .wav, .raw, .mp3
Set any audio found as Android Device's default ringtone
Requirements:
Must have Gamemaker: Studio 1x or gamemaker Studio 2, and the Android module.
must use minimum SDK setting 14 or higher in your project
Testing is easy, All the test code is in a script called tester. The 2 buttons to the right of the stereo are used to cycle through all the
things you can test in the new part of the extension. The important object to test this demo game is object ctrlr in the Android music
folder in the resource tree of the project. You can find the test controlls in the left pressed and left released events, and all the related
working/modifiable code is in the script called tester.if recording only or transfering files from your game's included files you don't have
to press Y to bring up the music player. (to test functions 5 and 7 you still must bring up the music player with the Y button to load the
music from the user's device of course) When the app opens simply tap the 8ball, name your folder and press ok. When the game
starts press Y to start the player and test the functions by pressing the up/down arrose to the right of the stereo. Depending on the test,
tap or hold the stereo to perform the test.
The testable functions: ** see below for TEST PROJECT TECHNICAL INFO on the test aspect of this project
Test # 0 = record as wav and save to new folder, hold down on stereo while recording, release to stop recording.
Test # 1 = record as raw and save to new folder, hold down on stereo while recording, release to stop recording.
Test # 2 = record as wave and set as ringtone and save to ringtone folder, hold down on stereo while recording, release to stop recording.
Test # 3 = record as mp3 and save to new folder, hold down on stereo while recording, release to stop recording.
Test # 4 = Copy audio from device to new folder - music player must be open
Test # 5 = Copy audio from device and set as ringtone - music player must be open
Test # 6 = Copy audio from game to new folder
Test # 7 = get file extension of tracks found on device, usefull to import music for game to play that has to be of the .ogg format for example -
music player must be open
Details:
Other important objects:
obj_main: draws all the info text, Controls the Windows OS recording features. I put this in the example project as a reference to how yoyo games handles recording on the windows platform, and also because this functionality only available in windows is was what inspired me to make this extension for Android.
controller: sets up the permissions and all global variables, names folder on gamestart.
obj_controller: make another/more folder(s).
The functions:
TrackAdress(double); Returns absolute path of selected track number
StartRec(string, double); Name the file, select recorder type, example: "name.ext", 0 = wav, raw or ringtone. 1 = mp3. (mp3 recorder is different from
wav/raw recorder)
StopRec(double); Save the file, 0 is for .wav, 1 is for .raw, 2 is for set as ringtone and 3 is for .mp3
GetFileExt(The track number); is to get the file extension of any audio file found on the device, so for example if you have .ogg music files on your android device you can use this function with gms' audio_create_stream function to get and mod the music in-game.
SaveFromAs(string, string, string, double); This function has several uses, with it you can save music found on the device to a new folder, save files from your games included files to a new folder, set music from the device or your game's included files as the default ringtone for the device, so the format for using this function has 2 different setups and here are the examples:
if you are moving music found on the device to a new folder or setting one as a ringtone:
SaveFromAs(string, string, string, double); Input path, output path, file name, 0 or 1: 0 is move the audio file, 1 is move the file to the ringtones directory
and set as the default ringtone
If you are moving files from the included files of your game to new folder:
SaveFromAs(string, string, string, double); bytes data string,output path,file name,size in bytes
To use it you must create a buffer with the file stored in it and encode the data to string using the buffer_base64 gms function, full example:
Code:
fname = "starter.wav";//Other included files to try: "startup.ogg" "README.txt" "Saveimg.png"
if(file_exists(fname)){
  file = file_bin_open(fname,0);
  size = file_bin_size(file);
  gameTransfer = buffer_create(1024, buffer_grow, 1);
  for(var i=0;i
Note that only files recognized by GMS can be used, for example you CANNOT use .mp3 files because gms's buffers do not recognize them
because .mp3 is coppywrite protected. Recognizable files include .wav, .raw, .ogg, .txt, .png and other image files
GetFldr(string); "Folder_Name/More_floder_names" This function is used to get the output path to a public folder, you supply the name, and to
make folders inside of folders just use the / character followed by the next folder's name
OsUpdt(string); Folder address/file_name.ext This function updates the android os of a new file so other apps on the device can find and use them.
exitTheApp(); This is a bug fix for GMS 1.4.1804 that allows you to close your app/game in code by simply calling this function.
FUNCTIONS FOR GM Android Music part of extension:
PauseMusic() - pauses the music if playing
MusicStopped() - use to check if music is stopped
NumberOfTracks() - use to find number of tracks
ResumeMusic() - plays music if paused
PlayMusic(Track_Number) - play a particular song
GetCurrentSongName() - gets the currently playing song name
GetCurrentArtistName() - gets the currently playing artist name
MusicPlaying() - use to check if music is playing
NextTrack() - play the next song
PreviousTrack() - play the previous song
GMASInit() - Call at game start, automatically requests permissions * see IMPORTANT note
GetSongName(Track_Number) - get the name of a particular song
GetArtistName(Track_Number) - get the name of a particular artist
MusicPaused() - use to check if the music is paused
StopMusic() - stop the music
GoToTrack(Track_Number) - go to a particular track, simillar to PlayMusic()
Final() - end all music and music player processes
GetSongLength(Track_Number) - gets the length in milliseconds of a requested song, catch the real number in milliseconds in the social async event: key="show", value="lengths". A formatted string mm:ss:ms is also sent to the social async event with the key "songlengthstring" which in it's self holds the pre formatted string for your convieniance.
GetCurrentSongLength(Track_Number) - gets the song length in milliseconds of the song currently playing
GoToSeek(Time_In_Milliseconds) - go to any position in the song by inputting the milliseconds
GetElapsedTime() - gets the time elapsed since the song started playing, in milliseconds
AutoPlay(0 or 1); //0 = Don't play next track when current track finishes, 1 = Play through all tracks
* IMPORTANT!! If your app isn't going to allow user to change their ringtone, DO NOT ask for WRITE_SETTINGS permissions group,
Remove these permissions in the manufest: WRITE_SETTINGS, CHANGE_CONFIGURATION and MODIFY_AUDIO_SETTINGS
(double click extension and select android tab to view/change) The reason for this is as follows as per the new google play rules and
regulations stating that no app shall request permissions it doesn't use and/or need.
** TEST PROJECT TECHNICAL INFO, The script named tester shows how to do several things:
Code:
//arguments, set testtype variable to trigger desired argument (0-6)
//0=record as wav
//1=record as raw
//2=record as wave and set as ringtone
//3= record as mp3
//4= Copy audio from device to new folder
//5= Copy audiofrom device and set as ringtone
//6= Copy audio from game to new folder
//7= get file extension of tracks found on device, usefull to import music for game to play that has to be of the .ogg format for example
//8-11 stop recording and process, triggered automatically in left released event of object ctrlr
//left mouse pressed
if argument0=0 StartRec("newWav.wav",0);
if argument0=1 StartRec("newRaw.raw",0);
if argument0=2 StartRec("newRing.wav",0);
if argument0=3 StartRec("NewMp3.mp3",1);
if argument0=4 SaveFromAs(TrackAdress(3),global.myFolder,"coppied",0);
if argument0=5 SaveFromAs(TrackAdress(3),global.myFolder,"newRingtone",1);
if(argument0=6)
{
fname = "starter.wav";//Other included files to try: "startup.ogg" "README.txt" "Saveimg.png"
if(file_exists(fname)){
  file = file_bin_open(fname,0);
  size = file_bin_size(file);
  gameTransfer = buffer_create(1024, buffer_grow, 1);
  for(var i=0;i




2 comments:

  1. I want to buy it but I can't buy on Yoyo market places. I really need it for my music project. (Mình muốn mua nó nhưng trên chợ không mua được do k có tài khoản trả phí)

    ReplyDelete
  2. Mình biết bạn ở Việt Nam nhưng mấy lần liên hệ qua email mà không được. Nếu có bạn giúp mình. Mình muốn mua cái phần chạy được nền trên android của game maker này nè.

    ReplyDelete