VoxCommando

Help and Support (Using VoxCommando) => XBMC (Old board see 'KODI' above) => Topic started by: thesystemera on May 06, 2013, 11:18:30 AM

Title: Save the audio file from VoxWav to a custom folder.
Post by: thesystemera on May 06, 2013, 11:18:30 AM
I want to be able to speak a command to VoxCommando that triggers VoxWav to save the next audio event it gets..

Basically. I say start recording or "shoutout" and then the next time I press the button it saves that recording to a custom folder. Worth noting that the speech recognition would have to be temporarily disabled as to not interrupt with the system. 

The custom folder is an active smartplaylist in XBMC so my recording is then played back to me moments later amongst my music and podcasts :D

Cool huh :D
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: jitterjames on May 06, 2013, 12:31:18 PM
save the next audio event it gets..

What do you mean by this part?

Quote
the next time I press the button
the button?
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: jitterjames on May 06, 2013, 09:09:18 PM
I somehow missed that you were talking about VoxWav, so now it makes more sense to me.  :biglaugh
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: jitterjames on May 06, 2013, 10:08:56 PM
I could probably modify the tcpmic plugin to allow for this. Would you want to specify the full path with filename, or just the folder and have the filename be generated / incremented automatically?
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: thesystemera on May 07, 2013, 01:24:06 AM
Folder and filename.  Filename will need a date/time stamp or something like that.  Basically the idea is that I test this between two XBMC's with a shared library, I am able to relay the messages between computers in correct order between the music and podcasts.. 

For a home system that's pretty cool, a kind of intercom inside your home.  "Honey can you find my socks" she's in the kitchen hears the message between the songs.  You'd have to have a pretty big house for that right, not to actually hear.  Better one "Kids go to bed!" ahahah

I'll post you more detail about I'm doing here.  Thanks James. 
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: jitterjames on May 07, 2013, 02:18:31 PM
OK done.

Update the tcpmic plugin with the attached files and restart VC.

import the following group for testing:
Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<commandGroup open="True" name="voxwav save next wav" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="923" name="save next wav" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>TcpMic.SaveNext</cmdType>
      <cmdString>savenexttest.wav</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>save next wav</phrase>
  </command>
  <command id="924" name="play the wav" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Sound.PlayWav</cmdType>
      <cmdString>{1}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>TcpMic.WavSaved</event>
  </command>
</commandGroup>

The sample command will play back your wav file immediately after saving it.  You'll have to figure out how to work this into your XBMC scenario though.  I'm not sure how you are going to do that.
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: thesystemera on May 08, 2013, 03:56:13 AM
Does not seem to be working, where does it save the .wav to.  I tried specifying a directory in the only parameter box I could see with no luck. 

Just to be clear.  What I"m trying to do is quite neat.  I activate the command by saying "shoutout" then the next time I activate the plug-in, what ever I say is recorded and then shipped off to a folder for XBMC to then pick-up and import into a playlist. 

On that note.  This is my other small issue.  The .wav needs to contain title and genre details as to allow XBMC to recognise it in 'library mode'.  The file also needs to be timestamped or something to allow it to not clash with other files.

If you had the time, the best thing would be to allow a custom name such as "lounge-01" with a custom Title and Genre heading able to be applied.  This way the TTS can read out who made the .wav and I can use the genre field to filter out the style of the response from the TTS. 

This will be very cool on a household with multiple XBMC's but also it allows me to crudely demonstrate the 'shoutout' concept of hushfm

PS:  Should move this to Google+ Communities.  Everyone is going to wonder what I'm going on about LOL and it's much easier to search and keep track of these conversations..

 
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: thesystemera on May 08, 2013, 04:01:35 AM
PS: I found the wavs..  I think it wasn't working because I temporarily actived 'detect silence'.   My bad.  Still though need to find a way to stamp them with a title and genre.  Is there any batch style commands or programs you know that can apply such changes to a file or many files at once. 

Thanks..
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: thesystemera on May 08, 2013, 04:20:46 AM
No something weird is going on..  It won't let me save more than one directory tree from root. 

example: z:\library\shoutout\test.wav

saves the files z:\library\shoutouttest2013_5_8_19_19

Any ideas, not a biggy at the moment as stated I still need to address the file details issue any way, thing is it is working D

Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: jitterjames on May 08, 2013, 08:04:44 AM
No something weird is going on..  It won't let me save more than one directory tree from root. 

example: z:\library\shoutout\test.wav

saves the files z:\library\shoutouttest2013_5_8_19_19

Any ideas, not a biggy at the moment as stated I still need to address the file details issue any way, thing is it is working D



Sorry, Iooks like I forgot to add a backslash.  I only tested saving with just a filename, which puts it in the VC folder. Easy to fix.

Adding meta tags will be much more difficult.
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: jitterjames on May 08, 2013, 11:56:46 AM
I fixed the path problem.
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: jitterjames on May 08, 2013, 11:58:11 AM
This will insert the wav into the xbmc playlist immediately after the currently playing song.

You need to have the python plugin enabled, simply so we can add 1 to a number!

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<command id="924" name="play the wav" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>Sound.PlayWav</cmdType>
    <cmdString>{1}</cmdString>
    <cmdRepeat>0</cmdRepeat>
  </action>
  <action>
    <cmdType>XJson.Raw</cmdType>
    <cmdString>Player.GetProperties&amp;&amp;"playerid":0, "properties":["percentage","playlistid", "position","time","totaltime"]</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>XJson.ParseTokens</cmdType>
    <cmdString>{position}</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>PY.ExecString</cmdType>
    <cmdString>result = {lastresult}+1</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>OSD.ShowText</cmdType>
    <cmdString>{LastResult}</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>XJson.Raw/</cmdType>
    <cmdString>Playlist.Insert&amp;&amp;"playlistid": 0, "item": {"file": "{1}"}, "position":{LastResult}</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>XJson.Raw</cmdType>
    <cmdString>GUI.ActivateWindow&amp;&amp;"window": "musicplaylist"</cmdString>
    <cmdRepeat>0</cmdRepeat>
  </action>
  <event>TcpMic.WavSaved</event>
</command>
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: thesystemera on July 30, 2013, 10:35:50 AM
Hey James I've got an idea, I'm wondering with the current modifications of the TCPmic would it be doable. 

In a nutshell. A bit like 'shoutouts' I'm thinking about the 'bubbles' concept in regards to tracks. 

As I explain in the video.  'bubbles' are like review, comments, notes that people can attach to any audio event that is currently playing, allowing for other users to then listen to that audio event at a later date. 

There's no point for me implementing this for songs as I can't be bothered reviewing each and every song in my POC database but doing it for the band in general would be cool as I only have a handful of bands. 

So is there a way I can get the TCPmic save wav function to save the wav with the bands name included, so as to then allow retrieval of that specific file when the band plays again.  On top of that can I use a random wildcard situation if there are multiple files saved for a specific band. 

EG: retrieve any file from Z:/library/bubbles/{last.resault}*.wav

The whole idea is I can use short reviews like stings, so when a song start playing you have a sting play at the intro of the song alongside the TTS voice "Wow I love this band, they are great" example and I can use longer recordings as actual reviews...So as to when you request a review for example. 

Any way, thoughts?

I know it's just a POC, but the more realistic it is, essentially the better it is as a tool when utilising talent, programmers and potential funding.  Also is going to make the killer home media system when I implement video :D

Thanks James. 
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: jitterjames on July 30, 2013, 10:59:20 AM
You can use maps.  Did you see the intro video for maps?

When you save the wav file you can ask XBMC for the artist id, then store the id and filename in maps using the artist id as the key.

Later when a new song comes on, you can use maps to find the wav filename.
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: thesystemera on July 30, 2013, 11:06:47 AM
Okay, what about randomisation of extension in cases of more than one file?  I will hunt down this video your talking about..
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: jitterjames on July 30, 2013, 11:09:48 AM
That would obviously be more difficult. Baby steps.
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: Kalle on July 30, 2013, 11:12:59 AM
Quote
The whole idea is I can use short reviews like stings, so when a song start playing you have a sting play at the intro of the song alongside the TTS voice "Wow I love this band, they are great" example and I can use longer recordings as actual reviews...So as to when you request a review for example. 


If I understand you correct, there is no problem to create a command with a logic block to have comments like "this is a great song" or similar, particular when you use media monkey. There is in the basic VC installation for MediaMonkey a command available "what rating" (I think so) and if you edit this command - put a logic block in with IF (AcontainsB OR A==B) with {LastResult} for A and 100 as B THEN TTS.Speak - this is a great song | my favorite song | top hit ...

and you can insert for each rating (0, 10, 20 ... 100) a logic block

you can also edit the MediaMonkey ini file and insert a custom column (with comments) to use it in VC as result.
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: thesystemera on July 30, 2013, 12:02:37 PM
PS: Loving MAPS, especially the set command, this will be useful.

Slightly misunderstanding me.   I want a database of .wav files associated to specific tracks with the option of more than one .wav per track. 

When a track plays, the .wav is triggered, playing a brief interlude saying what ever had been previously recorded by the end-user. 

EG: Nine Inch Nails is playing, you ask to leave an audio comment (review, sting).  The system records your quick comment "Man I love this band, they are great".  Next time that band plays, the comment is then played back to you over top of the beginning of the music.  Some times there are going to be more than one comment per artist hence the "nine inch nails*.wav"

I've all ready found good use for the MAPS tables.  I have a lot of play-lists that use the same shuffled randomised TTS responses, I like to add variety of responses, the MAPS function allows me change it all in one place while applying global effect, very useful. 



Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: thesystemera on July 30, 2013, 12:08:10 PM
Quote
[put a logic block in with IF (AcontainsB OR A==B) with {LastResult} for A and 100 as B THEN TTS.Speak - this is a great song | my favorite song | top hit ...

and you can insert for each rating (0, 10, 20 ... 100) a logic block

What you suggested here has just given me a good idea.  I wanted the TTS to say "Another 90s classic" and I can see if {item.genre} is less than 2000 say "Another 90s classic" for example.  Very cool.  
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: jitterjames on July 30, 2013, 07:34:53 PM
Some times there are going to be more than one comment per artist hence the "nine inch nails*.wav"

You should be able to use the action:
Code: [Select]
File.GetRandFile
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: thesystemera on July 30, 2013, 10:28:54 PM
I do not know how I missed this, this is brilliant. 

Okay so all I need to do is find a way to extrapulate the full path of the 'currently playing' audo-event, send this path to the TCPwav plugin.  Then when playing back audio, use the same path and insclude the wildcard {item.title}*.wav

Okay.  You would be better at this than me, but I'll have a look..
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: jitterjames on July 30, 2013, 11:06:40 PM
I do not know how I missed this, this is brilliant. 

Okay so all I need to do is find a way to extrapulate the full path of the 'currently playing' audo-event, send this path to the TCPwav plugin.  Then when playing back audio, use the same path and insclude the wildcard {item.title}*.wav

Okay.  You would be better at this than me, but I'll have a look..

I think that's usually the case with voxcommando but that doesn't mean that I'm going to do everyone's work for them :-)
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: thesystemera on July 30, 2013, 11:09:36 PM
Okay I've done it, but I've hit a snag that is going to require your skills.  

It appears that the .wav files that are saved from TCPmic are in fact not compatible with 'Sound.PlayWav' command.  

