summaryrefslogtreecommitdiff
path: root/attic/muse2-oom/muse2/share/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'attic/muse2-oom/muse2/share/scripts')
-rw-r--r--attic/muse2-oom/muse2/share/scripts/CMakeLists.txt32
-rwxr-xr-xattic/muse2-oom/muse2/share/scripts/ConstantLength77
-rwxr-xr-xattic/muse2-oom/muse2/share/scripts/DoNothing15
-rwxr-xr-xattic/muse2-oom/muse2/share/scripts/DoubleSpeed24
-rw-r--r--attic/muse2-oom/muse2/share/scripts/README.txt36
-rwxr-xr-xattic/muse2-oom/muse2/share/scripts/RemoveShortEvents79
-rwxr-xr-xattic/muse2-oom/muse2/share/scripts/SwingQuantize1105
7 files changed, 368 insertions, 0 deletions
diff --git a/attic/muse2-oom/muse2/share/scripts/CMakeLists.txt b/attic/muse2-oom/muse2/share/scripts/CMakeLists.txt
new file mode 100644
index 00000000..5a7be7db
--- /dev/null
+++ b/attic/muse2-oom/muse2/share/scripts/CMakeLists.txt
@@ -0,0 +1,32 @@
+#=============================================================================
+# MusE
+# Linux Music Editor
+# $Id:$
+#
+# Copyright (C) 2002-2006 by Werner Schweer and others
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#=============================================================================
+
+file(GLOB script_files
+ DoNothing
+ RemoveShortEvents
+ DoubleSpeed
+ ConstantLength
+ SwingQuantize1
+ )
+
+install (PROGRAMS ${script_files}
+ DESTINATION ${MusE_SHARE_DIR}/scripts
+ )
+
diff --git a/attic/muse2-oom/muse2/share/scripts/ConstantLength b/attic/muse2-oom/muse2/share/scripts/ConstantLength
new file mode 100755
index 00000000..f03addcd
--- /dev/null
+++ b/attic/muse2-oom/muse2/share/scripts/ConstantLength
@@ -0,0 +1,77 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+import sys,time
+from PyQt4 import QtGui, QtCore
+
+class ScriptClass(QtGui.QWidget):
+ def __init__(self, parent=None):
+ QtGui.QWidget.__init__(self, parent)
+
+ self.setWindowTitle('Constant length')
+ title = QtGui.QLabel('Make all events of length:')
+ self.titleEdit = QtGui.QComboBox()
+ self.titleEdit.addItem('1/1',1)
+ self.titleEdit.addItem('1/2',2)
+ self.titleEdit.addItem('1/4',4)
+ self.titleEdit.addItem('1/8',8)
+ self.titleEdit.addItem('1/16',16)
+ self.titleEdit.addItem('1/32',32)
+ self.titleEdit.addItem('1/64',64)
+ self.titleEdit.setCurrentIndex(4)
+
+ button = QtGui.QPushButton("Execute")
+ self.connect(button, QtCore.SIGNAL('clicked()'), self.execute)
+ grid = QtGui.QGridLayout()
+ grid.setSpacing(3)
+
+ grid.addWidget(title, 1, 0)
+ grid.addWidget(self.titleEdit, 1, 1)
+
+ grid.addWidget(button, 2, 1)
+
+ self.setLayout(grid)
+ self.resize(200, 100)
+ button.setFocus()
+
+ def execute(self):
+ testFile = file(sys.argv[1],"r")
+ inputEvents = testFile.readlines()
+ testFile.close()
+
+ beatDiv = self.titleEdit.itemData(self.titleEdit.currentIndex()).toInt()[0]
+ print "beatDiv=",beatDiv
+ eventLen=0
+ #get beat length to calculate minimum length of event
+ for line in inputEvents:
+ if line.startswith('BEATLEN'):
+ tag,tick = line.split(' ')
+ eventLen=int(tick)/beatDiv*4
+ break
+
+ outputEvents=[]
+ #loop through events
+ for line in inputEvents:
+
+ if line.startswith('NOTE'):
+ tag,tick,note,length,velocity = line.split(' ')
+
+ length=eventLen
+ newLine=tag+" "+tick+" "+note+" "+str(length)+" "+velocity
+ outputEvents.append(newLine)
+
+ else:
+ outputEvents.append(line)
+
+ testFile = file(sys.argv[1],"w")
+ testFile.writelines(outputEvents)
+ testFile.close()
+
+ quit()
+
+
+
+app = QtGui.QApplication(sys.argv)
+qb = ScriptClass()
+qb.show()
+sys.exit(app.exec_())
diff --git a/attic/muse2-oom/muse2/share/scripts/DoNothing b/attic/muse2-oom/muse2/share/scripts/DoNothing
new file mode 100755
index 00000000..a3d92c7d
--- /dev/null
+++ b/attic/muse2-oom/muse2/share/scripts/DoNothing
@@ -0,0 +1,15 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+import sys
+testFile = file(sys.argv[1],"r")
+inputEvents = testFile.readlines()
+testFile.close()
+
+outputEvents=[]
+#loop through events
+for line in inputEvents:
+ outputEvents.append(line)
+
+testFile = file(sys.argv[1],"w")
+testFile.writelines(outputEvents)
+testFile.close()
diff --git a/attic/muse2-oom/muse2/share/scripts/DoubleSpeed b/attic/muse2-oom/muse2/share/scripts/DoubleSpeed
new file mode 100755
index 00000000..da6d0c2e
--- /dev/null
+++ b/attic/muse2-oom/muse2/share/scripts/DoubleSpeed
@@ -0,0 +1,24 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+# MusE external midi processing script
+# By: Mathias Gyllengahm 2009
+# DoubleSpeed
+
+import sys,time
+testFile = file(sys.argv[1],"r")
+inputEvents = testFile.readlines()
+testFile.close()
+
+outputEvents=[]
+#loop through events
+for line in inputEvents:
+
+ if line.startswith('NOTE'):
+ tag,tick,pitch,length,velocity = line.split(' ')
+ newline = tag + " " + str(int(tick)/2) + " " + pitch + " " + length + " " + velocity
+ outputEvents.append(newline)
+
+testFile = file(sys.argv[1],"w")
+testFile.writelines(outputEvents)
+testFile.close()
+
diff --git a/attic/muse2-oom/muse2/share/scripts/README.txt b/attic/muse2-oom/muse2/share/scripts/README.txt
new file mode 100644
index 00000000..8490dd69
--- /dev/null
+++ b/attic/muse2-oom/muse2/share/scripts/README.txt
@@ -0,0 +1,36 @@
+MusE midi event scripting format 0.5
+
+Some information for the budding script writer, here is some info
+about the format currently used.
+
+Scripts can be put in two different dirs.
+<install_path>/share/muse/scripts
+for scripts bundled
+or $HOME/.muse/scripts
+for user created scripts
+
+There are two main requirements on scripts.
+
+1. a script must have the executable flag set, that is, it must be considered
+an executable from the perspective of the operating system.
+2. a script shall take an input file as argument and will update this
+file with the sought output.
+
+The tags that may occur in the file sent to the script are:
+PARTLEN <len in ticks>
+BEATLEN <len in ticks>
+QUANTLEN <len in ticks>
+NOTE <tick> <pitch> <len in ticks> <velocity>
+CONTROLLER <tick> <a> <b> <c>
+
+PARTLEN, BEATLEN and QUANTLEN are there for informational purposes, to
+make some transformations possible. e.g. quantization, beat delay.
+
+NOTE and CONTROLLER are the ones that are read back into MusE when the filter
+stops executing. These may be manipulated, removed or multiplied as seen
+fit by the filter.
+-- Note that it is a good idea to just pass on the lines your script is not
+interested in, otherwise data may unintentionally be removed --
+
+A short example in pyton that does nothing but pass on output from input
+to output is available in script DoNothing
diff --git a/attic/muse2-oom/muse2/share/scripts/RemoveShortEvents b/attic/muse2-oom/muse2/share/scripts/RemoveShortEvents
new file mode 100755
index 00000000..cc6735b2
--- /dev/null
+++ b/attic/muse2-oom/muse2/share/scripts/RemoveShortEvents
@@ -0,0 +1,79 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+# MusE external midi processing script
+# By: Robert Jonsson 2009
+# RemoveShortEvents
+
+import sys,time
+from PyQt4 import QtGui, QtCore
+
+class RemoveShortEvents(QtGui.QWidget):
+ def __init__(self, parent=None):
+ QtGui.QWidget.__init__(self, parent)
+
+ self.setWindowTitle('RemoveShortEvents')
+
+ title = QtGui.QLabel('Remove events shorter than:')
+ self.timeEdit = QtGui.QComboBox()
+ self.timeEdit.addItem('1/1',1)
+ self.timeEdit.addItem('1/2',2)
+ self.timeEdit.addItem('1/4',4)
+ self.timeEdit.addItem('1/8',8)
+ self.timeEdit.addItem('1/16',16)
+ self.timeEdit.addItem('1/32',32)
+ self.timeEdit.setCurrentIndex(3)
+
+ button = QtGui.QPushButton("Execute")
+ self.connect(button, QtCore.SIGNAL('clicked()'), self.execute)
+
+ grid = QtGui.QGridLayout()
+ grid.setSpacing(3)
+
+ grid.addWidget(title, 1, 0)
+ grid.addWidget(self.timeEdit, 1, 1)
+
+ grid.addWidget(button, 2, 1)
+
+ self.setLayout(grid)
+ self.resize(200, 100)
+ button.setFocus()
+
+ def execute(self):
+ testFile = file(sys.argv[1],"r")
+ inputEvents = testFile.readlines()
+ testFile.close()
+
+ beatDiv = int(self.timeEdit.itemData(self.timeEdit.currentIndex()).toInt()[0])
+ minSize=0 # fill in when we get the beat size value
+ outputEvents=[]
+
+ #get beat length to calculate minimum length of event
+ for line in inputEvents:
+ if line.startswith('BEATLEN'):
+ tag,tick = line.split(' ')
+ minSize=int(tick)/beatDiv
+ break
+ #loop through events
+ for line in inputEvents:
+ if line.startswith('NOTE'):
+ tag,tick,note,length,velocity = line.split(' ')
+ if int(length) > minSize: # only append long enough events
+ outputEvents.append(line)
+
+ else:
+ outputEvents.append(line)
+
+
+ testFile = file(sys.argv[1],"w")
+ testFile.writelines(outputEvents)
+ testFile.close()
+
+
+ quit()
+
+
+
+app = QtGui.QApplication(sys.argv)
+qb = RemoveShortEvents()
+qb.show()
+sys.exit(app.exec_())
diff --git a/attic/muse2-oom/muse2/share/scripts/SwingQuantize1 b/attic/muse2-oom/muse2/share/scripts/SwingQuantize1
new file mode 100755
index 00000000..11fded84
--- /dev/null
+++ b/attic/muse2-oom/muse2/share/scripts/SwingQuantize1
@@ -0,0 +1,105 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+# MusE external midi processing script
+# By: Robert Jonsson 2009
+# Quantize
+
+import sys,time
+from PyQt4 import QtGui, QtCore
+import random
+
+class Quantize(QtGui.QWidget):
+ def __init__(self, parent=None):
+ QtGui.QWidget.__init__(self, parent)
+
+ self.setWindowTitle('Swing quantize V1')
+
+
+ self.beatEdit = QtGui.QComboBox()
+ self.beatEdit.addItem('1/1',1)
+ self.beatEdit.addItem('1/2',2)
+ self.beatEdit.addItem('1/4',4)
+ self.beatEdit.addItem('1/8',8)
+ self.beatEdit.addItem('1/16',16)
+ self.beatEdit.addItem('1/32',32)
+ self.beatEdit.setCurrentIndex(2)
+ self.spreadEdit = QtGui.QLineEdit()
+ self.spreadEdit.setText('10')
+
+ button = QtGui.QPushButton("Execute")
+ self.connect(button, QtCore.SIGNAL('clicked()'), self.execute)
+
+ grid = QtGui.QGridLayout()
+ grid.setSpacing(3)
+
+ grid.addWidget(QtGui.QLabel('Beat granularity:'), 1, 0)
+ grid.addWidget(self.beatEdit, 1, 1)
+ grid.addWidget(QtGui.QLabel('Spread/Swing(ticks)'), 2, 0)
+ grid.addWidget(self.spreadEdit, 2, 1)
+ grid.addWidget(button, 3, 1)
+
+ self.setLayout(grid)
+ self.resize(200, 100)
+ button.setFocus()
+
+ def execute(self):
+ testFile = file(sys.argv[1],"r")
+ inputEvents = testFile.readlines()
+ testFile.close()
+
+ beatDiv = self.beatEdit.itemData(self.beatEdit.currentIndex()).toInt()[0]
+ minSize=0 # fill in when we get the beat size value
+ outputEvents=[]
+ quantLen=0
+
+ #get beat length to calculate minimum length of event
+ for line in inputEvents:
+ if line.startswith('BEATLEN'):
+ tag,tick = line.split(' ')
+ beatLen=int(tick)
+ quantLen=int(tick)/beatDiv*4
+ print "quantLen=%d beatDiv=%d"%(quantLen, beatDiv)
+ print line.strip()
+ #loop through events and quantize to the given beat
+ eventList=[]
+ for line in inputEvents:
+ if line.startswith('NOTE'):
+ tag,tick,pitch,length,velocity = line.split(' ')
+
+ # over quantize
+ lowerBound=(int(tick)/quantLen)*quantLen
+ upperBound=lowerBound+quantLen
+ lowDiff=int(tick)-lowerBound
+ highDiff=upperBound - int(tick)
+ if( lowDiff < highDiff):
+ newTick=lowerBound
+ else:
+ newTick=upperBound
+
+ # apply swing factor to every other 8 beat
+ print "float =%f int = %d"%((float(newTick+beatLen)) / beatLen/2,((newTick+beatLen))/beatLen/2)
+ if ((float(newTick+beatLen)) / beatLen/2 - ((newTick+beatLen))/beatLen/2) < 0.1:
+ print "adding swing to:",newTick
+ newTick=int(random.gauss(newTick,self.spreadEdit.text().toInt()[0]))
+ if (newTick < 0):
+ newTick=0
+
+ newLine="NOTE "+ str(newTick)+" " + pitch + " "+ length + " " + velocity
+ print "newLine:",newLine.strip()
+ outputEvents.append(newLine)
+ else:
+ outputEvents.append(line)
+
+
+
+ testFile = file(sys.argv[1],"w")
+ testFile.writelines(outputEvents)
+ testFile.close()
+
+ quit()
+
+
+app = QtGui.QApplication(sys.argv)
+qb = Quantize()
+qb.show()
+sys.exit(app.exec_())