fix typing and build errors
This commit is contained in:
@ -22,6 +22,8 @@ The sampler is a rather complex beast. There is a lot you can do by manipulating
|
||||
| <ic>cut</ic> | | Set with <ic>0</ic> or <ic>1</ic>. Will cut the sample as soon as another sample is played on the same bus |
|
||||
| <ic>clip</ic> | | Multiply the duration of the sample with the given number |
|
||||
| <ic>pan</ic> | | Stereo position of the audio playback (<ic>0</ic> = left, <ic>1</ic> = right)|
|
||||
| <ic>vib</ic> | | vibrato speed (in hertz)|
|
||||
| <ic>vibmod</ic> | | vibrato depth (from <ic>0</ic> to <ic>n</ic>)|
|
||||
|
||||
Let's apply some of these methods naïvely. We will then break everything using simpler examples.
|
||||
|
||||
@ -127,4 +129,16 @@ beat(0.125)::sound('notes')
|
||||
+ [-12,12].beat()).out()
|
||||
`, true)}
|
||||
|
||||
## Adding vibrato to samples
|
||||
|
||||
You can add vibrato to any sample using <ic>vib</ic> and <ic>vibmod</ic>:
|
||||
|
||||
${makeExample("Adding vibrato to a sample", `
|
||||
|
||||
beat(1)::sound('fhang').vib([1, 2, 4].bar()).vibmod([0.5, 2].beat()).out()
|
||||
`, true)}
|
||||
|
||||
|
||||
`}
|
||||
|
||||
|
||||
|
||||
@ -555,19 +555,12 @@ const completionDatabase: CompletionDatabase = {
|
||||
"Base function to play audio (samples / synths). Alias for <code>sound<code>.",
|
||||
example: "sound('bd').out()",
|
||||
},
|
||||
bpm: {
|
||||
name: "bpm",
|
||||
category: "time",
|
||||
description: "Get or set the current beats per minute.",
|
||||
example: "bpm(135) // set the bpm to 135",
|
||||
},
|
||||
tempo: {
|
||||
name: "tempo",
|
||||
category: "time",
|
||||
description: "Get or set the current beats per minute.",
|
||||
example: "tempo(135) // set the bpm to 135",
|
||||
},
|
||||
|
||||
out: {
|
||||
name: "out",
|
||||
category: "audio",
|
||||
|
||||
@ -140,7 +140,7 @@ flipbar(2)
|
||||
${makeExample(
|
||||
"Using onbar for filler drums",
|
||||
`
|
||||
bpm(150);
|
||||
tempo(150);
|
||||
// Only play on the third and fourth bar of the cycle.
|
||||
onbar([3,4], 4)::beat(.25)::snd('hh').out();
|
||||
// Using JavaScript regular control flow
|
||||
|
||||
@ -22,22 +22,22 @@ Your web browser is capable of sending and receiving MIDI information through th
|
||||
|
||||
|
||||
${makeExample(
|
||||
"Listing MIDI outputs",
|
||||
`
|
||||
"Listing MIDI outputs",
|
||||
`
|
||||
midi_outputs()
|
||||
`,
|
||||
true
|
||||
)}
|
||||
true
|
||||
)}
|
||||
|
||||
- <ic>midi_output(output_name: string)</ic>: enter your desired output to connect to it.
|
||||
|
||||
${makeExample(
|
||||
"Changing MIDI output",
|
||||
`
|
||||
"Changing MIDI output",
|
||||
`
|
||||
midi_output("MIDI Rocket-Trumpet")
|
||||
`,
|
||||
true
|
||||
)}
|
||||
true
|
||||
)}
|
||||
|
||||
That's it! You are now ready to play with MIDI.
|
||||
|
||||
@ -48,69 +48,69 @@ The most basic MIDI event is the note. MIDI notes traditionally take three param
|
||||
- <ic>midi(note: number|object)</ic>: send a MIDI Note. This function is quite bizarre. It can be written and used in many different ways. You can pass form one up to three arguments in different forms.
|
||||
|
||||
${makeExample(
|
||||
"MIDI note using one parameter: note",
|
||||
`
|
||||
"MIDI note using one parameter: note",
|
||||
`
|
||||
// Configure your MIDI first!
|
||||
// => midi_output("MIDI Bus 1")
|
||||
rhythm(.5, 5, 8) :: midi(50).out()
|
||||
`,
|
||||
true
|
||||
)}
|
||||
true
|
||||
)}
|
||||
|
||||
${makeExample(
|
||||
"MIDI note using three parameters: note, velocity, channel",
|
||||
`
|
||||
"MIDI note using three parameters: note, velocity, channel",
|
||||
`
|
||||
// MIDI Note 50, Velocity 50 + LFO, Channel 0
|
||||
rhythm(.5, 5, 8) :: midi(50, 50 + usine(.5) * 20, 0).out()
|
||||
`,
|
||||
false
|
||||
)}
|
||||
false
|
||||
)}
|
||||
|
||||
${makeExample(
|
||||
"MIDI note by passing an object",
|
||||
`
|
||||
"MIDI note by passing an object",
|
||||
`
|
||||
// MIDI Note 50, Velocity 50 + LFO, Channel 0
|
||||
rhythm(.5, 5, 8) :: midi({note: 50, velocity: 50 + usine(.5) * 20, channel: 0}).out()
|
||||
`,
|
||||
false
|
||||
)}
|
||||
false
|
||||
)}
|
||||
|
||||
We can now have some fun and starting playing a small piano piece:
|
||||
|
||||
${makeExample(
|
||||
"Playing some piano",
|
||||
`
|
||||
bpm(80) // Setting a default BPM
|
||||
"Playing some piano",
|
||||
`
|
||||
tempo(80) // Setting a default BPM
|
||||
beat(.5) && midi(36 + [0,12].beat()).sustain(0.02).out()
|
||||
beat(.25) && midi([64, 76].pick()).sustain(0.05).out()
|
||||
beat(.75) && midi([64, 67, 69].beat()).sustain(0.05).out()
|
||||
beat(.25) && midi([64, 67, 69].beat() + 24).sustain(0.05).out()
|
||||
`,
|
||||
true
|
||||
)}
|
||||
true
|
||||
)}
|
||||
|
||||
## Control and Program Changes
|
||||
|
||||
- <ic>control_change({control: number, value: number, channel: number})</ic>: send a MIDI Control Change. This function takes a single object argument to specify the control message (_e.g._ <ic>control_change({control: 1, value: 127, channel: 1})</ic>).
|
||||
|
||||
${makeExample(
|
||||
"Imagine that I am tweaking an hardware synthesizer!",
|
||||
`
|
||||
"Imagine that I am tweaking an hardware synthesizer!",
|
||||
`
|
||||
control_change({control: [24,25].pick(), value: irand(1,120), channel: 1})
|
||||
control_change({control: [30,35].pick(), value: irand(1,120) / 2, channel: 1})
|
||||
`,
|
||||
true
|
||||
)}
|
||||
true
|
||||
)}
|
||||
|
||||
- <ic>program_change(program: number, channel: number)</ic>: send a MIDI Program Change. This function takes two arguments to specify the program and the channel (_e.g._ <ic>program_change(1, 1)</ic>).
|
||||
|
||||
${makeExample(
|
||||
"Crashing old synthesizers: a hobby",
|
||||
`
|
||||
"Crashing old synthesizers: a hobby",
|
||||
`
|
||||
program_change([1,2,3,4,5,6,7,8].pick(), 1)
|
||||
`,
|
||||
true
|
||||
)}
|
||||
true
|
||||
)}
|
||||
|
||||
|
||||
## System Exclusive Messages
|
||||
@ -119,44 +119,44 @@ program_change([1,2,3,4,5,6,7,8].pick(), 1)
|
||||
|
||||
|
||||
${makeExample(
|
||||
"Nobody can say that we don't support Sysex messages!",
|
||||
`
|
||||
"Nobody can say that we don't support Sysex messages!",
|
||||
`
|
||||
sysex(0x90, 0x40, 0x7f)
|
||||
`,
|
||||
true
|
||||
)}
|
||||
true
|
||||
)}
|
||||
|
||||
## Clock
|
||||
|
||||
- <ic>midi_clock()</ic>: send a MIDI Clock message. This function is used to synchronize Topos with other MIDI devices or DAWs.
|
||||
|
||||
${makeExample(
|
||||
"Tic, tac, tic, tac...",
|
||||
`
|
||||
"Tic, tac, tic, tac...",
|
||||
`
|
||||
beat(.25) && midi_clock() // Sending clock to MIDI device from the global buffer
|
||||
`,
|
||||
true
|
||||
)}
|
||||
true
|
||||
)}
|
||||
|
||||
## Using midi with ziffers
|
||||
|
||||
Ziffers offers some shorthands for defining channels within the patterns. See Ziffers for more information.
|
||||
|
||||
${makeExample(
|
||||
"Using midi with ziffers",
|
||||
`
|
||||
"Using midi with ziffers",
|
||||
`
|
||||
z1('0 2 e 5 2 q 4 2').midi().port(2).channel(4).out()
|
||||
`,
|
||||
true
|
||||
)}
|
||||
true
|
||||
)}
|
||||
|
||||
${makeExample(
|
||||
"Setting the channel within the pattern",
|
||||
`
|
||||
"Setting the channel within the pattern",
|
||||
`
|
||||
z1('(0 2 e 5 2):0 (4 2):1').midi().out()
|
||||
`,
|
||||
true
|
||||
)}
|
||||
true
|
||||
)}
|
||||
|
||||
`;
|
||||
};
|
||||
|
||||
@ -113,7 +113,7 @@ ${makeExample(
|
||||
beat(0.5)::sound('notes').n([1,2].dur(1, 2))
|
||||
.room(0.5).size(8).delay(0.125).delayt(1/8)
|
||||
.speed(0.5).ad(0, .125).out()
|
||||
// Kick (3 beats), Snare (1 beat)
|
||||
// Kick (3 beats), Snare (1bpm beat)
|
||||
beat(1)::sound(['kick', 'fsnare'].dur(3, 1))
|
||||
.n([0,3].dur(3, 1)).out()
|
||||
`,
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
export const reference = (): string => {
|
||||
return ``;
|
||||
};
|
||||
@ -1,12 +0,0 @@
|
||||
import { type Editor } from "../main";
|
||||
import { makeExampleFactory } from "../Documentation";
|
||||
|
||||
export const samples = (application: Editor): string => {
|
||||
const makeExample = makeExampleFactory(application);
|
||||
return `
|
||||
# Audio Samples
|
||||
|
||||
Audio samples are dynamically loaded from the web. By default, Topos is providing some samples coming from the classic [Dirt-Samples](https://github.com/tidalcycles/Dirt-Samples) but also from the [Topos-Samples](https://github.com/Bubobubobubobubo/Topos-Samples) repository. You can contribute to the latter if you want to share your samples with the community! For each sample folder, we are indicating how many of them are available in parentheses. The samples starting with <ic>ST</ic> are coming from [a wonderful collection](https://archive.org/details/AmigaSoundtrackerSamplePacksst-xx) of Ultimate Tracker Amiga audio samples released by Karsten Obarski. They are very high-pitched as was usual in the tracker era. Pitch them down using <ic>.speed(0.5)</ic>.
|
||||
|
||||
`;
|
||||
};
|
||||
@ -78,7 +78,7 @@ You can also add some amount of vibrato to the sound using the <ic>vib</ic> and
|
||||
${makeExample(
|
||||
"Different vibrato settings",
|
||||
`
|
||||
bpm(140);
|
||||
tempo(140);
|
||||
beat(1) :: sound('triangle')
|
||||
.freq(400).release(0.2)
|
||||
.vib([1/2, 1, 2, 4].beat())
|
||||
@ -94,7 +94,7 @@ A certain amount of brown noise can be added by using the <ic>.noise</ic> key:
|
||||
${makeExample(
|
||||
"Different vibrato settings",
|
||||
`
|
||||
bpm(140);
|
||||
tempo(140);
|
||||
beat(1) :: sound('triangle')
|
||||
.freq(400).release(0.2)
|
||||
.noise([0.2,0.4,0.5].bar())
|
||||
@ -609,7 +609,7 @@ ${makeExample(
|
||||
${makeExample(
|
||||
"Live coded poetry with array and string chaining",
|
||||
`
|
||||
bpm(70)
|
||||
tempo(70)
|
||||
|
||||
const croissant = [
|
||||
"Volant", "Arc-en-ciel", "Chocolat", "Dansant",
|
||||
|
||||
Reference in New Issue
Block a user