It is currently Fri Jul 12, 2024 1:17 pm


Exactly what the various audio output group algorithms do

Speakers, amplifiers, headphones, multi-channel audio, reverb units, mixers, wiring, ...
  • Author
  • Message
Offline
User avatar

TimM

Member

  • Posts: 85
  • Joined: Tue Nov 15, 2016 8:18 am
  • Location: Rural Northeast PA

Exactly what the various audio output group algorithms do

PostMon Apr 17, 2017 7:36 am

The manual gives a very brief (a couple sentences) description of the algorithm by which one of the group-to-logical output cycling works. After searching this forum, I found the following very useful description of one of the algorithms:

------------------
For the 'Cyclic within octave, octaves and ranks cycled' algorithm the speaker number within the group to which a pipe will be routed is calculated as follows:

note_in_oct = (MIDI note number) mod 12
oct_num = (MIDI note number) / 12
num_speakers = number of speakers in the group
rank_seq_num = a number generated for the rank by sorting the ranks by RankID and then assigning an incremented number to each in turn (0 for the first rank, 1 for the second rank, etc.).

speaker_num = ( note_in_oct + oct_num + rank_seq_num) mod num_speakers
---------------------

But I could not find a similarly exact description of the other cycling methods. Is that documented anywhere? If not, would you consider posting the other methods? Thanks!

Tim
Offline
User avatar

mdyde

Moderator

  • Posts: 15608
  • Joined: Fri Mar 14, 2003 1:19 pm
  • Location: UK

Re: Cycling algorithms?

PostMon Apr 17, 2017 10:57 am

Hello Tim,

I've made a document for you to show exactly what the two 'tone matching' algorithms do:

http://downloadhauptwerk.com/misc/Hauptwerk4ToneMatchingAlgorithms.pdf

Those two were originally primarily designed to minimise the occurrences of dissonances on any given channel in equal temperament when used with 3-5 outputs in a group.

For the cyclic algorithms the audio output number within the group to which a pipe will be routed is calculated as follows:

