Showing posts with label Synth. Show all posts
Showing posts with label Synth. Show all posts

Sunday, 1 January 2017

Using the Apple General MIDI DLS Sound Bank Synthesizer in Ableton Live 9

This is an update and extension to my March 2010 blog entry...

The Apple General MIDI Down-Loadable Sound (DLS) Sound Bank Synthesiser is an Audio Unit plug-in that is provided in Mac OSX/macOS. The plug-in is referred to as the Apple DLS Music Device in Ableton Live. (Audio Units work in the 32 or 64 bit versions of Ableton Live.)

Here are some notes on using it:

Making Audio Units visible



My install of Live 9 did not show Audio Units by default, and so I needed to enable them. You may need to set the 'Use Audio Units' toggle to 'On' in the 'File Folder' Preferences pane.


(This is not where I'd immediately expect 'Plug-ins' to be managed, but this is where Ableton put these settings. Note that there are some other useful settings in this pane: the 'Save Current Set as default' can be a very productive time-saver if you have a complex standard setup...) 

Opening the 'Audio Units' folder shows a lot of sub folders (I'm running the 32-bit version of Live here, but this could be the 64-bit version with 32 Lives or JBridge/JBridgeM). You need to open the 'Apple' folder by clicking on the triangle...




















The 'DLSMusicDevice' is right at the bottom of the list. All the other Apple Audio Units start with 'AU', and so the DLS Synth gets pushed to the bottom of the list. Depending on your screen-size, you may need to scroll down to find it.

Unlike all of the other Audio Units (which are audio effects), the DLSMusicDevice is an Instrument. It can produce multiple channels of polyphonic audio simultaneously, and can be a useful extra source of sounds, particularly when you start to re-assign the tracks in a MIDI file inside Live.













Mono-timbral use

Here is a MIDI Track with the DLSMusicDevice plug-in dropped into it. You can create a MIDI Clip containing a few note events to test out the DLSMusicDevice, or you could use a keyboard (or the virtual keyboard on a laptop) - the highlighted red 'Record' button at the bottom of the track-strip enables this. 

Ableton always uses MIDI channel 1 by default inside a track, so this will use the first one of the 16 available MIDI channels in the DLSMusicDevice plug-in, and so you can only use it for instrumental voices - there is no way to change the MIDI channel that is used when you use this way of accessing the DLSMusicDevice. So if you only need a single channel of basic General MIDI instrument sounds, then this may be all that you need. Note that if you create a MIDI Clip then you can use the 'Program Change' control to select the sound that the DLSMusicDevice produces.

To get the control window to appear, you just click on the 'Spanner' icon in the generic X-Y controller box that appears in the track detail view at the bottom of the screen.

Notice here that I've made the Inputs and Outputs visible by clicking on the I-O circle on the far right of the mixer, just to the right of the master volume sliders. What is interesting is that this MIDI Track is behaving exactly as it should - receiving MIDI inputs and converting them into audio outputs. Unfortunately, Live seems to always send MIDI information to the DLS plug-in on MIDI channel 1, and there is no control to change this in the I-O panel. In fact, for this simple example, you do not need to see the inputs and outputs at all.

The 'Reverb Volume' is highlighted because the default is to smother the audio in lots of reverb. You are advised to lower this setting! If you add any in-line effects in the track then having reverb in the source audio sounds strange anyway - so use a reverb plug-in at the end of the processing chain. My personal favourite effects plug-in for the DLSMusicDevice is the 'Auto-Filter', where subtle use can remove some of the 'General MIDI' giveaway sound footprint! [ And for non-subtle: SoundCloud example using just DLSMusicDevice as the sound source... ]

Sound Banks

Notice that the dialogue box for the DLSMusicDevice calls it an 'Apple Sound Bank Synthesiser'...  This instrument can be used to play more than just the default Apple General MIDI-compliant sound bank (this bank is confusingly called the 'QuickTime Music Synthesiser') - it can play any Soundfont sound file with a .sf2 suffix.

The 'Properties' section can be left alone. The 'Restrict CPU Load' control is a remnant from many years ago, when playing back audio was a considerable strain on a Mac's CPU. On a modern machine, leaving the render quality at maximum is fine.





To enable playback of additional sound banks on a Mac, you need to put some .sf2 files into your /Library/Audio/Sounds/Banks/ folder. (You may need to use the option key inside Finder to make the Library folder visible.) Note that the default Apple 'QuickTime Music Synthesiser' bank is not stored here, and so this folder will probably be empty the first time you open it.

Some .sf2 files contain complete banks of sounds, whilst others contain just one sound. By creating an 'Instruments' folder, you can keep these 'single sound' files separate. You may also find that some .sf2 files do not work, and the 'Don't Work' folder is there to hold these as a reminder to keep a lookout on the Interweb for an updated version. Sometimes when a sound bank file does not work, it can cause other banks or sounds to stop working as well, so you may need to delete the DLSMusicDevice from the track, and re-insert it to force it to restart.

Notice that the 'Sound Bank' selector now says '32MbGM stereo sound bank' instead of 'QuickTime Music Synthesiser'. (Remember, despite the name, this is just a sound bank!)  When you add .sf2 files to the audio folder they appear in this pop-up selector in alphabetical name order... so 'QuickTime Music Synthesiser' is often near the bottom of the list.

Folders placed inside the 'Audio' folder appear with a triangle indicator. inside the pop-up selector.  In this example, the Apple 'QuickTime Music Synthesizer' sound bank is just one of six available banks of sounds.

General MIDI sound banks have their sounds arranged in a specific order, where program change numbers map to particular types of sounds (0/1 is a  'Grand Piano' sound, for example, whilst 48/49 is a 'Strings Ensemble' sound. General MIDI sounds can vary considerably between sound banks. Some sounds banks do not follow the General MIDI mapping of sounds to program change numbers.

Some .sf2 files contain just a single instrument sound.










Many .sf2 files come with documentation. Putting these extra files in the 'Documents' folder keep everything neat and tidy.








----------

Auditioning .sf2 SoundFont files

A search for .sf2 using a search engine on the Interweb is going to produce lots of results, which then leads to the question of 'auditioning'. In this case, there's no need to commission a TV programme to find some suitable candidates...

What IS needed, to save lots of time and finger-wear, is a way of running through the sounds in a .sf2 file quickly, so that you can triage them into a few categories (and thus into named folders inside the '/Banks' folder...):

  • GM soundbanks
  • Non-GM sound banks
  • Individual Instrument sounds
  • Drum sounds

Inside Live, using the program change control in a clip isn't very convenient, so I have written two M4L utilities that make auditioning .sf2 files quicker and easier. You can get them from MaxForLive.com

DLS_Helper_N is designed to help listen to Note-based .sf2 SoundFont files to quickly learn about their audio contents. You just drop it into the track that has the Apple DLS Synth in it. There are two main modes of operation: manual and automatic.


In Manual mode, you can use the vertical slider control to select a specific sound by sending MIDI program change messages shown with the matching General MIDI Instrument name, and then playing on the [A - L] virtual MIDI keyboard inside Live, or on your external MIDI keyboard (or other instrument). There are two keyboard shortcuts: the Down cursor button is assigned to a 'Next' button, which changes the program, and the Up cursor button controls an Up/Down counter. The counter normally starts up in 'Up' mode, and so every time you press the Next button, the program change counter goes up by one. You can then play some notes to audition the sound. Remember that to keep the keyboard focus inside the DLS_Helper, you need to click inside it, and I've included some words that say this in the UI. If the focus strays outside the plug-in, then you will activate the Live keyboard shortcuts. (The workflow of 'Next' then play a few notes' is okay for the first few sounds, but I rapidly got bored, and so I added more automation...)

In Automatic mode, incrementing of the program change number happens automatically, at a rate controlled by the Rate rotary control, and each change of program is indicated by a flash of a red indicator (and by the changing of the GM name in the text window). Some sounds has slow attacks, and so setting the Rat control too fast may mean that you don't hear the start of some sounds. But for most sounds, automatic advancement through the sounds in the middle range of the Rate control should work fine. There are shortcut keys: the Cursor Right button is assigned to starting and stopping the counter, whilst the Cursor Left button resets the program counter (for the Automatic AND the Manual modes!). Once a new program change has been selected, four notes are played so that you can hear the sound assigned to that number in the bank. The default here is four notes from a C Major scale, played at a fixed MIDI Velocity. You can alter the Velocity setting with the rotary control. After a few minutes of hearing the same four notes at the same velocity setting robotically played by different sounds, then you may need to activate the two variation buttons: for Notes, then you can activate the 'Random' variation, which plays a variety of different scales, some more exotic than others; whilst for Velocity, then you can activate the 'Random' variation, which adds random variety to the Velocity setting. The variation controls can make an extended audition session much easier to carry out.

For auditioning drums, then you need to use the multi-timbral setup, which is described next.


Multi-timbral use

There is another way to use the DLSMusicDevice. It is more complex, but it allows you to utilise the full multi-timbral (several different sounds at once) capabilities of the Apple DLS plug-in.

You start in exactly the same way - create a new MIDI Track. (This screen-shot is from Live 8, and so the graphics may be slightly different, but the method is the same...)















This time, you definitely need to make the Inputs and Outputs visible by clicking on the I-O circle on the far right of the mixer, just to the right of the master volume sliders.

This I-O panel is the key to assigning MIDI channels to the DLS Music Device.












You then drop the Apple DLS plug-in into the MIDI Track. This sets up the DLS Music Device so that it receives MIDI Input and outputs audio into the mixer. But this time we are going to re-route where the MIDI Input is coming from...














The Track name will have changed to DLSMusicDevice...
















And the Apple Music Synthesizer dialogue box will have appeared... Note that the three 'Parameter' slider controls ( tuning, volume and reverb volume ) are global, and so they affect all the DLS sounds.







You now need to add a second MIDI Track... This is going to be used to hold the clip containing the note events, and to control the MIDI channel of those events...















The I-O panel in this new MIDI Track contains this vital pair of controls, which aren't exactly obvious in what they do...















The upper pop-up list control shows a list of the Tracks that the MIDI output from this MIDI Track can be connected to. In this case, we want the output of this Track to go to the DLSMusicDevice, so we select the first Track that we created...

Any note events that we put into a piano roll Clip on this Track will now be routed as MIDI note events to the DLSMusicDevice, which will turn them into audio.










The lower pop-up list control lets you control the MIDI Channel of the note events that are sent to the DLSMusicDevice Track.














Here's a summary of what the two pop-up controls do...

Notice that the 1-DLSMusicDevice in the top pop-up refers to the plug-in being in Track 1, whilst the 2-DLSMusicDevice in the bottom pop-up refers to the MIDI Channel that the note events will be sent on... If the DLSMusicDevice was dropped into MIDI Track 3, then the top box would say 3-DLSMusicDevice. When you select the target Track with the top pop-up, then the DLSMusicDevice plug-in should be obvious - just make sure that you always look at the lower pop-up to check what MIDI Channel you are using.

You can now create a new Clip in the new MIDI Track...
















Remember that the lower pop-up selects the MIDI Channel that the DLSMusicDevice will use for this Clip, and the Program Number controls on the left of the Clip piano-roll will select the sound for that MIDI Channel...













Here's the MIDI Channel pop-up control...

















And here is the Program Number pop-up for selecting the sound or instrument. Note that you need to move the slider on the right to switch between low and high numbers, just like in any Live selector control with lots of options.

(Remember that for auditioning sounds, there are my M4L helpers...)













Remember that you can create several MIDI Tracks, assign them to different MIDI Channels (like Channel 10 for Drum sounds) and make the most of the multi-timbral capabilities of the Apple DLS Music Device.

In this example, the top pop-ups all route the MIDI events to the DLSMusicDevice plug-in on Track 1 (shown highlighted in Red), whilst the individual MIDI Channels (set by the lower pop-up) are shown highlighted in green.



--------

Auditioning Drum sounds

To audition the dum sounds on MIDI Channel 10 inside a .sf2 Soundfont file, you need to set up the DLS synth in one MIDI track inside Live, and then set a second MIDI track onto MIDI Channel 10. You then add the DLS_Helper_D M4L plug-in to the second MIDI track, and set this to be the 'Record' track with the little red button, since this is where you will be auditioning drum sounds.

Because there are lots of drum sounds, then manually playing all of them isn't really an option, and so the _D version of the DLS_Helper only has the Automatic mode. The counter this time is for Note Numbers: the default from 35 to 81 to cover the defined General MIDI mapping. The keyboards shortcuts are different from the _N Note version, and are designed for the  MacBook Pro keyboard layout. Backslash Runs or Stops the counter, whilst Forward Slash resets the count and replays that note. 

The Rate rotary control sets the rate at which the drums sounds play, and there is the same Fixed/Random MIDI Velocity control as before. The final two controls allow the start and end note numbers to be set, which means that you can choose a sub-set of the GM mapping range if you wish. A programming error by me caused the Start rotary control to gain an unexpected extra feature - it repeats notes instead of skipping directly to the start, but I have left this in because it allows all sorts of interesting drum patterns to be produced. Consider it a serendipitous accident.

 You might have realised that because the second track is just a reference to the main track that contains the actual DLS Synth, then the pop-up dialogue box is not visible when this track is selected (and this DLS_Helper_D is shown. To change the .sf2 Soundfont file that is playing, you need to go back to the 'DLS' track, change the sound selection, and then go to the second 'Channel 10' track to use the DLS_Helper_D plug-in. Once you get your he'd around the process, this isn't as hard as it seems. I have shown the two tracks as 'D' and 'N' in the accompanying diagrams.








Hopefully, you now have enough information to make the most of the Apple DLS Synth inside Ableton Live 9.



Sunday, 24 January 2016

Generating audio soundscapes...

A few weeks back, I revisited my old Reaktor workspace and started reworking some of the ideas in there for M4L. Here's the second output from that project...


Saw4Generator_Dark is a sound generator with preset memories. It does not respond to MIDI inputs - it just sits there and makes noises continually...

The basic idea is very simple. There are two sections: a sound generator that produces the raw sounds; and a mix processor that controls how those sounds are formed into a stereo sound stage. Both sections have manual controls that can be tweaked, as well as LFOs that allow some changes to be made cyclically over time (although this version does not allow the sound generator modulation settings to be controlled by LFOs, which is something for a future version)


The sound generator section starts with a sawtooth wave oscillator with and and LFO to modulate the pitch and the output is frequency modulated by another similar oscillator, which is modulated by another similar oscillator, and another one on top of that... The result is a simple FM vertical arrangement that is often referred to as a 'stack'. There are a lot of controls!

The mix processor is a flexible output stage with even more controls! The output allows mixing of four deliberately-harmonically-diverse outputs: the final oscillator itself ('Saw'), the ring modulated output of the third and final oscillators ('Ring'), the output of the third oscillator 'sample & hold' processed by the final oscillator ('S&H'), and the output of the second oscillator 'sample & hold' processed by the final oscillator ('H&S'). In other words there are four separate outputs, each with its own unique harmonic content. The output stage has LFO modulation of the mixing, plus LFO panning as well.

There's a lot of power here to control the sound, and a lot of LFOs providing the bulk of that automation. As always with LFOs (and often with VCOs, and especially with digital versions of these building blocks...), the 'never the same twice' rule applies - so don't set all the LFOs to the same rate or the same modulation, instead go for values that won't 'collide' too frequently: ratios that are prime numbers are good. Here's why:

If you think about two LFO were one is twice the speed (rate) of the other, then they will 'collide' or repeat (have the same values at the same time) every cycle of the slowest LFO. In the diagram I've simplified the LFO to show only two output states (0 and 1):

01010101010101  (rate = 1)
00110011001100  (rate = 1/2)
^   ^   ^   ^   (the pattern repeats quickly) 

But if the rates (or the ratios between them) are prime numbers, then the collisions take much longer to happen:

00011100011100011100011100011100011  (rate = 1/3)
00000111110000011111000001111100000  (rate = 1/5)
^                             ^      
(the pattern repeats more slowly)

So by setting values like these:
0.01
0.02
0.03
0.04
You will get lots of places where the LFOs are in sync, and digital systems are pretty precise with timing for LFOs, and so you tend to get short repetitive patterns, which normally isn't what you want when you are controlling a complex sound generator...

Better values for getting long times between repeats would be more like:
0.03
0.05
0.07
0.11
Which takes quite a long time to repeat, and sounds a lot more complex when you hear the controlled output.

Getting Started

A good way to start with Saw4GeneratorDark is to turn all the controls to the leftmost minimum position, and then to select the Saw button, adjust the volume to your preference, and choose the pitch you want in Oscillator 4 (there's just a Pitch control there, so it is easy to find! You will also find the 'preset' store buttons here. 'Shift & Click' to store, Just Click to recall. Saving this 'All leftmost' preset is a good place to start again when you get lost).

Using just one oscillator is a good way to learn the output options: LFO modulation of volume, plus LFO panning. Once you have gt your head around the controls (some ping-pong echo is very often applied to the output of this type of generator...) then there is the LFO modulation of the pitch of the oscillator to try out. Saving a simple sound like this is often a good starting point for further exploration.

When you are comfortable with all of that then you can try moving to the left and try exploring the pitch and modulation controls for Oscillator 3, then the LFO pitch modulation for that oscillator, and so on to the leftmost Oscillator. Because Oscillator 1 is at the top of a stack of FM then it can cause big changes to the oscillators underneath it, so be cautious at first with the pitch and modulation controls. If everything gets too much, then just go back to the 'all leftmost' and start again from Oscillator 3.

Further processing

The screenshot above shows one possible chain of audio processing that you can add after Saw4GeneratorDark. A 'Saturator' is used in the 'wave shaper' mode, followed by an 'Auto Filter' set so that a resonant filter peak scans across the frequency spectrum, then a limiter to avoid problems with a peaky filter on the resulting rich audio material, and then the ubiquitous 'Ping-Pong Delay'.


The thinking behind this type of audio processing chain is straightforward: generate a harmonically-rich sound source, and then dynamically filter it down into a simpler sound. The Saw4GeneratorDark output already has a lot of harmonic content, and so the Saturator doesn't need very much drive in order to get a lot of frequencies, but it can be useful for a little bit of thickening or 'colouring' of the output. The low-pass peaky filter lets some low frequencies through, and so tends to give a stronger sound, but try using a peaky band-pass (or high-pass) and see the difference that it makes to the sound landscape that is produced. You can replace the simple Limiter with a Multiband Compressor if you want more control over the output frequencies, but you might think that there are already enough controls! The final Ping Pong Delay just pushes things together, and could be replaced (or augmented) with some Reverb.

This is just one possible chain of post-generator processing. There are many more possibilities to play with, and when combined with Saw4GeneratorDark, you can create a wide variety of unusual soundscapes. There's a lot to explore in Saw4Generator, and a lot of sounds waiting to be created. Recording the output and processing it further is thoroughly encouraged!

(As always, this is a work in progress, so it may not be perfect, and early versions tend not to have very much help on controls included in the M4L. Please feel free to report bugs via the comments, and I will try to fix them when I can find time.)

Thursday, 24 December 2015

Waverne development = Waivy

For a while, I've been working on a new version of my Waverne synthesiser. Waverne takes the Laverne synthesiser example from Max (by Cycling'74) and replaces the waveform-based synth engine with a swept segment wavetable that provides very complex sounds instead of static ones. Kind of 'effects within' rather than 'at the end of the' audio processing... If you've ever used the Tide synthesiser from Christian Kleine, then that is Waverne expanded in several directions! But what about making Waverne simpler and smaller?


Waivy is a teeny, tiny version of part of the forthcoming new version of Waverne. I now have a more powerful wavetable tool to work with (Wave Creator) and this simplifies the job of creating the large wavetables that the engine requires. For Waverne I used Audacity a lot to generate the custom wavetables, but for Waivy I have used the Wave Creator 512 tool, and the results are very encouraging.

Waivy has a minimalistic set of controls. But don't let this fool you: Waivy is a powerful little plug-in, with lots of sound generating capability.

[Detune] allows you to tune the two oscillators to 'in-tune' by clicking on the triangle (or setting it to 0.00. Moving th control away from 0.00 detunes the two oscillators symmetrically, so there isn't any overall pitch change, but it does mean that the direction you move in does not matter - the tune sounds the same if you move the control to the left or the right. I considered putting the detune so that 0.00 was on the left hand end, and full detune was on the right, with clockwise rotation giving more detune, but this felt all wrong - 'in tune' had to be in the centre of the control, so that's where it is.

[Timbre] allows you to select the part of the wavetable that you want to use as the basic sound. You have complete freedom of where you choose within the range. There are 28 basic waveforms, plus ll the overlaps, so there are a lot of different starting points to explore.

[Sweep] allows you to control the amount of movement through the wavetable that the envelope causes. At the 0.00 position (left-most rotation), you get the basic wavetable itself: static and boring), but rotating it to the right causes more and more envelope modulation of the wavetable sweeping, and this gives a nicely animated feel to the sounds. There is a bit of interaction between the Timbre and Sweep controls at the extremes of the ranges (I'm still learning about the wonderfully-named 'pong~' function in Max) and so you may need to do some tweaking to get solid sounds.

[Attack] and [Decay] are a very simple 'contour'-type AD envelope, where there is no sustain, and once triggered, the envelope does its thing with no re-triggering or release complications. Just about as basic as envelopes get, but because the wavetable sweeping is intimately linked to the envelope, the Attack and Decay controls are very much part of the timbral control set, so don't just think they are controlling the amplitude.

[Polyphony] is the final control, and this gives away the roots of this instrument: the ever-popular Pluggo 'Big Ben', possibly one of the most edited M4L examples ever created, and the core of many M4L giveaways from lots of online sources, including, now, me! (It will be interesting to see if any 're-skinned' variants of Waivy turn up in the next few months...) Click on the number and move it up or down to set the polyphony limit, after which note stealing will occur. 8 is okay for most purposes, but long decays might need more to avoid sudden loss of audible notes.

And that's it. Simple but rather effective for some sounds, and it seems to be reasonably light on CPU resource, which is useful in some circumstances! Enjoy.

Waivy is available from MaxForLive.com.


Here is an early version of Waivy in a typical chain: Waivy first, then echo, then reverb...