|
||
Title: script to initiate and receieve Midi Sample Dump Post by mercury on Nov 25th, 2018, 4:44pm Hi, I have managed to hack together a script in Windows PowerShell to send and receive SysEx messages but I'm now scratching my head on how to expand this to support SDS messages. The issue as I see it may be the handshaking. I haven't figured out how to implement a sink method in PowerShell yet so for now I am simply looking for the end-of-exclusive byte to break the receive loop. SDS responses will have multiple messages so I need to change things to support that. What I would like to achieve is to issue a command to receive a specific sample and store the result in a variable and eventually export this to a wav file. I have code and some command line programs that will convert a .syx file to .wav so If I can just get the syx format or even the full string that MIDI-OX will receive by default that would get me across the line. FYI, this is a for a project of mine to archive samples from my ancient Peavey DPM SP sample player. So far I have got working code to Load a bank from Disk, pull all the SysEx info for all objects and generate a keymap description for all the presets. Given the proprietary disk format I need to rely on SDS to recover the samples to my PC. Once that is achieved I can then create new sound programs in a virtual sampler such as ESX24. Obviously the use of PowerShell is my choice but I'll be happy to receive VBScript code for the solution which I can then try and translate. Here is my function that returns either an array of hex values or a concatenated string (with a space delimiter). It expects an array of hex values as input: function Get-SysExResponseMessage{ param( [object]$SysExCommand, [switch]$AsText ) $EOX = "F7" $IsEOX = $false If($SysExCommand[$SysExCommand.GetUpperBound(0)] -ne $EOX){$SysExCommand += @($EOX)} # Attach missing EOX if required [string]$SysExString = $SysExCommand -join " " $MOX.SendSysExString($SysExString) $SysExResponseMessage = "" While ($IsEOX -eq $false){ $MidiResponseMessage = $MOX.GetMidiInput() If ($MidiResponseMessage -ne "") { Write-Host "MSG Receiving...($SysExResponseMessage)" -for cyan If (([Int](($MidiResponseMessage -Split ",")[1]) ) -eq 240) { # SysEx, must ask for SysEx string message "&HF0" Write-Host "Receiving SysEx Dump" -for green $SysExResponseMessage += $MOX.GetSysExInput() if($SysExResponseMessage -like "*$EOX*"){$IsEOX = $true} } } } If ($AsText -eq $true){ Return $SysExResponseMessage.Trim() } else { Return $SysExResponseMessage.Trim() -split " " } } |
||
Title: Re: script to initiate and receieve Midi Sample Du Post by mercury on Dec 2nd, 2018, 2:35am Success! example script below. I over-thought some of it initially, I should be doing checksums and sending hand-shaking messages but 3 seconds of no more messages does the job for now. Code:
|
||
MIDI-OX User Forum » Powered by YaBB 1 Gold - SP 1.3.1! YaBB © 2000-2003. All Rights Reserved. |