midi_note_num = <MIDI note number>
note_in_oct = (midi_note_num) mod 12
oct_num = (midi_note_num) / 12
num_outputs = <number of audio outputs in the group>
rank_seq_num = (a number generated for the rank by sorting the ranks by RankID and then assigning an incremented number to each in turn (0 for the first rank, 1 for the second rank, etc.)>

---
'Cyclic within octave, octaves and ranks cycled' algorithm:

output_num = ( (note_in_oct) + (oct_num) + (rank_seq_num) ) mod (num_outputs)

---

'Cyclic within octave, octaves constant (C/C# split)' algorithm:

output_num = (note_in_oct) mod (num_outputs)

---

'Cyclic across whole rank compass' algorithm:

output_num = (midi_note_num) mod (num_outputs)

---
Best regards, Martin.
Hauptwerk software designer/developer, Milan Digital Audio.
Offline
User avatar

mdyde

Moderator

  • Posts: 15608
  • Joined: Fri Mar 14, 2003 1:19 pm
  • Location: UK

Re: Exactly what the various audio output group algorithms d

PostMon Apr 17, 2017 10:59 am

[P.S. I've moved the topic here, edited its title slightly, and made it 'sticky' so that people can find it in the future as easily as possible, since I imagine other people might find this information useful too.]
Best regards, Martin.
Hauptwerk software designer/developer, Milan Digital Audio.
Offline
User avatar

TimM

Member

  • Posts: 85
  • Joined: Tue Nov 15, 2016 8:18 am
  • Location: Rural Northeast PA

Re: Exactly what the various audio output group algorithms d

PostMon Apr 17, 2017 3:13 pm

Thank you! That is very useful.

Tim
Offline
User avatar

elia

Member

  • Posts: 125
  • Joined: Mon Oct 27, 2008 1:11 pm
  • Location: Italy , Padova

Re: Exactly what the various audio output group algorithms d

PostMon Aug 21, 2017 12:34 pm

To complete the speech, it may be useful to remember that if Hauptwerk does not have an allocation algorithm that suits you then within certain limits you can create one yourself (and outside Hauptwerk).

If it may be useful to extend the concept of "Tone Matching Mode 1 & 2" using less than 12 speakers you may consider a hypothetical "Tone Matching Mode 3".

All of Hauptwerk allocation algorithms assume that each note is statically allocated in A channel. This is a correct assumption but in some cases the intermodulation distortions that occur when using intervals other than octave/unison are quite annoying, especially if you use saturation plugins (which exalt the distortions).

If you are using 6 speakers (or less than 12) you can dynamically manage 12 chromatic notes allocations to avoid overlapping intervals different from unison/octave on the same speaker. This means that a same note may appear, at different times and at different contexts, in a different speaker in order to avoid intermodulation distortions. This works well until there are up to 6 different chromatic notes at once. Obviously the ways of implementation can vary, but the underlying concept is always the same.

Tone Matching Mode 3 does not exist in Hauptwerk. To simulate it, you have to use 12 virtual chromatic channels with Hauptwerk and manage these 12 channels within a VST/AU plugin in a DAW. In practice, you can create a mixing rule from 12 notes (=chromatic scale) to less than 12 available speakers.

It's not a simple thing but Ardour DAW can help you do this with a Lua DSP script.
http://manual.ardour.org/lua-scripting/

I wrote a script that does this and works well at zero latency.
Later I will publish an easily manageable version with a friendly user configuration interface.
Elia
Offline
User avatar

mdyde

Moderator

  • Posts: 15608
  • Joined: Fri Mar 14, 2003 1:19 pm
  • Location: UK

Re: Exactly what the various audio output group algorithms d

PostTue Aug 22, 2017 3:54 am

Hello Elia,

Although routing pipes dynamically to different speakers depending on the pipes that are are already sounding could potentially give some benefit in terms of reducing the load on the speakers (helping to minimise speaker distortions), Hauptwerk intentionally doesn't include that functionality natively since it wouldn't be realistic, in that any given virtual pipe would then be heard to move seemingly arbitrarily around the listening room each time it was played, whereas each real organ pipe always sounds from a fixed point in space. I think you would find the effect noticeably unnatural.

Likewise with using saturation effects on Hauptwerk's output -- saturation/distortion effects and pipe organs don't traditionally go together.

However, you could of course potentially implement those things yourself outside of Hauptwerk if you really wanted to, as you describe.
Best regards, Martin.
Hauptwerk software designer/developer, Milan Digital Audio.
Offline
User avatar

elia

Member

  • Posts: 125
  • Joined: Mon Oct 27, 2008 1:11 pm
  • Location: Italy , Padova

Re: Exactly what the various audio output group algorithms d

PostTue Aug 22, 2017 5:37 am

Hello Martin,
I totally agree with the general observations for wet and stereo/surround sampling and when the listener is near the source.

In the particular case of a church, the situation is very different.

Unfortunately dry sampling is not always as clean as you would expect in the studio and you often have to do creative work to revitalize the sound. Even a good equalizer can help a lot.

There are various sources of distortion: the speaker, the amplifier and even the digital mixing. The latter (intermodulation distortion) is created at the beginning of the audio chain and can not be deleted. Obviously this is a very variable distortion as intensity and depends on the context.

With monophonic dry sounds, octave/unison interval greatly alleviates this effect at the expense of playing the same note on the same speaker.

If you place speakers very close to each other then 15 meters away from the source it is very difficult to notice that the notes move. A note moves only when it is completely extinct and its place has been occupied by another note.

In short, this is always a compromise. You must always judge with your ear to see if it can be useful. In the particular case, sound can be more easily structured, elaborated and controlled, even though CPU load may become very heavy even for a Mac Pro. (In addition, the 32-channel VSTi limit requires the use of Jack Audio or other routing systems to scale over a larger number of channels for more structured and complex work.)

Best regards,
Elia
Elia
Offline

mnailor

Member

  • Posts: 1650
  • Joined: Sat Nov 30, 2013 5:57 pm
  • Location: Atlanta, GA

Re: Exactly what the various audio output group algorithms d

PostThu Nov 04, 2021 7:26 pm

Martin, have you written an update to the algebraic list of the algorithms given above in this thread? I'd like to understand the ones added in HW 5 and 6.

Thanks!
Offline
User avatar

mdyde

Moderator

  • Posts: 15608
  • Joined: Fri Mar 14, 2003 1:19 pm
  • Location: UK

Re: Exactly what the various audio output group algorithms d

PostFri Nov 05, 2021 5:09 am

Hello Mark,

I hadn't, I'm afraid, but the following are some notes for the available algorithms. In v5+, in all of the algorithms the 'Allocation algorithm note offset' user setting is added to the MIDI note number prior to any other operations involving the MIDI note number, i.e. for v5+:

adjusted_midi_note_num = ( midi_note_num + allocation_algorithm_note_offset )
adjusted_note_in_oct = ( adjusted_midi_note_num MOD 12 )
adjusted_oct_num = ( adjusted_midi_note_num / 12 )

... and as for v2-v4:

num_speakers = number of speakers in the group
rank_seq_num = a number generated for the rank by sorting the ranks by RankID and then assigning an incremented number to each in turn (0 for the first rank, 1 for the second rank, etc.)

... in the following v5+ algorithms:

- Static: tone matching mode 1: Works exactly the same as 'tone matching mode 1' in Hauptwerk v2-v4 (except that adjusted_midi_note_num is used instead of midi_note_num).
- Static: tone matching mode 2: Works exactly the same as 'tone matching mode 2' in Hauptwerk v2-v4 (except that adjusted_midi_note_num is used instead of midi_note_num).
- Static: cyclic within octave, octaves const, rks const (C/C# split): speaker_num = ( adjusted_note_in_oct MOD num_speakers ).
- Static: cyclic within octave, octaves cycled, ranks constant: speaker_num = ( ( adjusted_note_in_oct + adjusted_oct_num ) MOD num_speakers ).
- Static: cyclic within octave, octaves cycled, ranks cycled: speaker_num = ( ( adjusted_note_in_oct + adjusted_oct_num + rank_seq_num ) MOD num_speakers ).
- Static: cyclic across whole rank compass, ranks constant: speaker_num = ( adjusted_midi_note_num MOD num_speakers ).
- Static: cyclic across whole rank compass, ranks cycled: speaker_num = ( ( adjusted_midi_note_num + rank_seq_num ) MOD num_speakers ).
- Dynamic: cyclic within group (for each key press). [Result varies with each subsequent key press.]
- Dynamic: random (for each key press). [Result varies with each subsequent key press.]
Best regards, Martin.
Hauptwerk software designer/developer, Milan Digital Audio.
Offline

mnailor

Member

  • Posts: 1650
  • Joined: Sat Nov 30, 2013 5:57 pm
  • Location: Atlanta, GA

Re: Exactly what the various audio output group algorithms d

PostFri Nov 05, 2021 8:45 am

Thank you, that's what I was hoping for.

Did I observe incorrectly during my brief trial of the dynamic algorithms that all the ranks in the group used the same speaker for one note press? I wasn't able to get any spread of ranks across speakers with dynamic.
Offline
User avatar

mdyde

Moderator

  • Posts: 15608
  • Joined: Fri Mar 14, 2003 1:19 pm
  • Location: UK

Re: Exactly what the various audio output group algorithms d

PostFri Nov 05, 2021 9:13 am

Thanks, Mark.

Specifically, this is what the dynamic algorithms do:

- Dynamic: cyclic within group (for each key press): After starting audio/MIDI, the very first note of polyphony (instance of a pipe sounding, irrespective of which pipe) that plays through a given group will be allocated to the first bus in the group. The next note of polyphony (regardless of whether it is a pipe that has sounded previously, and irrespective of MIDI note number, note offset, or rank) will sound through the next, and so on, cyclically within the group. Hence if you play a 3-note chord (in a group containing more than 3 buses) then each of the 3 virtual pipes will be allocated to different buses.
- Dynamic: random (for each key press): Each note of polyphony (instance of a pipe sounding, irrespective of which pipe, or what has occurred before) will be allocated to a random member of the group.

Hence the dynamically algorithms are statistically most likely to give the most even spread of pipes amongst speakers, but their disadvantage is that pipes are likely to 'move around' between the speakers for successive key presses.
Best regards, Martin.
Hauptwerk software designer/developer, Milan Digital Audio.
Offline

mnailor

Member

  • Posts: 1650
  • Joined: Sat Nov 30, 2013 5:57 pm
  • Location: Atlanta, GA

Re: Exactly what the various audio output group algorithms d

PostFri Nov 05, 2021 9:50 am

That makes sense of what I saw. So one note won't spread its pipes over speakers in the group, but more concurrent notes will. Thank you!

I wish there were a way to do both: When one note is played, spread the pipes over the group's outputs dynamically, then add pipes for subsequent notes to the momentarily least used outputs (I guess that's just least used in both cases, first and subsequent notes, with a random tie-breaker to spread the load over time). I think you gave reasons above why that's not feasible; I can't read back there while typing this so I apologize if it's already been answered.

It seems like the best current approach for me is still to use cyclic within octaves, octaves cycled, ranks cycled, or ranks constant with note offsets fiddled by hand on the samplesets where an unfortunate rank id sort order defeats spreading different pipes over outputs for the same note, i.e. when the number of perspectives for the stop happens to cycle the front ranks all to the same output for the same note. But setting note offsets is a big chore and I don't really want to have to do that very often.

I'll listen to the dynamic options more -- maybe that could save a lot of setup effort and give a reasonably happy result.

Thanks!
Offline
User avatar

mdyde

Moderator

  • Posts: 15608
  • Joined: Fri Mar 14, 2003 1:19 pm
  • Location: UK

Re: Exactly what the various audio output group algorithms d

PostFri Nov 05, 2021 10:09 am

Thanks, Mark.

mnailor wrote:So one note won't spread its pipes over speakers in the group, but more concurrent notes will.


I'm not sure that I'm clear what you meant by that, but if, for example, you draw just one stop on a single-perspective sample set (e.g. St. Anne's) and play just one key repeatedly then each subsequent key press will be allocated to the next speaker in the group, cyclically. I..e. the same pipe will cycle around the group with each key press.
Best regards, Martin.
Hauptwerk software designer/developer, Milan Digital Audio.
Offline

mnailor

Member

  • Posts: 1650
  • Joined: Sat Nov 30, 2013 5:57 pm
  • Location: Atlanta, GA

Re: Exactly what the various audio output group algorithms d

PostFri Nov 05, 2021 10:45 am

Sorry, I meant if I draw two or more stops and play one note once, both pipes go to the same output. If I hold it or the reverb is still going, and add another note, another output is used, so the concurrently playing notes make use of more outputs.
Offline
User avatar

mdyde

Moderator

  • Posts: 15608
  • Joined: Fri Mar 14, 2003 1:19 pm
  • Location: UK

Re: Exactly what the various audio output group algorithms d

PostFri Nov 05, 2021 12:17 pm

Thanks, Mark.

Assuming you have at least 2 buses in the group:

mnailor wrote:I meant if I draw two or more stops and play one note once, both pipes go to the same output.


No -- in that situation the two pipes would go to different buses.

Think of it this way: each group has a counter, which starts pointing to the first bus within the group. Whenever a virtual pipe needs to sound (irrespective of what note it is, or what rank it is, or what has happened before), it is assigned to the bus to which the counter points, then the counter is incremented to the point to the next bus in the group (wrapping back to the first bus in the group once it has passed the last bus in the group).

Let's say you have 4 buses in the group:

Hence if you have two stops drawn and play a single key, the first virtual pipe (of the two that need to sound) will be allocated to the first bus in the group. [The counter will then be automatically incremented to point to the second bus.] Immediately afterwards, the second of the two virtual pipes will be allocated to the second bus [and the counter incremented again to point to the third bus]. Now (keeping the same two stops drawn) if you play another key (irrespective of whether it's the same key as the first time, or a different one) the first of its two virtual pipes will be allocated to the third bus [and the counter incremented] and the second of its two virtual pipes will be allocated to the fourth bus. [The counter will then wrap back to point to the first bus, since there are only 4 buses in the group.]
Best regards, Martin.
Hauptwerk software designer/developer, Milan Digital Audio.
Next

Return to Amplification

Who is online

Users browsing this forum: No registered users and 3 guests