I'll show you what I've done anyway, I could get a batch converter to run in the background if this can't be resolved but would rather not.  

This one is to catch the review, it obtains the bands 'artist' name and appends it to a file, which is then saved in the Reviews folder:

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<commandGroup open="False" name="Bubbles" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="993" name="play the wav" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Sound.PlayWav</cmdType>
      <cmdString>{1}</cmdString>
      <cmdRepeat>0</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.Raw</cmdType>
      <cmdString>Player.GetProperties&amp;&amp;"playerid":0, "properties":["percentage","playlistid", "position","time","totaltime"]</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.ParseTokens</cmdType>
      <cmdString>{position}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>PY.ExecString</cmdType>
      <cmdString>result = {lastresult}+1</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <cmdString>{LastResult}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.Raw/</cmdType>
      <cmdString>Playlist.Insert&amp;&amp;"playlistid": 0, "item": {"file": "{1}"}, "position":{LastResult}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.Raw</cmdType>
      <cmdString>GUI.ActivateWindow&amp;&amp;"window": "musicplaylist"</cmdString>
      <cmdRepeat>0</cmdRepeat>
    </action>
    <event>TcpMic.WavSaved</event>
  </command>
  <command id="977" name="Reviews" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>XJson.Raw</cmdType>
      <cmdString>Player.GetItem&amp;&amp;"playerid":0, "properties": ["title", "album", "artist", "rating","playcount","genre"]</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.ParseTokens</cmdType>
      <cmdString>{item.artist[[, also, ]]}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>TcpMic.SaveNext</cmdType>
      <cmdString>Z:\Library\Reviews\{LastResult}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <xref optional="true">C:\Users\Production\Desktop\VocCommando old\phrase database\introduction.xml</xref>
    <xref optional="true">C:\Users\Production\Desktop\VocCommando old\phrase database\query.xml</xref>
    <phrase optional="true">post, leave, give, say, tell, say what I</phrase>
    <phrase optional="true">my, a, some</phrase>
    <phrase>review, reviews, comment, comments, commentary, think, say, thoughts, opinions, something </phrase>
    <phrase optional="true">about this, about the, on this, on the</phrase>
    <phrase optional="true">track, song, single, band, group, artist, album, podcast, programme, show, series</phrase>
    <xref optional="true">C:\Users\Production\Desktop\VocCommando old\phrase database\manners.xml</xref>
  </command>
</commandGroup>

We can then request a review, I will add to this, throw in some sweepers at the beginning and ending and maybe introduce some processing of the .wav to cleanup background noise.   The cool thing is is that it will play a random review of what ever band you are playing, right now I just do it for artist rather than song because I simply don't want to have to do a review for every song just to prove the concept.  

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<commandGroup open="False" name="Play Bubbles" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="996" name="play bubbles" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>XJson.SoftMute</cmdType>
      <cmdString>80</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.Raw</cmdType>
      <cmdString>Player.GetItem&amp;&amp;"playerid":0, "properties": ["title", "album", "artist", "rating","playcount","genre"]</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.ParseTokens</cmdType>
      <cmdString>{item.artist[[, also, ]]}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>File.GetRandFile</cmdType>
      <cmdString>Z:\Library\Reviews\&amp;&amp;{LastResult}*.*</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Sound.PlayWav</cmdType>
      <cmdString>{LastResult}&amp;&amp;True</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.SoftUnMute</cmdType>
      <cmdString />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <xref optional="true">C:\Users\Production\Desktop\VocCommando old\phrase database\introduction.xml</xref>
    <xref optional="true">C:\Users\Production\Desktop\VocCommando old\phrase database\query.xml</xref>
    <phrase optional="true">listen to, play me, play us, play, give me</phrase>
    <phrase optional="true">a, some</phrase>
    <phrase>review, reviews, comment, comments, commentary, think, say, thoughts, opinions, something, bubble, bubbles </phrase>
    <phrase>about this, about the, on this, on the</phrase>
    <phrase>track, song, single, band, group, artist, album, podcast, programme, show, series</phrase>
    <xref optional="true">C:\Users\Production\Desktop\VocCommando old\phrase database\manners.xml</xref>
  </command>
</commandGroup>

So yeah James, can we fix this issue with VoxCommando now being able to load the .wav.  I have attached a wave so you can test it for yourself.  
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: thesystemera on July 30, 2013, 11:12:05 PM
Quite proud of myself :)  I'm starting to understand this stuff :D
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: jitterjames on July 30, 2013, 11:16:36 PM
Yeah, looks like you are moving right along.

It's past my bed time so I won't be able to really read your post and look at your actions etc.

I don't know what is up with the wav.  Maybe I am breaking some unwritten (or maybe just unread) law of wavs when I recreate it from the audio stream sent by voxWav.  In any case I think you can play it by using another action:

Sound.PlayStream
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: thesystemera on July 30, 2013, 11:36:39 PM
Hahah yes it works...  PlayStream ah.  Does that include the <wait> variable.  I hope so.  Thanks James. 
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: thesystemera on July 31, 2013, 12:33:11 AM
YUS!!! It all works so brilliantly.  Leaving reviews and then listening to them is soo soo cool..

Best of all I'm going to introduce Stings next.  Very happy. 

What I seem to have noticed is the long .wav files work fine, it's the short ones.  Odd.. I will look further in to this..
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: thesystemera on July 31, 2013, 10:25:26 PM
Now for the next iteration of my master plan.  I am trying to integrate command-line audio processing of the wavs once recorded.  Now this is not hard obviously but what I've discovered is that the .wav files that voxcommando is creating is not being accepted by the specific software I am utilizing. 

The software I'm utilizing is called MrsWatson. http://teragonaudio.com/MrsWatson.html (http://teragonaudio.com/MrsWatson.html).  Quite frankly a brilliant little program which allows for some very quick and useful background signal processing.  It allows integration of audio VST technology so i'm able to apply a whole host of processes to the .wav files that are produced. 

This is useful for such things as normalization of audio, removal and gating of back-ground noise, multi-band compression, exciters and other audio enhancements.  Essentially we can bring the .wavs to life and make them sound clear and punchy. 

This is obviously great for what I'm doing but also for other applications such as sending audio emails to loved ones, relaying audio messages with-in your household, incoming and outgoing phone communications etc. 

So yeah, I'll try and find a separate batch .wav converter to try and resolve these funny .wav outputs we are having here but if we could look into this at some point that would be great, I'm sure this work will come in useful for other members other than myself.   

What do you all think?  Little hung-over so hopefully I'm making sense. 
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: thesystemera on August 01, 2013, 02:18:46 AM
Okay the TcpMic plugin needs to transfer over a {LastResult} or other such variable when acting on the WavSaved event. 

I am using SoX to process my waves, it does a great job of compression, removing silence between pauses and noise reduction.  But I am unable to get VoxCommando to process the wav once it's saved.  Demonstrate as follows.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<command id="546" name="Process Audio Event" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>VC.Pause</cmdType>
    <cmdString>1200</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Launch.RawParam</cmdType>
    <cmdString>C:\Program Files (x86)\sox-14-4-1\sox.exe&amp;&amp;"{LastResult}" "{LastResult}.process.wav" silence 1 0.1 0.2% -1 0.5 0.2% contrast 75</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>OSD.ShowText</cmdType>
    <cmdString>{LastResult}</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <event>TcpMic.WavSaved</event>
</command>

I am so close to having automated processing of assigned audio events..  Can you give me some insight to this James.  I will look into using eventghost if possible, I don't think it will work though. 
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: thesystemera on August 01, 2013, 04:15:56 AM
Decided to batch process it, still having strange issues though, does any one know anythign about batch processing, am I missing something here?

Can someone tell me why this is not working. It is not honouring the -1 and therefor not removing middle silence. When I try command line on an individual file it is fine but when trying to do batch I have no luck.. It’s honouring the 1 and any other commands I’ve toyed with, it’s like the “-” from the “-1″ is disappearing???

cd C:\Program Files (x86)\sox-14-4-1
for /f “tokens=1-2 delims=.” %%i in (‘dir /b z:\library\reviews\processing\*.wav’) do (sox.exe “z:\library\reviews\processing\%%i.wav” “z:\library\reviews\%%i.wav” silence 1 0.1 0.2% -1 0.5 0.2%)
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: jitterjames on August 01, 2013, 08:41:35 AM
  But I am unable to get VoxCommando to process the wav once it's saved.

I don't know what you mean by that.  Process it how?
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: jitterjames on August 01, 2013, 12:46:06 PM
Okay the TcpMic plugin needs to transfer over a {LastResult} or other such variable when acting on the WavSaved event. 

Really?  Why?

I will determine what it NEEDS to do, but if you would like me to consider making yet another adjustment JUST FOR YOU then I think maybe you should try asking nicely.  Also I think you should try to explain a little better what you mean.  I think maybe you are just failing to grasp something about how the plugin works.

The WavSaved event carries payloads already with the full path to the file.  You should know this because you are using this to tell XBMC what file to play.  If that is not what you mean, then I have no idea what you are talking about.

Sorry about the negative tone, but you are starting to get to me.  I'm sure you don't intend to be rude, but I feel that you are being rude, despite the fact that I have been bending over backwards to accommodate you and all of your special needs.
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: thesystemera on August 01, 2013, 01:34:01 PM
I didn't mean NEEDS as in like it needs to be done LOL.  I was meaning I need to establish what the {payload} is.  I wasn't saying, get cracking and go write some code LOL...  Sorry James.
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: thesystemera on August 01, 2013, 01:40:33 PM
Well got everything up and running anyway, and yes I was completely daft about the {LastResult} thing and am sorry about that.  I learn't a lot today though about scripting batch files though, most likely an unnecessary learning curve but hey.  Ooops! 

Can't stress enough how much I do appreciate your assistance, if I'm asking too many questions, you don't need to respond, I'm just like a kid in a candy store at the moment.  Also it could be blunt kiwi culture that your mistaking for bossyness LOL..   My bad! :)

Will post a video to you all tomorrow to show yah what I've been done, I think I'm going to take a leaf out of your book and do some video blogging to demonstrate any future queries. 

Thanks again....
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: jitterjames on August 01, 2013, 01:48:21 PM
OK sorry if I overreacted, and thanks for the apology / clarification.

I do appreciate your enthusiasm, but maybe take a little more time to compose your posts to make yourself a bit more clearly understood.  You seem to have a tendency to go a bit "stream of consciousness" which can exhaust me mentally, and make me crabby.  I'm already suffering a bit from information overload. It'll make my life easier and I'll be able to help you more efficiently, if your questions are a bit more well thought out.  I understand that you are trying to do a lot of stuff quickly, but sometimes rushing takes longer... and it is not just your time that gets wasted.
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: thesystemera on August 02, 2013, 12:03:16 AM
I agree. I'm a little embarrassed to be honest.  I'm quite aware of this tenancy, I'm essentially thinking out loud, I compose emails for my self in a lot of ways, externalising my thought process.  Haha gosh I gotta work on this..  Thanks James. 
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: thesystemera on August 04, 2013, 01:53:36 AM
Hey James, just before I say anything, this is not an immediate 'get to it'. Just covering my bases. :D

