a small ruby scitp I once wrote, might be usefull or inspiring ?!?
--
Jérémy Zurcher
rte de Cully 29
1091 Grandvaux
+41 (0) 79 599 84 27
#! /usr/bin/env ruby
# -*- coding: UTF-8 -*-
#----------------------------------------------------------------------------
#
# File : build_h2kit.rb
# Author : Jérémy Zurcher <jer...@asynk.ch>
# Date : 27/09/09
# License :
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
#----------------------------------------------------------------------------
HEAD = <<-EOF
<?xml version="1.0" encoding="UTF-8"?>
<drumkit_info>
<name>DKFH</name>
<author>Zurcher Jérémy</author>
<info><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
"http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style
type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'Helvetica'; font-size:10pt;
font-weight:400; font-style:normal;">
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px;
margin-left:0px; margin-right:0px; -qt-block-indent:0;
text-indent:0px;"></p></body></html></info>
<license>MIT</license>
<instrumentList>
EOF
INSTRUMENT=<<-EOF
<instrument>
<id>IDX</id>
<name>NAME</name>
<volume>1</volume>
<isMuted>false</isMuted>
<pan_L>1</pan_L>
<pan_R>1</pan_R>
<randomPitchFactor>0</randomPitchFactor>
<gain>1</gain>
<filterActive>false</filterActive>
<filterCutoff>1</filterCutoff>
<filterResonance>0</filterResonance>
<Attack>0</Attack>
<Decay>0</Decay>
<Sustain>1</Sustain>
<Release>5800</Release>
<muteGroup>-1</muteGroup>
<layer>
<filename>SOUNDFILE</filename>
<min>0</min>
<max>1</max>
<gain>1</gain>
<pitch>0</pitch>
</layer>
</instrument>
EOF
BOTTOM=<<-EOF
</instrumentList>
</drumkit_info>
EOF
File.open('drumkit.xml','w') do |f|
f << HEAD
Dir.glob('*.wav').each_with_index do |sound,idx|
s = INSTRUMENT.sub /IDX/, idx.to_s
s.sub! /NAME/, sound.sub( /_/, ' ').sub(/\.wav/,'')
f << s.sub(/SOUNDFILE/, sound)
end
f << BOTTOM
end
------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Hydrogen-devel mailing list
Hydrogen-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hydrogen-devel