lilypond-devel
[Top][All Lists]
Advanced

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

New patch for waveforms


From: Mike Solomon
Subject: New patch for waveforms
Date: Sun, 06 Jun 2010 21:51:20 +0200
User-agent: Microsoft-Entourage/11.4.0.080122

Hey lilypond developers,

As I am not good at posting patches on Rietveld, I submit to you the 2nd of
a two-patch diptych via the following link:
  http://www.apollinemike.com/lilypond/waveform
where you'll find a patch along with several files necessary to test it out.
Please play with it, try to break it, and let me know what you think.  This,
along with woodwind-diagrams, has been very useful for me in a recent piece
I composed, and I hope it can be useful for the lilypond community as well.

The basic idea is that it draws waveforms from text-files.  All the file
needs to contain is a list of values that constitute the height of the wave.
Then, using the following syntax, you put the wave in a score.

\relative c' {
  \waveformBegin #"foobar.txt" <more notes>
  \waveformPoint #0.3 <more notes> % you want the 3/10 point of the form to
hit here
   \waveformPoint #0.9 <more notes> & ditto for 9/10
   \waveformEnd <more notes>
}

Note that \waveformBegin, \waveformPoint, and \waveformEnd are all music
functions, so they apply to the note AFTER the command.

If you apply the patch, dump all the attached files into a directory, and
run lilypond, it should make nice waves.  And the waves fluctuate smoothly
to hit their control points, which is why waveform.cc has a lot of code
(although it probably could be shorter...suggestions for cuts are
appreciated!).

I use it both to indicate changes in vibrato (a notable improvement over my
heinous contemporary vibrato thingee on the LSR, which can be expediently
removed once this is polished into shape) AND to put recordings of an
electroacoustic track in a score and have it visualized.

One of the patch's features is that its guts (and by guts I mean its
callback calculate_broken_wave_placements) can work, in theory, with
anything that has a sampling rate, including spectrograms and graphical
scores.

Many thanks to the first one of you who posts this on Rietveld!

Cheers,
~Mike

P.S. One thing that the code lacks is stable control of intersections w/
this grob and others - is there a standard way to take care of that?  I
cheated in the included examples and overrode spacing stuff so that you can
see the waveforms w/o them bumping into anything.

P.P.S. THIS CODE CREATES NEW FILES!  So that you don't overwrite anything,
make sure to work in a clean directory.  Specifically, if you run all of the
files on the website, you will create the following new files in your
working directory:

wave.txt.0
wave.txt.1
wave.txt.2
wave.txt.3
wave.txt.4
wave.txt.5
wave.txt.6
wave.txt.7
wave.txt.8
wavetest_downsampled100.txt.0
wavetest_downsampled100.txt.1
wavetest_downsampled100.txt.2
wavetest_downsampled100.txt.3
wavetest_downsampled100.txt.4
wavetest_downsampled100.txt.5
wavetest_downsampled100.txt.6
wavetest_downsampled100.txt.7
wavetest_downsampled100.txt.8

P.P.P.S. I know nothing about Lilypond's translation process, although word
on the street is that it is very involved.  I'd be happy to beautify my
programming_error code accordingly once I know who needs to translate what.

P.P.P.P.S. I do all my vibrato generating using scipy and all of my
audio->text-file work in SuperCollider, in case any of you want to play with
generating new files that can take the patch for a spin.





reply via email to

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