Skip to content

Commit 8c646bf

Browse files
committed
Add a edit button and its setting + update readmes
1 parent 252e357 commit 8c646bf

File tree

3 files changed

+76
-10
lines changed

3 files changed

+76
-10
lines changed

AudioToAscii.py

+68-2
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ def paramHasChanged(thisParam, thisNode, thisGroup, app, userEdited):
7373
audio_file = thisNode.inputFile.get()
7474
# ascii output file
7575
ascii_file = thisNode.curveFile.get()
76+
# external editing app
77+
ext_edit_app = thisNode.editApp.get()
78+
ext_edit_app_param = thisNode.editParam.get()
7679

7780
# convert dimension in comprehensive thing for audio2ascii script
7881
dim = thisNode.dimEnsion.get()
@@ -83,6 +86,13 @@ def paramHasChanged(thisParam, thisNode, thisGroup, app, userEdited):
8386
elif dim == 2:
8487
dimension = "xy"
8588

89+
# edit with External app
90+
if audio_file and ext_edit_app and thisParam == thisNode.editAudio:
91+
os.system(ext_edit_app + " " + ext_edit_app_param + " '" + audio_file + "' &")
92+
# doesn't work ?!
93+
#else:
94+
#app.warningDialog("Audio File", "You need to set a audio editor to edit an audio file")
95+
8696
# Import Curve
8797
if ascii_file is not None and audio_file is not None and thisParam == thisNode.importCurve:
8898
ret_exec = audioToAscii(audio_file, ascii_file, dimension, thisNode.framesPerSec.get(), thisNode.duraTion.get(), thisNode.xHeight.get(), thisNode.yHeight.get())
@@ -155,7 +165,7 @@ def createInstance(app,group):
155165

156166

157167
#Create the user-parameters
158-
lastNode.userNatron = lastNode.createPageParam("userNatron", "User")
168+
lastNode.userNatron = lastNode.createPageParam("userNatron", "Settings")
159169
param = lastNode.createFileParam("inputFile", "Audio File")
160170
param.setSequenceEnabled(False)
161171

@@ -169,6 +179,62 @@ def createInstance(app,group):
169179
lastNode.inputFile = param
170180
del param
171181

182+
# Group /
183+
param = lastNode.createGroupParam("setEditor", "Editor setting")
184+
185+
#Add the param to the page
186+
lastNode.userNatron.addParam(param)
187+
188+
#Set param properties
189+
param.setHelp("")
190+
param.setAddNewLine(True)
191+
param.setEvaluateOnChange(False)
192+
lastNode.setEditor = param
193+
del param
194+
195+
param = lastNode.createFileParam("editApp", "Audio Editor")
196+
param.setSequenceEnabled(False)
197+
198+
#Add the param to the group, no need to add it to the page
199+
lastNode.setEditor.addParam(param)
200+
201+
#Set param properties
202+
param.setHelp("Set the Audio Editor path")
203+
param.setAddNewLine(True)
204+
param.setAnimationEnabled(False)
205+
param.setDefaultValue("audacity")
206+
lastNode.editApp = param
207+
del param
208+
209+
param = lastNode.createStringParam("editParam", "Audio editor parameters")
210+
param.setType(NatronEngine.StringParam.TypeEnum.eStringTypeDefault)
211+
param.setDefaultValue("")
212+
213+
#Add the param to the group, no need to add it to the page
214+
lastNode.setEditor.addParam(param)
215+
216+
#Set param properties
217+
param.setHelp("Set the Audio Editor command line parameters")
218+
param.setVisible(True)
219+
param.setAddNewLine(False)
220+
param.setAnimationEnabled(True)
221+
lastNode.editParam = param
222+
del param
223+
# / Group
224+
225+
param = lastNode.createButtonParam("editAudio", "Edit audio File")
226+
227+
#Add the param to the page
228+
lastNode.userNatron.addParam(param)
229+
230+
#Set param properties
231+
param.setHelp("Set an audio editor in the tab 'Editor Setting")
232+
param.setAddNewLine(False)
233+
param.setPersistant(False)
234+
param.setEvaluateOnChange(False)
235+
lastNode.editAudio = param
236+
del param
237+
172238
param = lastNode.createFileParam("curveFile", "Curve File")
173239
param.setSequenceEnabled(False)
174240

@@ -209,7 +275,7 @@ def createInstance(app,group):
209275
lastNode.dimEnsion = param
210276
del param
211277

212-
param = lastNode.createIntParam("framesPerSec", "Frames / sec")
278+
param = lastNode.createIntParam("framesPerSec", "Frame Rate")
213279
param.setDisplayMinimum(0, 0)
214280
param.setDisplayMaximum(100, 0)
215281
param.setDefaultValue(24, 0)

README

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ audio2ascii:
33

44
Convert an audio file to an ascii file readable by the Natron/Nuke curve editor (Linux only).
55
A Qt version (Linux + Windows) are currently being developed by @olear at:
6-
https://github.com/olear/audio2ascii
6+
https://github.com/olear/audiocurve
77

88

99
Requirements:
@@ -19,9 +19,9 @@ Requirements:
1919

2020
Installation / Usage:
2121
====================
22-
$ wget https://github.com/rcspam/audio2ascii/archive/v1.5.tar.gz
23-
$ tar xvzf audio2ascii-1.5.tar.gz
24-
$ cd audio2ascii-1.5
22+
$ wget https://github.com/rcspam/audio2ascii/archive/v1.6.tar.gz
23+
$ tar xvzf audio2ascii-1.6.tar.gz
24+
$ cd audio2ascii-1.6
2525
$ cp ./audio2ascii.sh /somewhere/in/your/path # must be in your $PATH
2626

2727
If you want start audio2ascii from Natron, you should run it with its gui (yad must be installed).

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
![screenshot-2](https://cloud.githubusercontent.com/assets/10021906/8550164/3fd4ae8a-24cf-11e5-9c1d-87d153b72dec.png)
99

1010

11-
A Qt version (Linux + Windows) are currently being developed by [olear](https://github.com/olear/audio2ascii)
11+
A Qt version (Linux + Windows) are currently being developed by [olear](https://github.com/olear/audiocurve)
1212

1313
#Requirements
1414

@@ -23,9 +23,9 @@
2323
#Installation / Usage
2424

2525
```
26-
$ wget https://github.com/rcspam/audio2ascii/archive/v1.5.tar.gz
27-
$ tar xvzf audio2ascii-1.5.tar.gz
28-
$ cd audio2ascii-1.5
26+
$ wget https://github.com/rcspam/audio2ascii/archive/v1.6.tar.gz
27+
$ tar xvzf audio2ascii-1.6.tar.gz
28+
$ cd audio2ascii-1.6
2929
$ cp ./audio2ascii.sh /somewhere/in/your/path # must be in your $PATH
3030
```
3131
If you want start audio2ascii from Natron, you should run it with its gui (yad must be installed). To install the plugin AudioToAscii.py and its icon:

0 commit comments

Comments
 (0)