Sign in to follow this  
Followers 0
E1M1

How to play sound directly, not from file.

27 posts in this topic

Does anyone know how to play sound directly w/o reading it from file? SoundPlay() requires sound to be stored as file but is it possible to make script that send sound directly to speakers w/o any saving it to file.


edited

Share this post


Link to post
Share on other sites



#4 ·  Posted (edited)

Try this to play chip tunes directly from memory using bassmod.dll (also from memory):

http://autoit.pastebin.com/VNmkQZWh

I don't have enough free space left to upload it here! :x

Br,

UEZ

Edited by UEZ
1 person likes this

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

@JohnOne beep is not what i am looking for

@UEZ why your code is just a single line when i paste it onto scite?


edited

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

UEZs post:::::

or not, that issue is not limited to just you this time.

Edited by iamtheky

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

@UEZ why your code is just a single line when i paste it onto scite?

Because forum software doesn't like me anymore :x

Use the link instead!

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Where you got that music? it sounds like some nitendo music from 8bit bit game. And what file standards you followed? midi or is it just raw data? and what does $Opcode? does it just load dll into memory or anything more? and where did you get that $Opcode?

Edited by E1M1

edited

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Where you got that music? it sounds like some nitendo music from 8bit bit game.

from http://www.scenemusic.net/demovibes/songs/ for example

And what file standards you followed? midi or is it just raw data?

it is a xm file (eXtended Module)! check out http://www.un4seen.com/ for more details about bassmod.dll and what mods are supported!

and what does $Opcode? does it just load dll into memory or anything more?

the binary strings are the bassmod.dll and the chip sound. it will be loaded to the memory.

and where did you get that $Opcode?

you can convert any file with this code e.g.:

; ============================================================================================================================
; File     : MemoryDllGen.au3
; Purpose  : Convert DLL files to HEX binary data
; Author   : Ward
; modified : UEZ
; ============================================================================================================================

Local $VarName = StringStripWS(InputBox("MemoryDllGen", "Select a name of variable:", "DllBinary"), 3)
If $VarName = "" Then Exit

Local $DllName = FileOpenDialog("Open dll file", @ScriptDir, "DLL file (*.*)")
If $DllName = "" Then Exit

Local $Handle = FileOpen($DllName, 16)
Local $DllBinary = FileRead($Handle)
FileClose($Handle)

Local $LineLen = 1024
Local $DllString = String($DllBinary)

Local $Script = "Func " & $VarName & "()" & @CRLF & @TAB & "Local _" & @CRLF & @TAB & "$" & $VarName & " = '" & StringLeft($DllString, $LineLen) & "'" & @CRLF
$DllString = StringTrimLeft($DllString, $LineLen)


While StringLen($DllString) > $LineLen
    $Script &= "    $" & $VarName & " &= '" & StringLeft($DllString, $LineLen) & "'" & @CRLF
    $DllString = StringTrimLeft($DllString, $LineLen)
WEnd

If StringLen($DllString) <> 0 Then $Script &= "    $" & $VarName & " &= '" & $DllString & "'" & @CRLF
 $Script &= @TAB & "Return $" & $VarName & @CRLF & "EndFunc"
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $Script = ' & $Script & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
ClipPut($Script)

MsgBox(64, 'MemoryDll Generator', 'The result is in the clipboard, you can paste it to your script.')

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Very Cool! UEZ you're the user that just keeps giving! :x


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

very nice, greate thanks UEZ.


edited

Share this post


Link to post
Share on other sites

hi,

I want to play sounds like wave files in my script. But I want that nobody can play this files. So I have to encrypt the files or to include the files. But i didn't find a way to encrypt and play the files. Now i'm here and the question is: Can I include wave files into my script and play them? If yes, how? Can anybody explain it to me please? I'm a new programmer :x.

thanks.

Timtam

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

Here another method to play wave audio files from memory!

Source code here: http://autoit.pastebin.com/0fYwC9tZ

Original code by wolf9228 from this topic:

To create a binary string look to post #11.

Br,

UEZ

Edited by UEZ
1 person likes this

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Can you tell me what part of post #11 you mean? the dll to hex binary? But this is only for dll's or can I convert other files into binary too?

Share this post


Link to post
Share on other sites

Can you tell me what part of post #11 you mean? the dll to hex binary? But this is only for dll's or can I convert other files into binary too?

Yes, with the code from post #11 you can convert any kind of files to a binary string whereas binary files only would make sense!

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Here another method to play wave audio files from memory!

Source code here: http://autoit.pastebin.com/0fYwC9tZ

Original code by wolf9228 from this topic:

To create a binary string look to post #11.

Br,

UEZ

How to create WAV files (stereo, with volume and frequentz control for each channel (left,right)) in this form ..... like above example!?

Playing in memory!

Share this post


Link to post
Share on other sites

Is there any way to play MP3 files from memory?

tnx

Share this post


Link to post
Share on other sites

tnx Zenda

i don't how to use it.

i've just replaced my own MP3 with the music in example above and it didn't work:(

Share this post


Link to post
Share on other sites

#20 ·  Posted (edited)

Here an example how to play a MP3 music from memory using FMOD.dll (also from memory ;) )

Play MP3 from mem using FMOD

Press ESC to stop sound and exit code.

Credits: MemoryDLL call code by Ward.

The Germans might know where the sound is from. :D

Br,

UEZ

Edited by UEZ
1 person likes this

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0