Um I'm having a lot of fun with the recording functionality.  What I'm experimenting with now is pretty cool.  Was going to ask though, how much difficulty would it be to remove the date saving functionality to the file-name.  As this is easily done through the use of the {Long Time} variables. 

What I'm doing is when you hear a 'ShoutOut' (a recorded wave), I'm adding the functionality of simply being able to say 'Reply' and and then by clever filename association is able to determine a 'replied' ShoutOut to the original and then play it back-to-back. Only problem is iis that attached date is throwing off my method.

I have assigned the variable {ShoutFile} to keep hold of the last played ShoutOut. Then when I activeate the reply command it simply grabs the {ShoutFile} variable and assigns an additional variable to the end. {ShoutFile}(1).  I can then have replies palyed back alongside with the original file. 

At the moment I can only work out how to do one additional reply as I don't know how to make it tick up a number each time, but I hope you get the general gist. 

I'm just playing around, just curious as to some insight.  Once again not in any way a biggie. 

Thanks :)




Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: jitterjames on August 04, 2013, 09:50:24 AM
Sure.  I think I can just remove the date from the filename since you are probably the only person using this action.  Keep in mind that by using {longtime} you are getting the time that the action is called, not the time when the file is created.  But it should not matter for you, I think.
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: thesystemera on August 04, 2013, 07:49:16 PM
Thanks James.  How would I go about extrapolating only the file-name from the {1} variable when the SaveWav action takes place.  I'm basically wanting to use the timestamp as purely a means of identification.  So as to when someone replies to a ShoutOut I can carry the timestamp as a variable but can alter the name. So you have

ShoutOut2013_8_2_23_18.wav where I only carry the 2013_8_2_23_18 so I can then append something like Reply12013_8_2_23_18.wav

I see that things like {item.artist[[ & ]]} removes the & I'm presuming, so I'm right to believe where I have the {1} variable carrying Z:\Library\ShoutOut\ShoutOut2013_8_2_23_18.wav I would then go:

{[[Z:\Library\ShoutOut\ShoutOut]]1[[.wav]]}

Am I close LOL?  Thanks again...  I"m clearly one of special needs LOL
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: jitterjames on August 05, 2013, 11:17:59 AM
How would I go about extrapolating only the file-name from the {1} variable when the SaveWav action takes place.

I think you are talking about the payload that is attached to the event that is fired when the wav is actually saved, not the "the {1} variable when the SaveWav action takes place" because I don't know what that means.

You want to extrapolate only the filename, but in fact ShoutOut2013_8_2_23_18.wav is the filename.  What you really want to do is to remove the date I guess.  You can do this using regex.

ShoutOut2013_8_2_23_18.wav where I only carry the 2013_8_2_23_18 so I can then append something like Reply12013_8_2_23_18.wav
I'm not familiar with the expression "where I only carry the", and I'm not sure what format of filename you ultimately want to end up with.  Anyway.  Why don't you just add reply1 to the end of the filename?  Why does it need to be in front of the date?

I see that things like {item.artist[[ & ]]} removes the & I'm presuming, so I'm right to believe where I have the {1} variable carrying Z:\Library\ShoutOut\ShoutOut2013_8_2_23_18.wav I would then go:
{[[Z:\Library\ShoutOut\ShoutOut]]1[[.wav]]}

Am I close LOL?  Thanks again...  I"m clearly one of special needs LOL

Not even close.  :biglaugh  That format only relates to the xJson.Parsetokens action, which is used to parse the json result returned by XBMC.  This does not relate to what you are doing here at all.
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: thesystemera on August 05, 2013, 10:13:09 PM
Quote
I think you are talking about the payload that is attached to the event that is fired when the wav is actually saved, not the "the {1} variable when the SaveWav action takes place" because I don't know what that means.

You want to extrapolate only the filename, but in fact ShoutOut2013_8_2_23_18.wav is the filename.  What you really want to do is to remove the date I guess.  You can do this using regex.

I understand that "ShoutOut2013_8_2_23.18.wav" is the filename, but the variable {1} returns the full path and extension as well, so I'm left with something that looks this "Z:/Library/Shoutouts/ShoutOut2013_8_2_23.18.wav"  What I am wanting to work out how to do is extrapolate just the file-name, specifically the date saved to that file-name.

The payload {1} returns the fullpath/filename/extention.  I don't know how to be any clearer. Sorry.

Quote
I'm not familiar with the expression "where I only carry the", and I'm not sure what format of filename you ultimately want to end up with.  Anyway.  Why don't you just add reply1 to the end of the filename?  Why does it need to be in front of the date?

It could be at the end, trust me I tried that first, but I can't work out how to remove the ".wav" so I get "ShoutOUt2013_8_2_23.18.wav.reply1.wav" and this causes havoc on the playback of the wave file for reasons unknown. 

The expression "where I only carry the"? Okay, where I only keep the, where I only retain the, where I only hold on to the.  :D

Quote
Not even close. That format only relates to the xJson.Parsetokens action, which is used to parse the json result returned by XBMC.  This does not relate to what you are doing here at all.

Well I'm trying to understand :bonk !!! I'll look into regex.  hopefully there's some documentation regarding it.  I have no issue with reading on documentation when trying to understand all this if you could be so kind as to point me in the right direction. 
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: jitterjames on August 05, 2013, 10:33:07 PM
It might help me if I could see the relevant commands that you have so far.  I'm having a bit of trouble wrapping my head around the replies.

Regex is used quite often.  If you poke around the forum you'll see us using it for lots of things.  I usually recommend the c# regex cheat sheet

http://www.mikesdotnetting.com/Article/46/CSharp-Regular-Expressions-Cheat-Sheet.

You will probably need some help to get started with the VC action so if you give me your code I can try to show you how to extract just the date or something.
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: thesystemera on August 06, 2013, 12:28:11 AM
Not really much to show as I can't do any thing until I find a way to extrapolate just the "filename" and not the full path. 

