Re: MIDI with scales *and* soundfonts

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

 



Laura Conrad wrote:
> I'm trying to set up my USB MIDI keyboard so that it will play through
> a synthesizer with a reasonable harpsichord (or for present purposes,
> lute) sound and also use tuning tables such as the ones from scala for
> meantone tuning.
>
> Running scala itself on my Ubuntu Intrepid system is problematic, and
> I haven't gotten it to actually make any sounds yet.  Almost
> everything I try hangs without giving me a useful error message.
>
> I can run qsynth with a .sf2 font from hammersound.com and get a
> pretty good harpsichord sound, but I don't know how to alter the
> tuning.
>
> I can run zynaddsubfx with a .scl tuning table loaded, but the plucked
> string sounds that come with zynaddsubfx aren't anything like as good
> as the harpsichord soundfonts.
>
> Has anyone solved anything like this problem?

TiMidity++ (mine is version 2.13.2) accepts sf2 files, and the following 
command line arguments:

-Z file, --freq-table=file
Cause the table of frequencies to be read from file. This is useful to define 
a tuning different from 12-equal temperament.  If ``pure'' is specified, 
TiMidity++ plays in trial pure intonation.

-Zpure[n(m)], --pure-intonation=[n(m)]
Play in trial pure intonation by Key Signature meta-event in the MIDI file.  
You can specify the initial keysig by hand,  in  case the MIDI file does not 
contains the meta-event.  Optionally, n is the number of key signature.  In
case of sharp, n is positive.  In case of flat, n is negative.  Valid values 
of n are in the interval from  -7  to 7.  In case of minor mode, you should 
put `m' character along with -Zpure option.

The format for the table of frequencies is a simple text file with 128 
integers representing the frequency in Hz of each MIDI note number.

As an example, the attached BC program generates a table of frequencies 
corresponding to the equal temperament.

Regards,
Pedro
/*
* Calculation of a MIDI table of frequencies for timidity
*
* Process with GNU bc:
*	$ bc -l equal_temperament.bc
*    
* Copyright (c) 2003 Pedro Lopez-Cabanillas
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

/* 
 * trucate a number, returning the integer part of the argument
 */   
define trunc(x) {
  auto t, tmp_scale
  tmp_scale=scale(sqrt(2))
  scale=0
  t=x/1
  scale=tmp_scale
  return t
}

/*
 * round a number, truncs or shifts it to the next integer
 */
define round(x) {
  return trunc(x+0.5)
}

/*
 * round a number to the given precission
 */
define roundto(x, d) {
  auto t, tmp_scale
  tmp_scale=scale(sqrt(2))
  scale=d
  t=round(x*(10^d))/(10^d)
  scale=tmp_scale
  return t
}

/*
 * twelve root of 2
 */
r12of2 = e(l(2)/12)

/*
 * frequency for a piano key
 * Note: freq(0) = A(-2)
 */
define freq(x) {
  return 6.875*(r12of2^x)
}

/*
 * print the list of the 128 MIDI freqs
 * from C(-2) to Ab(10)
 */
for(i=3; i<131; i++) { 
  trunc(roundto(freq(i), 3)*1000)
}
_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@xxxxxxxxxxxxxxxxxxxx
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-user

[Index of Archives]     [Linux Sound]     [ALSA Users]     [Pulse Audio]     [ALSA Devel]     [Sox Users]     [Linux Media]     [Kernel]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux