lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: question about transposing an interval of a 4th


From: Philippe Hezaine
Subject: Re: question about transposing an interval of a 4th
Date: Thu, 25 Dec 2008 12:44:27 +0100
User-agent: Thunderbird 2.0.0.18 (X11/20081129)

M Watts a écrit :

Actually, there is a way, but it's just something to muck around with, and takes a lot longer than scrawling stuff by hand on a sheet of ms paper.

Mididings, the python-based midi router from http://das.nasophon.de/mididings/, includes a 'diatonic harmonizer', which allows you to add or substitute a harmony line at a specified interval from the notes being played, with respect to the home key.

So you could:

1) download & install mididings

2) save the following as test.py

# start of file
# harmonizer.py - example usage of the diatonic harmonizer
#

from mididings import *
from mididings.extra import Harmonize

# substitute a fifth above each note played -- equivalent to a fourth below, this only works upwards --, based on the D Major scale
run(
   Harmonize('d', 'major', 'fifth')
)
# end of file

3) start Jack

4) run python ./test.py

5) connect a (virtual) midi keyboard to mididings input; connect mididings output to a recorder or sequencer app capable of saving a midi file

6) run midi2ly on the resulting file

Merry Christmas!

Ditto.

Hi,

May be there is a shortest way about this loud and not so elegant
workaround:

I send the Mididings script i use for the Drummer's Gigsaw. It isn't for
diatonic transposition but you have some infos about a few different
installation and so the opportunity of changing the lilypond midi file
towards a resulting midi file, straightforward.

Be aware of: import sys
and: process_file(sys.argv[1], sys.argv[2]

This script comes from the Mididings's author, Dominic Sacré.
For more details subscribe and ask for infos on the linux-audio mailing
list.

   linux-audio-user at lists.linuxaudio.org

After getting your midi file you can import it in Rosegarden and export
a new lilypond file.

HTH.
--
   Phil.
Superbonus-Project (Site principal) <http://superbonus.project.free.fr>

Superbonus-Project (Plate-forme d'échange):
<http://philippe.hezaine.free.fr>

#!/usr/bin/python
          # -*- coding:Utf-8 -*-
          #Filename : mididings-CC7-to-velocity.py

from mididings import *
import sys

class Volume2Velocity:
    def __init__(self):
        self.vol = {}
    def __call__(self, ev):
        if ev.type_ == CTRL and ev.param == 7:
            self.vol[ev.channel] = ev.value
            return None

        elif ev.type_ == NOTEON and ev.channel in self.vol:
            ev.velocity = self.vol[ev.channel]
        return ev

process_file(sys.argv[1], sys.argv[2], Call(Volume2Velocity()))
# run(Call(Volume2Velocity()))
#
#
#
# About Mididings
# These excerpts come from the linux-audio-user mailing list  at  
lists.linuxaudio.org
#in the thread: [LAU] transform midi Control Change 7 into velocity events?
#
#
# Support for libsmf must be enabled explicitly at compile time
# (./setup.py build --enable-smf).
#
# jack-smf-utils includes libsmf, but doesn't seem to install it for other 
# programs to use. You'll need the standalone version of libsmf-1.1.
#
# If there's no package for libsmf, it's probably easiest to install it 
# the usual, distro-independent way, i.e. extract the tarball and run
#    ./configure && make && make install
# That will install libsmf to /usr/local. If it's still not found after that, 
# try "export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig"
# before building mididings.
#and  export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib  in ~/.bashrc
#
#Then just run it as
# "python /your/path/mididings-CC7-to-velocity.py   /your/path/in.mid    
/your/path/out+veloc.mid"
#
#
#How do you uninstall the previous version? Is there some special way?
#
# Usually when you install a new version to the same prefix, the old files 
# will simply be overwritten.
# To make sure the old version is really gone, you can go to the package 
# directory (something like /usr/lib/python2.5/site-packages) and remove the 
# mididings directory and the file _mididings.so.
#
#
#
#As far as I can see, all tracks in your MIDI file are on the same
#channel, so CC #7 messages on one track will affect the other tracks as
#well. You should probably assign a different channel to each track.

#No. Like i have said these are drums patterns written by Lilypond. After
#the famous transformation i could join all the tracks in one if i want.

#Yes, but then you need to do the transformation one track at a time. If you 
#play multiple tracks through the same MIDI port on the same channel, some 
#notes will get the wrong velocity (unless every note event is immediately 
#preceded by a volume change).
#
#
#
# Except from the fact that drums samples are always short ( no need of
#sustain, only a triggering), is there some reasons why the drums are
#always writing with very short durations?

#I don't think there's a technical reason why drum notes couldn't be longer. 
#There's just no need for it, because the note-off is ignored anyway.
#Also, two MIDI notes on the same "key" can't overlap, and making all notes 
#very short is an easy way for a sequencer to avoid that.

# And more especially from the CC7, do they interact with the duration of 
#the notes?

#The volume controller doesn't interact with individual notes at all. It just 
#changes the volume immediately, affecting all notes on the respective 
#channel, even those which are already playing at that time.
#
# 10/12/2008

reply via email to

[Prev in Thread] Current Thread [Next in Thread]