But I will show you what I've got..


This is for the recording of ShoutOuts and Reply's and dealing with the processing of the wavs after being recorded (cleanup)
Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<commandGroup open="True" name="Shoutout" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="979" name="ShoutOut" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>TcpMic.SaveNext</cmdType>
      <cmdString>Z:\Library\Shoutouts\Processing\shoutouts</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.SetVoiceName</cmdType>
      <cmdString>IVONA Amy</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VC.Pause</cmdType>
      <cmdString>300</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.SoftMute</cmdType>
      <cmdString>80</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.SpeakSync</cmdType>
      <cmdString>{M:TTS.Go for it}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.SoftUnMute</cmdType>
      <cmdString />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Shout Out</phrase>
  </command>
  <command id="994" name="Reply" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>TcpMic.SaveNext</cmdType>
      <cmdString>Z:\Library\Shoutouts\Processing\R1{var.ShoutFile}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.SetVoiceName</cmdType>
      <cmdString>IVONA Amy</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VC.Pause</cmdType>
      <cmdString>300</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.SoftMute</cmdType>
      <cmdString>80</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.SpeakSync</cmdType>
      <cmdString>{M:TTS.Go for it}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.SoftUnMute</cmdType>
      <cmdString />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Reply</phrase>
  </command>
  <command id="647" name="Process ShoutOut" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Results.SetVar</cmdType>
      <cmdString>ShoutFile&amp;&amp;{1}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Launch.RawParam</cmdType>
      <cmdString>"C:\Program Files (x86)\sox-14-4-1\sox.exe"&amp;&amp;"C:\Program Files (x86)\sox-14-4-1C:\sox.exe" "z:\library\shoutouts\processing\{var.ShoutFile}" "z:\library\shoutouts\{var.ShoutFile}" gain -n -3 silence 1 0.1 0.8% -1 0.5 0.8% contrast 50</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>TcpMic.WavSaved</event>
  </command>
</commandGroup>


This is the track announcing section.  You only need to focus on the ShoutOut action to see what I'm doing. 
Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<commandGroup open="True" name="Announcer" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="571" name="Ducker" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>XJson.SoftMute</cmdType>
      <cmdString>90</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>XBMC.Player.OnPlay.song</event>
  </command>
  <command id="552" name="ShoutOuts" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Sound.PlayWav</cmdType>
      <cmdString>Z:\Library\Stings\ShoutOut - Snap In.wav&amp;&amp;True</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>File.GetRandFile</cmdType>
      <cmdString>Z:\Library\ShoutOuts\&amp;&amp;shoutout*.wav</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.SetVar</cmdType>
      <cmdString>ShoutFile</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Sound.PlayWav</cmdType>
      <cmdString>{var.ShoutFile}&amp;&amp;True</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Sound.PlayWav</cmdType>
      <cmdString>Z:\Library\Stings\ShoutOut - Snap In.wav&amp;&amp;True</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Sound.PlayWav</cmdType>
      <cmdString>R1{var.ShoutFile}&amp;&amp;True</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Sound.PlayWav</cmdType>
      <cmdString>R2{var.ShoutFile}&amp;&amp;True</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Sound.PlayWav</cmdType>
      <cmdString>R3{var.ShoutFile}&amp;&amp;True</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Sound.PlayWav</cmdType>
      <cmdString>Z:\Library\Stings\ShoutOut - Snap Out.wav&amp;&amp;True</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>XBMC.Player.OnPlay.song</event>
  </command>
  <command id="553" name="TTS Announce" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>XJson.Raw</cmdType>
      <cmdString>Player.GetItem&amp;&amp;"playerid":0, "properties": ["title", "album", "artist","genre"]</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.ParseTokens</cmdType>
      <cmdString>{item.genre}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>(A)Contains(B)</ifType>
      <ifParams>{LastResult}&amp;&amp;Podcast</ifParams>
      <then />
      <else>
        <action>
          <cmdType>Sound.PlayWav</cmdType>
          <cmdString>Z:\Library\Stings\TTS fade in.wav</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>TTS.SetVoiceName</cmdType>
          <cmdString>IVONA Amy</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>XJson.ParseTokens</cmdType>
          <cmdString>Now playing. {item.title}. |Now for. {item.title}.  |Lets enjoy. {item.title}.  |Now for some. {item.title}.  |Time to enjoy. {item.title}. </cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>VC.Pause</cmdType>
          <cmdString>300</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>TTS.SpeakSync</cmdType>
          <cmdString>{LastResult}</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>TTS.SetVoiceName</cmdType>
          <cmdString>IVONA Brian</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>XJson.ParseTokens</cmdType>
          <cmdString>From the band. {item.artist[[ &amp; ]]}|From the artist. {item.artist[[ &amp; ]]}|The group. {item.artist[[ &amp; ]]}|{item.artist[[ &amp; ]]}</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>TTS.SpeakSync</cmdType>
          <cmdString>{LastResult}</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>Sound.PlayWav</cmdType>
          <cmdString>Z:\Library\Stings\TTS fade out.wav</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>VC.Pause</cmdType>
          <cmdString>300</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </else>
    </if>
    <event>XBMC.Player.OnPlay.song</event>
  </command>
  <command id="589" name="Sting - Podcast" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>XJson.Raw</cmdType>
      <cmdString>Player.GetItem&amp;&amp;"playerid":0, "properties": ["title", "album", "artist","genre"]</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.ParseTokens</cmdType>
      <cmdString>{item.genre}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>(A)Contains(B)</ifType>
      <ifParams>{LastResult}&amp;&amp;Podcast</ifParams>
      <then>
        <action>
          <cmdType>Sound.PlayWav</cmdType>
          <cmdString>Z:\Library\Stings\Sting - Snap In.wav&amp;&amp;True</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>XJson.ParseTokens</cmdType>
          <cmdString>{item.artist[[, also, ]]}</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>File.GetRandFile</cmdType>
          <cmdString>Z:\Library\Stings\&amp;&amp;{LastResult}*.wav</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>Sound.PlayWav</cmdType>
          <cmdString>{LastResult}&amp;&amp;True</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>Sound.PlayWav</cmdType>
          <cmdString>Z:\Library\Stings\Sting - Snap Out.wav&amp;&amp;True</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>XJson.Raw</cmdType>
          <cmdString>Input.ExecuteAction&amp;&amp;"action":"skipprevious"</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else />
    </if>
    <event>XBMC.Player.OnPlay.song</event>
  </command>
  <command id="592" name="Sting - Music" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>XJson.Raw</cmdType>
      <cmdString>Player.GetItem&amp;&amp;"playerid":0, "properties": ["title", "album", "artist","genre"]</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.ParseTokens</cmdType>
      <cmdString>{item.genre}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <if ifBlockDisabled="False" ifNot="True">
      <ifType>(A)Contains(B)</ifType>
      <ifParams>{LastResult}&amp;&amp;Podcast</ifParams>
      <then>
        <action>
          <cmdType>Sound.PlayWav</cmdType>
          <cmdString>Z:\Library\Stings\Sting - Snap In.wav&amp;&amp;True</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>XJson.ParseTokens</cmdType>
          <cmdString>{item.artist[[, also, ]]}</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>File.GetRandFile</cmdType>
          <cmdString>Z:\Library\Stings\&amp;&amp;{LastResult}*.wav</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>Sound.PlayWav</cmdType>
          <cmdString>{LastResult}&amp;&amp;True</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>Sound.PlayWav</cmdType>
          <cmdString>Z:\Library\Stings\Sting - Snap Out.wav&amp;&amp;True</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else />
    </if>
    <event>XBMC.Player.OnPlay.song</event>
  </command>
  <command id="549" name="Ducker" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>XJson.Raw</cmdType>
      <cmdString>Input.ExecuteAction&amp;&amp;"action":"skipprevious"</cmdString>
      <cmdRepeat>0</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.SoftUnMute</cmdType>
      <cmdString />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.SetVol</cmdType>
      <cmdString>100</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>XBMC.Player.OnPlay.song</event>
  </command>
</commandGroup>
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: Kalle on August 06, 2013, 01:44:23 AM
Quote
I understand that "ShoutOut2013_8_2_23.18.wav" is the filename, but the variable {1} returns the full path and extension as well, so I'm left with something that looks this "Z:/Library/Shoutouts/ShoutOut2013_8_2_23.18.wav"  What I am wanting to work out how to do is extrapolate just the file-name, specifically the date saved to that file-name.

Take a look here, this might be helpful - with the action "Results.Replace/Results.RegExReplace" it is possible to clear up your LastResult.

http://voxcommando.com/mediawiki/index.php?title=Actions#RegExReplace (http://voxcommando.com/mediawiki/index.php?title=Actions#RegExReplace)
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: thesystemera on August 06, 2013, 02:09:22 AM
Quote
Take a look here, this might be helpful - with the action "Results.Replace/Results.RegExReplace" it is possible to clear up your LastResult.

http://voxcommando.com/mediawiki/index.php?title=Actions#RegExReplace

Thanks, that's exactly what I'm after.  I don't know how I missed that! 
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: thesystemera on August 06, 2013, 02:18:24 AM
One small problem.  The variable I have to use is {1} not {LastResult}.  How would I transfer {1} to {LastResult}?
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: thesystemera on August 06, 2013, 02:28:26 AM
Don't worry worked it out!  Results.SetLastResult :D
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: thesystemera on August 06, 2013, 02:54:11 AM
Okay I've got it but how do I replace with nothing!  If I ender nothing in to the second field it treats it as if to do nothing!!!  AARRGG!

I'm just using Replace, not RegExReplace.  That stuff is way too confusing.  Unlesss some one can help me.  I just want

Z:\Library\ShoutOuts\Processing\Shoutout123.wav   

to become

Shoutout123

so to remove the [Z:\Library\ShoutOuts\Processing\] and the [.wav]
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: thesystemera on August 06, 2013, 03:19:26 AM
Finally done it!  I looked up how to remove invalid characters and YUS! 

If I can simplify this, do tell me, but it works, that's the important thing.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<command id="647" name="Process ShoutOut" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>Results.SetVar</cmdType>
    <cmdString>ShoutFile&amp;&amp;{1}</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.SetLastResult</cmdType>
    <cmdString>{var.ShoutFile}</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.RegExReplace</cmdType>
    <cmdString>[^\w\.@-]</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.RegExReplace</cmdType>
    <cmdString>ZLibraryShoutoutsProcessing</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.RegExReplace</cmdType>
    <cmdString>[.wav]</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.SetVar</cmdType>
    <cmdString>ShoutFile</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>OSD.ShowText</cmdType>
    <cmdString>{var.ShoutFile}</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Launch.RawParam</cmdType>
    <cmdString>C:\Program Files (x86)\sox-14-4-1\sox.exe&amp;&amp;"z:\library\shoutouts\processing\{var.ShoutFile}.wav" "z:\library\shoutouts\{var.ShoutFile}.wav" gain -n -3 silence 1 0.1 0.8% -1 0.5 0.8% contrast 50</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <event>TcpMic.WavSaved</event>
</command>
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: Kalle on August 06, 2013, 04:02:13 AM
yes exactly, that is the way how you can replace the hole stuff from your lastresult step by step - (multiple replace actions)
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: thesystemera on August 06, 2013, 06:02:11 AM
I still have a weird issue.  The [^\w\.@-] is successfully removing the "\" symbol but it's also removing the letter "A".  Any idea's?
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: Kalle on August 06, 2013, 06:44:25 AM
I still have a weird issue.  The [^\w\.@-] is successfully removing the "\" symbol but it's also removing the letter "A".  Any idea's?
Which "A"? I can't see any "A" in your file name, only the "a" in the word "Library" and "wav"

By the way, did you have tried first to replace "Z:\Library\ShoutOuts\Processing\" and as next ".wav"?
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: jitterjames on August 06, 2013, 10:39:10 AM
Finally done it!  I looked up how to remove invalid characters and YUS!  

If I can simplify this, do tell me, but it works, that's the important thing.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<command id="647" name="Process ShoutOut" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>Results.SetVar</cmdType>
    <cmdString>ShoutFile&amp;&amp;{1}</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.SetLastResult</cmdType>
    <cmdString>{var.ShoutFile}</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.RegExReplace</cmdType>
    <cmdString>[^\w\.@-]</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.RegExReplace</cmdType>
    <cmdString>ZLibraryShoutoutsProcessing</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.RegExReplace</cmdType>
    <cmdString>[.wav]</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.SetVar</cmdType>
    <cmdString>ShoutFile</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>OSD.ShowText</cmdType>
    <cmdString>{var.ShoutFile}</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Launch.RawParam</cmdType>
    <cmdString>C:\Program Files (x86)\sox-14-4-1\sox.exe&amp;&amp;"z:\library\shoutouts\processing\{var.ShoutFile}.wav" "z:\library\shoutouts\{var.ShoutFile}.wav" gain -n -3 silence 1 0.1 0.8% -1 0.5 0.8% contrast 50</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <event>TcpMic.WavSaved</event>
</command>

Wow.  This really confuses me.  It seems like you take all that extra stuff away, only to put it back in again in the Launch action.

By the way, if you only want the filename without the path you can use payload 3.  Look at the history window.  If you mouse over the event you will see the payloads associated with it.  At this point I'm a bit confused as to the difference between payload 1 and payload 2 and need to look at the code again to see what's up with that.

It seems like you just need to move the file from the processing folder up to the folder above.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<command id="664" name="Process ShoutOut James 01" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>Results.SetLastResult</cmdType>
    <cmdString>{1}</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.Replace</cmdType>
    <cmdString>shoutouts\processing&amp;&amp;shoutouts</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Launch.RawParam</cmdType>
    <cmdString>C:\Program Files (x86)\sox-14-4-1\sox.exe&amp;&amp;"{1}" "{lastresult}" gain -n -3 silence 1 0.1 0.8% -1 0.5 0.8% contrast 50</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <event>TcpMic.WavSaved</event>
</command>
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: jitterjames on August 06, 2013, 10:54:07 AM
As I mentioned, the {3} should contain the filename, but with the extension.

In any case, I think this example will help you a lot and give you some idea of how to use the regex replace action to your advantage:

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<command id="665" name="replace" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="Extract just the filename with no extension from a path.">
  <action>
    <cmdType>Results.SetLastResult</cmdType>
    <cmdString>Z:\Library\ShoutOuts\Processing\Shoutout123.wav   </cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.RegExReplace</cmdType>
    <cmdString>.*\\(.*)\.wav&amp;&amp;file name is: $1</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>OSD.ShowText</cmdType>
    <cmdString>{LastResult}</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
</command>
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: jitterjames on August 06, 2013, 11:04:32 AM
Okay I've got it but how do I replace with nothing!  If I ender nothing in to the second field it treats it as if to do nothing!!!

You are right, you can't do this with the standard replace action.  I should modify this to allow it!  You can do it with regex replace though.
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: jitterjames on August 06, 2013, 11:12:35 AM
Here's an example demonstrating how to grab paths, filenames and extensions
Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<command id="36" name="fun with paths and filenames" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>Results.SetLastResult</cmdType>
    <cmdString>c:\test\path\myfile.jpg</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>OSD.ShowText</cmdType>
    <cmdString>original: {LastResult}</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.RegExReplace</cmdType>
    <cmdString>^(.*)\\(.*?)\.(.*?)$&amp;&amp;path: $1\{CR}file: $2{CR}extension: $3</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>OSD.AddText</cmdType>
    <cmdString>{LastResult}</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
</command>
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: thesystemera on August 07, 2013, 10:33:34 AM
Thanks so much James.  I do want to cry a little though, I never knew about payload 3. 

One hell of a learning curve.  Thank you for your time guys.  Will have a play with this example now..:)
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: thesystemera on August 07, 2013, 11:08:03 AM
OMG!  It's that simple!  A few days on 13 ASCII characters!

Nah but seriously thankyou.  Going to have to read up on how to use these strings, will most likely need it in the future..
Title: Re: Save the audio file from VoxWav to a custom folder.
Post by: jitterjames on August 10, 2013, 10:23:07 AM
I am beefing up the savenextwav action and adjusting the payloads somewhat:

Here's the new documentation for the action:
Quote
The next incoming audio stream will be saved to <Path> instead of being analyzed as speech.  If Path specified a folder that does not exist the folder will be created immediately.
If <AddTimeStamp> is True, then the filename will be modified to add a timestamp to the end of the filename.
If <AutoIncrement> is True, then an existing filename will have an index added to the end in brackets, starting at (1)
If <AutoIncrement> is False, and the file exists, it will be overwritten with the new wav file
After the new audio stream is saved an event will be generated with the following payloads
{1}  Full path and filename of the wav with extension (.wav)
{2}  Folder path only where the file was saved
{3}  Filename only with no extension