diff --git a/REVIEW_LIVE_CODING_MODE b/REVIEW_LIVE_CODING_MODE deleted file mode 100644 index e69de29..0000000 diff --git a/package.json b/package.json index 6cd4e45..83f5a22 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,7 @@ "@hlolli/codemirror-lang-csound": "1.0.0-alpha10", "@replit/codemirror-vim": "^6.3.0", "codemirror": "^6.0.2", + "fuse.js": "^7.1.0", "lucide-svelte": "^0.545.0", "pako": "^2.1.0" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 27883fe..1c82994 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -56,6 +56,9 @@ importers: codemirror: specifier: ^6.0.2 version: 6.0.2 + fuse.js: + specifier: ^7.1.0 + version: 7.1.0 lucide-svelte: specifier: ^0.545.0 version: 0.545.0(svelte@5.39.13) @@ -447,6 +450,10 @@ packages: engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} os: [darwin] + fuse.js@7.1.0: + resolution: {integrity: sha512-trLf4SzuuUxfusZADLINj+dE8clK1frKdmqiJNb1Es75fmI5oY6X2mxLVUciLLjxqw/xr72Dhy+lER6dGd02FQ==} + engines: {node: '>=10'} + glob@7.2.3: resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} deprecated: Glob versions prior to v9 are no longer supported @@ -1161,6 +1168,8 @@ snapshots: fsevents@2.3.3: optional: true + fuse.js@7.1.0: {} + glob@7.2.3: dependencies: fs.realpath: 1.0.0 diff --git a/scripts/csound-parser/.gitignore b/scripts/csound-parser/.gitignore new file mode 100644 index 0000000..8ca07f3 --- /dev/null +++ b/scripts/csound-parser/.gitignore @@ -0,0 +1,5 @@ +node_modules/ +dist/ +downloaded-opcodes/ +*.log +.DS_Store diff --git a/scripts/csound-parser/README.md b/scripts/csound-parser/README.md new file mode 100644 index 0000000..1e288ab --- /dev/null +++ b/scripts/csound-parser/README.md @@ -0,0 +1,277 @@ +# Csound Manual Parser + +A robust parser that converts the Csound reference manual into TypeScript reference files for use in code editors with hover tooltips and searchable documentation. + +## Features + +- Downloads markdown files directly from GitHub +- Parses 1000+ Csound opcodes +- Extracts structured data (syntax, parameters, examples) +- Generates organized TypeScript files by category +- Creates a main aggregator file with lookup functions +- Handles edge cases and provides detailed error reporting + +## Installation + +```bash +cd scripts/csound-parser +pnpm install +``` + +## Usage + +### Option 1: Download and Parse (Recommended) + +Download fresh markdown files from GitHub and parse them: + +```bash +pnpm run download +``` + +This will: +1. Download all opcode markdown files from the Csound manual repository +2. Parse them into structured data +3. Generate TypeScript reference files in `src/lib/csound-reference/` + +### Option 2: Parse Local Files + +If you already have the Csound manual cloned locally: + +```bash +pnpm run parse -- --input=/path/to/csound-manual/docs/opcodes +``` + +### Custom Output Directory + +```bash +pnpm run parse -- --output=/custom/output/path +``` + +## Output Structure + +The parser generates: + +``` +src/lib/csound-reference/ +├── types.ts # Type definitions +├── csoundReference.ts # Main aggregator +├── signal-generators-basic-oscillators.ts +├── signal-modifiers-standard-filters.ts +├── mathematical-operations-trigonometric-functions.ts +└── ... (100+ category files) +``` + +Each category file contains an array of `CsoundReference` objects: + +```typescript +export const signalGeneratorsBasicOscillators: CsoundReference[] = [ + { + name: 'oscil', + type: 'opcode', + category: 'Signal Generators:Basic Oscillators', + description: 'A simple oscillator without any interpolation.', + syntax: 'ares = oscil(xamp, xcps [, ifn, iphs])\nkres = oscil(kamp, kcps [, ifn, iphs])', + rates: ['a-rate', 'k-rate', 'i-rate'], + parameters: [ + { + name: 'ifn', + description: 'function table number. Requires a wrap-around guard point.', + type: 'initialization' + }, + // ... + ], + seeAlso: ['oscili', 'poscil'] + }, + // ... +] +``` + +## Integration + +Import in your application: + +```typescript +import { + allCsoundReferences, + getCsoundReference, + getCsoundReferencesByCategory +} from './lib/csound-reference/csoundReference' + +// Get a specific opcode +const oscil = getCsoundReference('oscil') + +// Get all oscillators +const oscillators = getCsoundReferencesByCategory('Signal Generators:Basic Oscillators') + +// Search all references +const filtered = allCsoundReferences.filter(ref => + ref.description.includes('filter') +) +``` + +## Use Cases + +### 1. Hover Tooltips in CodeMirror + +Create a tooltip extension similar to the GLSL tooltips: + +```typescript +import { hoverTooltip } from '@codemirror/view' +import { getCsoundReference } from './lib/csound-reference/csoundReference' + +export const csoundTooltip = hoverTooltip((view, pos) => { + const word = getWordAt(view, pos) + if (!word) return null + + const reference = getCsoundReference(word.text) + if (!reference) return null + + return { + pos: word.from, + end: word.to, + above: true, + create() { + const dom = document.createElement('div') + dom.innerHTML = ` +
${reference.syntax}` : ''}
+ `
+ return { dom }
+ }
+ }
+})
+```
+
+### 2. Searchable Help Panel
+
+Create a reference panel with fuzzy search:
+
+```typescript
+import { allCsoundReferences } from './lib/csound-reference/csoundReference'
+import Fuse from 'fuse.js'
+
+const fuse = new Fuse(allCsoundReferences, {
+ keys: ['name', 'description', 'category'],
+ threshold: 0.4
+})
+
+const results = fuse.search('oscillator')
+```
+
+### 3. Autocomplete
+
+Use the reference data for intelligent autocomplete:
+
+```typescript
+import { allCsoundReferences } from './lib/csound-reference/csoundReference'
+
+const completions = allCsoundReferences.map(ref => ({
+ label: ref.name,
+ type: ref.type,
+ info: ref.description,
+ detail: ref.syntax
+}))
+```
+
+## Data Structure
+
+### CsoundReference Interface
+
+```typescript
+interface CsoundReference {
+ name: string // Opcode name (e.g., "oscil")
+ type: 'opcode' | 'keyword' | 'header' | 'constant'
+ category: string // Full category path
+ description: string // Brief description
+ syntax?: string // Syntax examples
+ example?: string // Code example
+ rates?: string[] // ['a-rate', 'k-rate', 'i-rate']
+ parameters?: {
+ name: string
+ description: string
+ type: 'initialization' | 'performance'
+ }[]
+ seeAlso?: string[] // Related opcodes
+}
+```
+
+## Parser Architecture
+
+### 1. Downloader (`downloader.ts`)
+- Fetches markdown files from GitHub API
+- Handles rate limiting and retries
+- Downloads to `downloaded-opcodes/` directory
+
+### 2. Parser (`parser.ts`)
+- Parses markdown frontmatter (id, category)
+- Extracts sections using regex
+- Extracts parameters from initialization/performance sections
+- Handles modern and classic syntax variants
+- Detects rate types (a-rate, k-rate, i-rate)
+
+### 3. Generator (`generator.ts`)
+- Groups opcodes by category
+- Sanitizes category names for file names
+- Generates TypeScript files with proper escaping
+- Creates main aggregator with imports
+- Provides lookup functions
+
+## Troubleshooting
+
+### Download Fails
+
+If the GitHub download fails, manually clone the repository:
+
+```bash
+git clone https://github.com/csound/manual.git
+cd manual
+git checkout develop
+```
+
+Then run the parser with the local path:
+
+```bash
+pnpm run parse -- --input=../manual/docs/opcodes
+```
+
+### Missing Categories
+
+Some opcodes may not have categories defined. The parser will skip these and log warnings.
+
+### Parse Errors
+
+The parser is robust and will continue parsing even if individual files fail. Check the console output for warnings about skipped files.
+
+## Extending the Parser
+
+### Adding New Extraction
+
+To extract additional information from the markdown files, modify `parser.ts`:
+
+```typescript
+extractNewField(content: string): string {
+ const section = this.extractSection(content, 'NewSection')
+ // Parse the section content
+ return parsed
+}
+```
+
+Then add the field to the `CsoundReference` interface in `types.ts`.
+
+### Custom Categories
+
+To reorganize categories, modify the `category` field in the parser or create a mapping function in the generator.
+
+## Performance
+
+- Parsing 1000+ opcodes: ~2-5 seconds
+- Generating TypeScript files: ~1-2 seconds
+- Download from GitHub: ~30-60 seconds (network dependent)
+
+## License
+
+MIT
diff --git a/scripts/csound-parser/debug-params.ts b/scripts/csound-parser/debug-params.ts
new file mode 100644
index 0000000..7907c5b
--- /dev/null
+++ b/scripts/csound-parser/debug-params.ts
@@ -0,0 +1,45 @@
+import * as fs from 'fs';
+import { CsoundManualParser } from './parser';
+
+const parser = new CsoundManualParser();
+const content = fs.readFileSync('downloaded-opcodes/moogladder.md', 'utf-8');
+
+console.log('=== Testing moogladder.md ===\n');
+
+// Test extractSection
+const syntaxSection = parser.extractSection(content, 'Syntax');
+console.log('Syntax section length:', syntaxSection.length);
+console.log('First 200 chars:', syntaxSection.substring(0, 200));
+console.log('\n---\n');
+
+// Look for ### Initialization
+const initMatch = syntaxSection.match(/###\s+Initialization\s*\n([\s\S]*?)(?=\n###|\n##|$)/i);
+console.log('Initialization match:', initMatch ? 'FOUND' : 'NOT FOUND');
+if (initMatch) {
+ console.log('Init section content (first 300 chars):');
+ console.log(initMatch[1].substring(0, 300));
+ console.log('\n---\n');
+
+ // Test the parameter regex
+ const paramRegex = /_([a-zA-Z0-9_,\s/]+)_\s*[-–—]+\s*([^\n]+(?:\n(?!_)[^\n]+)*)/g;
+ const params = Array.from(initMatch[1].matchAll(paramRegex));
+ console.log(`Found ${params.length} parameters`);
+ params.forEach((p, i) => {
+ console.log(` Param ${i + 1}: name="${p[1]}", desc="${p[2].substring(0, 60)}..."`);
+ });
+}
+
+// Test extractParameters directly
+const initParams = parser.extractParameters(content, 'Initialization');
+const perfParams = parser.extractParameters(content, 'Performance');
+
+console.log('\n=== extractParameters results ===');
+console.log(`Initialization params: ${initParams.length}`);
+initParams.forEach(p => {
+ console.log(` - ${p.name}: ${p.description.substring(0, 60)}...`);
+});
+
+console.log(`\nPerformance params: ${perfParams.length}`);
+perfParams.forEach(p => {
+ console.log(` - ${p.name}: ${p.description.substring(0, 60)}...`);
+});
diff --git a/scripts/csound-parser/debug-section.ts b/scripts/csound-parser/debug-section.ts
new file mode 100644
index 0000000..93ea87f
--- /dev/null
+++ b/scripts/csound-parser/debug-section.ts
@@ -0,0 +1,30 @@
+import * as fs from 'fs';
+
+const content = fs.readFileSync('downloaded-opcodes/moogladder.md', 'utf-8');
+
+console.log('Full content length:', content.length);
+console.log('\n=== Testing extractSection regex ===\n');
+
+const regex = /##\s+Syntax\s*\n([\s\S]*?)(?=\n##|$)/i;
+const match = content.match(regex);
+
+if (match) {
+ console.log('Match found!');
+ console.log('Captured content length:', match[1].length);
+ console.log('\nFull captured content:');
+ console.log('---START---');
+ console.log(match[1]);
+ console.log('---END---');
+} else {
+ console.log('No match found');
+}
+
+// Also check what comes after
+const syntaxIndex = content.indexOf('## Syntax');
+const examplesIndex = content.indexOf('## Examples');
+console.log('\n=== Indices ===');
+console.log('## Syntax at:', syntaxIndex);
+console.log('## Examples at:', examplesIndex);
+console.log('Distance:', examplesIndex - syntaxIndex);
+console.log('\nContent between (first 500 chars):');
+console.log(content.substring(syntaxIndex, syntaxIndex + 500));
diff --git a/scripts/csound-parser/downloader.ts b/scripts/csound-parser/downloader.ts
new file mode 100644
index 0000000..39a67c6
--- /dev/null
+++ b/scripts/csound-parser/downloader.ts
@@ -0,0 +1,123 @@
+import * as fs from 'fs';
+import * as path from 'path';
+import * as https from 'https';
+
+interface GitHubFile {
+ name: string;
+ download_url: string;
+ type: string;
+}
+
+export class GitHubDownloader {
+ private apiBase = 'https://api.github.com/repos/csound/manual/contents';
+ private branch = 'develop';
+ private downloadDir: string;
+
+ constructor(downloadDir: string) {
+ this.downloadDir = downloadDir;
+ }
+
+ private async fetchJson{opcode.description}
+ {#if opcode.syntax} +{opcode.syntax}
+ {/if}
+ {#if opcode.rates && opcode.rates.length > 0}
+ Try adjusting your search terms
+morphwaveforms, or select from a set of band-limited tables generated by [GEN30](../scoregens/gen30.md)).', + type: 'performance' + }, + ], + seeAlso: ['Basic Oscillators'] +}, +{ + name: 'osciliktp', + type: 'opcode', + category: 'Signal Generators:Basic Oscillators', + description: 'A linearly interpolated oscillator that allows allows phase modulation.', + syntax: 'ares = osciliktp(kcps, kfn, kphs [, istor])', + example: '--8<-- "examples/osciliktp.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'ares', + description: 'audio-rate ouptut signal.', + type: 'performance' + }, + { + name: 'kcps', + description: 'frequency in Hz. Zero and negative values are allowed. However, the absolute value must be less than [sr](../opcodes/sr.md) (and recommended to be less than _sr_/2).', + type: 'performance' + }, + { + name: 'kfn', + description: 'function table number. Can be varied at control rate (useful to
morphwaveforms, or select from a set of band-limited tables generated by [GEN30](../scoregens/gen30.md)).', + type: 'performance' + }, + { + name: 'kphs', + description: 'phase (k-rate), the expected range is 0 to 1. The absolute value of the difference of the current and previous value of _kphs_ must be less than [ksmps](../opcodes/ksmps.md).', + type: 'performance' + }, + ], + seeAlso: ['Basic Oscillators'] +}, +{ + name: 'oscilikts', + type: 'opcode', + category: 'Signal Generators:Basic Oscillators', + description: 'A linearly interpolated oscillator with sync status that allows changing the table number at k-rate.', + syntax: 'ares = oscilikts(xamp, xcps, kfn, async, kphs [, istor])', + example: '--8<-- "examples/oscilikts.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'xamp', + description: 'amplitude.', + type: 'performance' + }, + { + name: 'xcps', + description: 'frequency in Hz. Zero and negative values are allowed. However, the absolute value must be less than [sr](../opcodes/sr.md) (and recommended to be less than _sr_/2).', + type: 'performance' + }, + { + name: 'kfn', + description: 'function table number. Can be varied at control rate (useful to
morphwaveforms, or select from a set of band-limited tables generated by [GEN30](../scoregens/gen30.md)).', + type: 'performance' + }, + { + name: 'async', + description: 'any positive value resets the phase of _oscilikts_ to _kphs_. Zero or negative values have no effect.', + type: 'performance' + }, + { + name: 'kphs', + description: 'sets the phase, initially and when it is re-initialized with async.', + type: 'performance' + }, + ], + seeAlso: ['Basic Oscillators'] +}, +{ + name: 'osciln', + type: 'opcode', + category: 'Signal Generators:Basic Oscillators', + description: 'Accesses table values at a user-defined frequency.', + syntax: 'ares = osciln(kamp, ifrq, ifn, itimes)', + example: '--8<-- "examples/osciln.csd"', + rates: ['a-rate', 'k-rate', 'i-rate'], + parameters: [ + { + name: 'ifrq', + description: 'rate and number of times through the stored table.', + type: 'initialization' + }, + { + name: 'itimes', + description: 'rate and number of times through the stored table.', + type: 'initialization' + }, + { + name: 'ifn', + description: 'function table number.', + type: 'initialization' + }, + { + name: 'kamp', + description: 'amplitude factor', + type: 'performance' + }, + ], + seeAlso: ['Table Access'] +}, +{ + name: 'oscils', + type: 'opcode', + category: 'Signal Generators:Basic Oscillators', + description: 'A simple, fast sine oscillator.', + syntax: 'ares = oscils(iamp, icps, iphs [, iflg])', + example: '--8<-- "examples/oscils.csd"', + rates: ['a-rate', 'i-rate'], + parameters: [ + { + name: 'iamp', + description: 'output amplitude.', + type: 'initialization' + }, + { + name: 'icps', + description: 'frequency in Hz (may be zero or negative, however the absolute value must be less than _sr_/2).', + type: 'initialization' + }, + { + name: 'iphs', + description: 'start phase between 0 and 1.', + type: 'initialization' + }, + { + name: 'iflg', + description: 'sum of the following values:', + type: 'initialization' + }, + { + name: 'ares', + description: 'audio output', + type: 'performance' + }, + ], + seeAlso: ['Basic Oscillators'] +}, +{ + name: 'oscilx', + type: 'opcode', + category: 'Signal Generators:Basic Oscillators', + description: 'Same as the [osciln](../opcodes/osciln.md) opcode.', +}, +{ + name: 'poscil', + type: 'opcode', + category: 'Signal Generators:Basic Oscillators', + description: 'High precision oscillator.', + syntax: 'ares = poscil(aamp, acps [, ifn, iphs])\n ares = poscil(aamp, kcps [, ifn, iphs])\n ares = poscil(kamp, acps [, ifn, iphs])\n ares = poscil(kamp, kcps [, ifn, iphs])\n ires = poscil(kamp, kcps [, ifn, iphs])\n kres = poscil(kamp, kcps [, ifn, iphs])', + example: '--8<-- "examples/poscil-modern.csd"', + rates: ['a-rate', 'k-rate', 'i-rate'], + parameters: [ + { + name: 'ifn', + description: '(optional) function table number. This defaults to -1 which indicates a sinewave.', + type: 'initialization' + }, + { + name: 'ares', + description: 'output signal', + type: 'performance' + }, + { + name: 'kamp', + description: 'the amplitude of the output signal.', + type: 'performance' + }, + { + name: 'aamp', + description: 'the amplitude of the output signal.', + type: 'performance' + }, + { + name: 'kcps', + description: 'the frequency of the output signal in cycles per second.', + type: 'performance' + }, + { + name: 'acps', + description: 'the frequency of the output signal in cycles per second.', + type: 'performance' + }, + ], + seeAlso: ['Basic Oscillators'] +}, +{ + name: 'poscil3', + type: 'opcode', + category: 'Signal Generators:Basic Oscillators', + description: 'High precision oscillator with cubic interpolation.', + syntax: 'ares = poscil3(aamp, acps [, ifn, iphs])\n ares = poscil3(aamp, kcps [, ifn, iphs])\n ares = poscil3(kamp, acps [, ifn, iphs])\n ares = poscil3(kamp, kcps [, ifn, iphs])\n ires = poscil3(kamp, kcps [, ifn, iphs])\n kres = poscil3(kamp, kcps [, ifn, iphs])', + example: '--8<-- "examples/poscil3.csd"', + rates: ['a-rate', 'k-rate', 'i-rate'], + parameters: [ + { + name: 'ifn', + description: '(optional) function table number. This defaults to -1 which indicates a sinewave.', + type: 'initialization' + }, + { + name: 'ares', + description: 'output signal', + type: 'performance' + }, + { + name: 'kamp', + description: 'the amplitude of the output signal.', + type: 'performance' + }, + { + name: 'aamp', + description: 'the amplitude of the output signal.', + type: 'performance' + }, + { + name: 'kcps', + description: 'the frequency of the output signal in cycles per second.', + type: 'performance' + }, + { + name: 'acps', + description: 'the frequency of the output signal in cycles per second.', + type: 'performance' + }, + ], + seeAlso: ['Basic Oscillators'] +}, +] diff --git a/src/lib/csound-reference/signal-generators-dynamic-spectrum-oscillators.ts b/src/lib/csound-reference/signal-generators-dynamic-spectrum-oscillators.ts new file mode 100644 index 0000000..5401788 --- /dev/null +++ b/src/lib/csound-reference/signal-generators-dynamic-spectrum-oscillators.ts @@ -0,0 +1,137 @@ +import type { CsoundReference } from './types' + +// Signal Generators:Dynamic Spectrum Oscillators +export const signalGeneratorsDynamicSpectrumOscillators: CsoundReference[] = [ +{ + name: 'buzz', + type: 'opcode', + category: 'Signal Generators:Dynamic Spectrum Oscillators', + description: 'Output is a set of harmonically related sine partials.', + syntax: 'ares = buzz(xamp, xcps, knh, ifn [, iphs])', + example: '--8<-- "examples/buzz-modern.csd"', + rates: ['a-rate', 'i-rate'], + parameters: [ + { + name: 'ifn', + description: 'table number of a stored function containing a sine wave. A large table of at least 8192 points is recommended.', + type: 'initialization' + }, + { + name: 'xamp', + description: 'amplitude', + type: 'performance' + }, + { + name: 'xcps', + description: 'frequency in cycles per second', + type: 'performance' + }, + { + name: 'knh', + description: 'total number of harmonics requested. New in Csound version 3.57, _knh_ defaults to one. If _knh_ is negative, the absolute value is used.', + type: 'performance' + }, + ], + seeAlso: ['Dynamic Spectrum Oscillators'] +}, +{ + name: 'gbuzz', + type: 'opcode', + category: 'Signal Generators:Dynamic Spectrum Oscillators', + description: 'Output is a set of harmonically related cosine partials.', + syntax: 'ares = gbuzz(xamp, xcps, knh, klh, kmul, ifn [, iphs])', + example: '--8<-- "examples/gbuzz.csd"', + rates: ['a-rate', 'i-rate'], + parameters: [ + { + name: 'ifn', + description: 'table number of a stored function containing a cosine wave. A large table of at least 8192 points is recommended.', + type: 'initialization' + }, + { + name: 'knh', + description: 'total number of harmonics requested. If _knh_ is negative, the absolute value is used. If _knh_ is zero, a value of 1 is used.', + type: 'performance' + }, + { + name: 'klh', + description: 'lowest harmonic present. Can be positive, zero or negative. In _gbuzz_ the set of partials can begin at any partial number and proceeds upwards; if _klh_ is negative, all partials below zero will reflect as positive partials without phase change (since cosine is an even function), and will add constructively to any positive partials in the set.', + type: 'performance' + }, + { + name: 'kmul', + description: 'specifies the multiplier in the series of amplitude coefficients. This is a power series: if the _klh_th partial has a strength coefficient of A, the (_klh_ + n)th partial will have a coefficient of A * (_kmul_ ** n), i.e. strength values trace an exponential curve. _kmul_ may be positive, zero or negative, and is not restricted to integers.', + type: 'performance' + }, + ], + seeAlso: ['Dynamic Spectrum Oscillators'] +}, +{ + name: 'mpulse', + type: 'opcode', + category: 'Signal Generators:Dynamic Spectrum Oscillators', + description: 'Generates a set of impulses.', + syntax: 'ares = mpulse(kamp, kintvl [, ioffset])', + example: '--8<-- "examples/mpulse.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'kamp', + description: 'amplitude of the impulses generated', + type: 'performance' + }, + { + name: 'kintvl', + description: 'Interval of time in seconds (or samples if _kintvl_ is negative) to the next pulse.', + type: 'performance' + }, + ], + seeAlso: ['Dynamic Spectrum Oscillators'] +}, +{ + name: 'squinewave', + type: 'opcode', + category: 'Signal Generators:Dynamic Spectrum Oscillators', + description: 'A mostly bandlimited shape-shifting square-pulse-saw-sinewave oscillator with hardsync.', + syntax: 'aout [, asyncout] = squinewave(acps, aClip, aSkew, asyncin [, iMinSweep] [, iphase])\n aout [, asyncout] = squinewave(acps, aClip, aSkew [, ksyncin] [, iMinSweep] [, iphase])', + example: '--8<-- "examples/squinewave.csd"', + parameters: [ + { + name: 'aout', + description: 'audio output, normalized +/-1', + type: 'performance' + }, + { + name: 'asyncout', + description: '(optional) - Sync signal: 1 at endpoint of each cycle, else 0.', + type: 'performance' + }, + { + name: 'acps', + description: 'frequency. Range 0-anything; negative freq not implemented.', + type: 'performance' + }, + { + name: 'aClip', + description: '"squareness" of waveform shape. Range 0-1. Clip 0 is sinewave (or saw), clip 1 is squarewave (or pulse).', + type: 'performance' + }, + { + name: 'aSkew', + description: 'symmetry of waveform shape. Range -1 to +1. Skew = 0 is symmetric like sine or square. Skew +1 or -1 is right/left-facing saw or pulse.', + type: 'performance' + }, + { + name: 'asyncin', + description: '(optional, ignored if not a-rate) - when >= 1, waveform quickly sweeps to phase 0. Sweep length is 0 to about 1.5*iMinSweep samples depending on current phase.', + type: 'performance' + }, + { + name: 'ksyncin', + description: '(optional, ignored if not a-rate) - when >= 1, waveform quickly sweeps to phase 0. Sweep length is 0 to about 1.5*iMinSweep samples depending on current phase.', + type: 'performance' + }, + ], + seeAlso: ['Dynamic Spectrum Oscillators'] +}, +] diff --git a/src/lib/csound-reference/signal-generators-envelope-generators.ts b/src/lib/csound-reference/signal-generators-envelope-generators.ts new file mode 100644 index 0000000..44524a8 --- /dev/null +++ b/src/lib/csound-reference/signal-generators-envelope-generators.ts @@ -0,0 +1,341 @@ +import type { CsoundReference } from './types' + +// Signal Generators:Envelope Generators +export const signalGeneratorsEnvelopeGenerators: CsoundReference[] = [ +{ + name: 'adsr', + type: 'opcode', + category: 'Signal Generators:Envelope Generators', + description: 'Calculates the classical ADSR envelope using linear segments.', + syntax: 'ares = adsr(iatt, idec, islev, irel [, idel])\n kres = adsr(iatt, idec, islev, irel [, idel])', + example: '--8<-- "examples/adsr-modern.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'iatt', + description: 'duration of attack phase', + type: 'initialization' + }, + { + name: 'idec', + description: 'duration of decay', + type: 'initialization' + }, + { + name: 'islev', + description: 'level for sustain phase', + type: 'initialization' + }, + { + name: 'irel', + description: 'duration of release phase', + type: 'initialization' + }, + { + name: 'idel', + description: 'period of zero before the envelope starts', + type: 'initialization' + }, + ], + seeAlso: ['Envelope Generators'] +}, +{ + name: 'envlpx', + type: 'opcode', + category: 'Signal Generators:Envelope Generators', + description: 'Applies an envelope consisting of 3 segments.', + syntax: 'ares = envlpx(xamp, irise, idur, idec, ifn, iatss, iatdec [, ixmod])\n kres = envlpx(kamp, irise, idur, idec, ifn, iatss, iatdec [, ixmod])', + example: '--8<-- "examples/envlpx.csd"', + rates: ['a-rate', 'k-rate', 'i-rate'], + parameters: [ + { + name: 'irise', + description: 'rise time in seconds. A zero or negative value signifies no rise modification.', + type: 'initialization' + }, + { + name: 'idur', + description: 'overall duration in seconds. A zero or negative value will cause initialization to be skipped.', + type: 'initialization' + }, + { + name: 'idec', + description: 'decay time in seconds. Zero means no decay. An _idec_ > _idur_ will cause a truncated decay.', + type: 'initialization' + }, + { + name: 'ifn', + description: 'function table number of stored rise shape with extended guard point.', + type: 'initialization' + }, + { + name: 'iatss', + description: 'the ratio of the final value of the pseudo-steady-state period to the value at its beginning (i.e the attenuation from the end of the rise segment to the start of the decay). A ratio greater than 1 causes an exponential growth and a ratio less than 1 creates an exponential decay. A ratio of 1 will maintain a true steady state at the last rise value. Note that this attenuation is not at a fixed rate (as in a piano), but is sensitive to a note\'s duration. However, if _iatss_ is negative (or if steady state < 4 k-periods) a fixed attenuation rate of _abs_(_iatss_) per second will be used. 0 is illegal.', + type: 'initialization' + }, + { + name: 'iatdec', + description: 'the ratio of the value at the end of the decay period to the value at its beginning (the end of the steady-state segment) . It must be positive and is normally of the order of .01. A large or excessively small value is apt to produce a cutoff which is audible. A zero or negative value is illegal.', + type: 'initialization' + }, + { + name: 'kamp', + description: 'input amplitude signal.', + type: 'performance' + }, + { + name: 'xamp', + description: 'input amplitude signal.', + type: 'performance' + }, + ], + seeAlso: ['Envelope Generators'] +}, +{ + name: 'envlpxr', + type: 'opcode', + category: 'Signal Generators:Envelope Generators', + description: 'The _envlpx_ opcode with a final release segment.', + syntax: 'ares = envlpxr(xamp, irise, idec, ifn, iatss, iatdec [, ixmod] [,irind])\n kres = envlpxr(kamp, irise, idec, ifn, iatss, iatdec [, ixmod] [,irind])', + example: '--8<-- "examples/envlpxr.csd"', + rates: ['a-rate', 'k-rate', 'i-rate'], + parameters: [ + { + name: 'irise', + description: 'rise time in seconds. A zero or negative value signifies no rise modification.', + type: 'initialization' + }, + { + name: 'idec', + description: 'decay time in seconds. Zero means no decay.', + type: 'initialization' + }, + { + name: 'ifn', + description: 'function table number of stored rise shape with extended guard point.', + type: 'initialization' + }, + { + name: 'iatss', + description: 'attenuation factor determining the exponential change in value over time during the pseudo steady state period between the end of the rise and the beginning of the decay (at the note\'s release). A factor greater than 1 causes an exponential growth and a factor less than 1 creates an exponential decay. A factor of 1 will maintain a true steady state at the last rise value; 0 is illegal. The value will change by _abs_(_iatss_) per second.', + type: 'initialization' + }, + { + name: 'iatdec', + description: 'the ratio of the value at the end of the decay period to the value at its beginning (when the note is released). It must be positive and is normally of the order of .01. A large or excessively small value is apt to produce a cutoff which is audible. A zero or negative value is illegal.', + type: 'initialization' + }, + { + name: 'kamp', + description: 'input amplitude signal.', + type: 'performance' + }, + { + name: 'xamp', + description: 'input amplitude signal.', + type: 'performance' + }, + ], + seeAlso: ['Envelope Generators'] +}, +{ + name: 'gtadsr', + type: 'opcode', + category: 'Signal Generators:Envelope Generators', + description: 'A gated linear attack-decay-sustain with exponential release.', + syntax: 'ares = gtadsr(asig, katt, kdec, ksus, krel, kgate)\n xres = gtadsr(kamp, katt, kdec, ksus, krel, kgate)', + example: '--8<-- "examples/gtadsr.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'x', + description: 'output signal (k or a-rate)', + type: 'performance' + }, + { + name: 'ares', + description: 'output signal (k or a-rate)', + type: 'performance' + }, + { + name: 'asig', + description: 'input signal (envelope as an amplitude processor)', + type: 'performance' + }, + { + name: 'kamp', + description: 'maximum amplitude (envelope as a signal generator)', + type: 'performance' + }, + { + name: 'katt', + description: 'duration of attack phase', + type: 'performance' + }, + { + name: 'kdec', + description: 'duration of decay', + type: 'performance' + }, + { + name: 'ksus', + description: 'level for sustain phase (in the range 0 - 1)', + type: 'performance' + }, + { + name: 'krel', + description: 'duration of release phase', + type: 'performance' + }, + { + name: 'kgate', + description: 'gate signal (0 = low, > 0 high).', + type: 'performance' + }, + ], + seeAlso: ['Envelope Generators'] +}, +{ + name: 'linen', + type: 'opcode', + category: 'Signal Generators:Envelope Generators', + description: 'Applies a straight line rise and decay pattern to an input amp signal.', + syntax: 'ares = linen(xamp, irise, idur, idec)\n kres = linen(kamp, irise, idur, idec)', + example: '--8<-- "examples/linen.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'irise', + description: 'rise time in seconds. A zero or negative value signifies no rise modification.', + type: 'initialization' + }, + { + name: 'idur', + description: 'overall duration in seconds. A zero or negative value will cause initialization to be skipped.', + type: 'initialization' + }, + { + name: 'idec', + description: 'decay time in seconds. Zero means no decay. An _idec_ > _idur_ will cause a truncated decay.', + type: 'initialization' + }, + { + name: 'kamp', + description: 'input amplitude signal.', + type: 'performance' + }, + { + name: 'xamp', + description: 'input amplitude signal.', + type: 'performance' + }, + ], + seeAlso: ['Envelope Generators'] +}, +{ + name: 'linenr', + type: 'opcode', + category: 'Signal Generators:Envelope Generators', + description: 'The _linen_ opcode extended with a final release segment.', + syntax: 'ares = linenr(xamp, irise, idec, iatdec)\n kres = linenr(kamp, irise, idec, iatdec)', + example: '--8<-- "examples/linenr.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'irise', + description: 'rise time in seconds. A zero or negative value signifies no rise modification.', + type: 'initialization' + }, + { + name: 'idec', + description: 'decay time in seconds. Zero means no decay.', + type: 'initialization' + }, + { + name: 'iatdec', + description: 'attenuation factor by which the closing steady state value is reduced exponentially over the decay period. This value must be positive and is normally of the order of .01. A large or excessively small value is apt to produce a cutoff which is audible. A zero or negative value is illegal.', + type: 'initialization' + }, + { + name: 'kamp', + description: 'input amplitude signal.', + type: 'performance' + }, + { + name: 'xamp', + description: 'input amplitude signal.', + type: 'performance' + }, + ], + seeAlso: ['Envelope Generators'] +}, +{ + name: 'madsr', + type: 'opcode', + category: 'Signal Generators:Envelope Generators', + description: 'Calculates the classical ADSR envelope using the [linsegr](../opcodes/linsegr.md) mechanism.', + syntax: 'ares = madsr(iatt, idec, islev, irel [, idel] [, ireltim])\n kres = madsr(iatt, idec, islev, irel [, idel] [, ireltim])', + example: '--8<-- "examples/madsr.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'iatt', + description: 'duration of attack phase', + type: 'initialization' + }, + { + name: 'idec', + description: 'duration of decay', + type: 'initialization' + }, + { + name: 'islev', + description: 'level for sustain phase', + type: 'initialization' + }, + { + name: 'irel', + description: 'duration of release phase.', + type: 'initialization' + }, + { + name: 'idel', + description: 'period of zero before the envelope starts', + type: 'initialization' + }, + ], + seeAlso: ['Envelope Generators'] +}, +{ + name: 'mxadsr', + type: 'opcode', + category: 'Signal Generators:Envelope Generators', + description: 'Calculates the classical ADSR envelope using the [expsegr](../opcodes/expsegr.md) mechanism.', + syntax: 'ares = mxadsr(iatt, idec, islev, irel [, idel] [, ireltim])\n kres = mxadsr(iatt, idec, islev, irel [, idel] [, ireltim])', + example: '--8<-- "examples/mxadsr.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'iatt', + description: 'duration of attack phase', + type: 'initialization' + }, + { + name: 'idec', + description: 'duration of decay', + type: 'initialization' + }, + { + name: 'islev', + description: 'level for sustain phase', + type: 'initialization' + }, + { + name: 'irel', + description: 'duration of release phase', + type: 'initialization' + }, + ], + seeAlso: ['Envelope Generators'] +}, +] diff --git a/src/lib/csound-reference/signal-generators-fm-synthesis.ts b/src/lib/csound-reference/signal-generators-fm-synthesis.ts new file mode 100644 index 0000000..7869318 --- /dev/null +++ b/src/lib/csound-reference/signal-generators-fm-synthesis.ts @@ -0,0 +1,510 @@ +import type { CsoundReference } from './types' + +// Signal Generators:FM Synthesis +export const signalGeneratorsFmSynthesis: CsoundReference[] = [ +{ + name: 'crossfm', + type: 'opcode', + category: 'Signal Generators:FM Synthesis', + description: 'Two oscillators, mutually frequency and/or phase modulated by each other.', + syntax: 'a1, a2 = crossfm(xfrq1, xfrq2, xndx1, xndx2, kcps, ifn1, ifn2 [, iphs1] [, iphs2])\n a1, a2 = crossfmi(xfrq1, xfrq2, xndx1, xndx2, kcps, ifn1, ifn2 [, iphs1] [, iphs2])\n a1, a2 = crosspm(xfrq1, xfrq2, xndx1, xndx2, kcps, ifn1, ifn2 [, iphs1] [, iphs2])\n a1, a2 = crosspmi(xfrq1, xfrq2, xndx1, xndx2, kcps, ifn1, ifn2 [, iphs1] [, iphs2])\n a1, a2 = crossfmpm(xfrq1, xfrq2, xndx1, xndx2, kcps, ifn1, ifn2 [, iphs1] [, iphs2])\n a1, a2 = crossfmpmi(xfrq1, xfrq2, xndx1, xndx2, kcps, ifn1, ifn2 [, iphs1] [, iphs2])', + example: '--8<-- "examples/crossfm.csd"', + rates: ['k-rate'], + parameters: [ + { + name: 'ifn1', + description: 'function table number for oscillator #1. Requires a wrap-around guard point.', + type: 'initialization' + }, + { + name: 'ifn2', + description: 'function table number for oscillator #2. Requires a wrap-around guard point.', + type: 'initialization' + }, + { + name: 'xfrq1', + description: 'a factor that, when multipled by the _kcps_ parameter, gives the frequency of oscillator #1.', + type: 'performance' + }, + { + name: 'xfrq2', + description: 'a factor that, when multipled by the _kcps_ parameter, gives the frequency of oscillator #2.', + type: 'performance' + }, + { + name: 'xndx1', + description: 'the index of the modulation of oscillator #2 by oscillator #1.', + type: 'performance' + }, + { + name: 'xndx2', + description: 'the index of the modulation of oscillator #1 by oscillator #2.', + type: 'performance' + }, + { + name: 'kcps', + description: 'a common denominator, in cycles per second, for both oscillators frequencies.', + type: 'performance' + }, + ], + seeAlso: ['FM Synthesis', 'http://en.wikipedia.org/wiki/Frequency_modulation_synthesis', 'http://www.csoundjournal.com/issue12/crossfm.html'] +}, +{ + name: 'fmb3', + type: 'opcode', + category: 'Signal Generators:FM Synthesis', + description: 'Uses FM synthesis to create a Hammond B3 organ sound.', + syntax: 'ares = fmb3(kamp, kfreq, kc1, kc2, kvdepth, kvrate[, ifn1, ifn2, ifn3, \\\n ifn4, ivfn])', + example: '--8<-- "examples/fmb3.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'ifn1', + description: 'sine wave * _ifn2_ -- sine wave * _ifn3_ -- sine wave * _ifn4_ -- sine wave', + type: 'initialization' + }, + { + name: 'kamp', + description: 'Amplitude of note.', + type: 'performance' + }, + { + name: 'kfreq', + description: 'Frequency of note played.', + type: 'performance' + }, + { + name: 'kc1', + description: 'Controls for the synthesizer:', + type: 'performance' + }, + { + name: 'kc2', + description: 'Controls for the synthesizer:', + type: 'performance' + }, + { + name: 'kc1', + description: 'Total mod index * _kc2_ -- Crossfade of two modulators * _Algorithm_ -- 4', + type: 'performance' + }, + { + name: 'kvdepth', + description: 'Vibrator depth', + type: 'performance' + }, + { + name: 'kvrate', + description: 'Vibrator rate', + type: 'performance' + }, + ], + seeAlso: ['FM Synthesis', 'http://en.wikipedia.org/wiki/Frequency_modulation_synthesis'] +}, +{ + name: 'fmbell', + type: 'opcode', + category: 'Signal Generators:FM Synthesis', + description: 'Uses FM synthesis to create a tublar bell sound.', + syntax: 'ares = fmbell(kamp, kfreq, kc1, kc2, kvdepth, kvrate[, ifn1, ifn2, ifn3, \\\n ifn4, ivfn, isus])', + example: '--8<-- "examples/fmbell.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'ifn1', + description: 'sine wave * _ifn2_ -- sine wave * _ifn3_ -- sine wave * _ifn4_ -- sine wave', + type: 'initialization' + }, + { + name: 'kamp', + description: 'Amplitude of note.', + type: 'performance' + }, + { + name: 'kfreq', + description: 'Frequency of note played.', + type: 'performance' + }, + { + name: 'kc1', + description: 'Controls for the synthesizer:', + type: 'performance' + }, + { + name: 'kc2', + description: 'Controls for the synthesizer:', + type: 'performance' + }, + { + name: 'kc1', + description: 'Mod index 1 * _kc2_ -- Crossfade of two outputs * _Algorithm_ -- 5', + type: 'performance' + }, + { + name: 'kvdepth', + description: 'Vibrator depth', + type: 'performance' + }, + { + name: 'kvrate', + description: 'Vibrator rate', + type: 'performance' + }, + ], + seeAlso: ['FM Synthesis', 'http://en.wikipedia.org/wiki/Frequency_modulation_synthesis'] +}, +{ + name: 'fmmetal', + type: 'opcode', + category: 'Signal Generators:FM Synthesis', + description: 'Uses FM synthesis to create a “Heavy Metal” sound.', + syntax: 'ares = fmmetal(kamp, kfreq, kc1, kc2, kvdepth, kvrate, ifn1, ifn2, ifn3, \\\n ifn4, ivfn)', + example: '--8<-- "examples/fmmetal.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'ifn1', + description: 'sine wave * _ifn2_ -- [twopeaks.aiff](../examples/twopeaks.aiff) * _ifn3_ -- [twopeaks.aiff](../examples/twopeaks.aiff) * _ifn4_ -- sine wave', + type: 'initialization' + }, + { + name: 'kamp', + description: 'Amplitude of note.', + type: 'performance' + }, + { + name: 'kfreq', + description: 'Frequency of note played.', + type: 'performance' + }, + { + name: 'kc1', + description: 'Controls for the synthesizer:', + type: 'performance' + }, + { + name: 'kc2', + description: 'Controls for the synthesizer:', + type: 'performance' + }, + { + name: 'kc1', + description: 'Total mod index * _kc2_ -- Crossfade of two modulators * _Algorithm_ -- 3', + type: 'performance' + }, + { + name: 'kvdepth', + description: 'Vibrator depth', + type: 'performance' + }, + { + name: 'kvrate', + description: 'Vibrator rate', + type: 'performance' + }, + ], + seeAlso: ['FM Synthesis', 'http://en.wikipedia.org/wiki/Frequency_modulation_synthesis'] +}, +{ + name: 'fmpercfl', + type: 'opcode', + category: 'Signal Generators:FM Synthesis', + description: 'Uses FM synthesis to create a percussive flute sound.', + syntax: 'ares = fmpercfl(kamp, kfreq, kc1, kc2, kvdepth, kvrate[, ifn1, ifn2, \\\n ifn3, ifn4, ivfn])', + example: '--8<-- "examples/fmpercfl.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'ifn1', + description: 'sine wave * _ifn2_ -- sine wave * _ifn3_ -- sine wave * _ifn4_ -- sine wave', + type: 'initialization' + }, + { + name: 'kamp', + description: 'Amplitude of note.', + type: 'performance' + }, + { + name: 'kfreq', + description: 'Frequency of note played.', + type: 'performance' + }, + { + name: 'kc1', + description: 'Controls for the synthesizer:', + type: 'performance' + }, + { + name: 'kc2', + description: 'Controls for the synthesizer:', + type: 'performance' + }, + { + name: 'kc1', + description: 'Total mod index * _kc2_ -- Crossfade of two modulators * _Algorithm_ -- 4', + type: 'performance' + }, + { + name: 'kvdepth', + description: 'Vibrator depth', + type: 'performance' + }, + { + name: 'kvrate', + description: 'Vibrator rate', + type: 'performance' + }, + ], + seeAlso: ['FM Synthesis', 'http://en.wikipedia.org/wiki/Frequency_modulation_synthesis'] +}, +{ + name: 'fmrhode', + type: 'opcode', + category: 'Signal Generators:FM Synthesis', + description: 'Uses FM synthesis to create a Fender Rhodes electric piano sound.', + syntax: 'ares = fmrhode(kamp, kfreq, kc1, kc2, kvdepth, kvrate, ifn1, ifn2, \\\n ifn3, ifn4, ivfn)', + example: '--8<-- "examples/fmrhode.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'ifn1', + description: 'sine wave * _ifn2_ -- sine wave * _ifn3_ -- sine wave * _ifn4_ -- [fwavblnk.aiff](../examples/fwavblnk.aiff)', + type: 'initialization' + }, + { + name: 'kamp', + description: 'Amplitude of note.', + type: 'performance' + }, + { + name: 'kfreq', + description: 'Frequency of note played.', + type: 'performance' + }, + { + name: 'kc1', + description: 'Controls for the synthesizer:', + type: 'performance' + }, + { + name: 'kc2', + description: 'Controls for the synthesizer:', + type: 'performance' + }, + { + name: 'kc1', + description: 'Mod index 1 * _kc2_ -- Crossfade of two outputs * _Algorithm_ -- 5', + type: 'performance' + }, + { + name: 'kvdepth', + description: 'Vibrator depth', + type: 'performance' + }, + { + name: 'kvrate', + description: 'Vibrator rate', + type: 'performance' + }, + ], + seeAlso: ['FM Synthesis', 'http://en.wikipedia.org/wiki/Frequency_modulation_synthesis'] +}, +{ + name: 'fmvoice', + type: 'opcode', + category: 'Signal Generators:FM Synthesis', + description: 'FM Singing Voice Synthesis.', + syntax: 'ares = fmvoice(kamp, kfreq, kvowel, ktilt, kvibamt, kvibrate[, ifn1, \\\n ifn2, ifn3, ifn4, ivibfn])', + example: '--8<-- "examples/fmvoice.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'ifn1', + description: 'Tables, usually of sinewaves. The last is for vibrato', + type: 'initialization' + }, + { + name: 'ifn2', + description: 'Tables, usually of sinewaves. The last is for vibrato', + type: 'initialization' + }, + { + name: 'ifn3', + description: 'Tables, usually of sinewaves. The last is for vibrato', + type: 'initialization' + }, + { + name: 'ifn3', + description: 'Tables, usually of sinewaves. The last is for vibrato', + type: 'initialization' + }, + { + name: 'ivibfn', + description: 'Tables, usually of sinewaves. The last is for vibrato', + type: 'initialization' + }, + { + name: 'kamp', + description: 'Amplitude of note.', + type: 'performance' + }, + { + name: 'kfreq', + description: 'Frequency of note played.', + type: 'performance' + }, + { + name: 'kvowel', + description: 'the vowel being sung, in the range 0-64', + type: 'performance' + }, + { + name: 'ktilt', + description: 'the spectral tilt of the sound in the range 0 to 99', + type: 'performance' + }, + { + name: 'kvibamt', + description: 'Depth of vibrato', + type: 'performance' + }, + { + name: 'kvibrate', + description: 'Rate of vibrato', + type: 'performance' + }, + ], + seeAlso: ['FM Synthesis', 'http://en.wikipedia.org/wiki/Frequency_modulation_synthesis'] +}, +{ + name: 'fmwurlie', + type: 'opcode', + category: 'Signal Generators:FM Synthesis', + description: 'Uses FM synthesis to create a Wurlitzer electric piano sound.', + syntax: 'ares = fmwurlie(kamp, kfreq, kc1, kc2, kvdepth, kvrate, ifn1, ifn2, ifn3, \\\n ifn4, ivfn)', + example: '--8<-- "examples/fmwurlie.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'ifn1', + description: 'sine wave * _ifn2_ -- sine wave * _ifn3_ -- sine wave * _ifn4_ -- [fwavblnk.aiff](../examples/fwavblnk.aiff)', + type: 'initialization' + }, + { + name: 'kamp', + description: 'Amplitude of note.', + type: 'performance' + }, + { + name: 'kfreq', + description: 'Frequency of note played.', + type: 'performance' + }, + { + name: 'kc1', + description: 'Controls for the synthesizer:', + type: 'performance' + }, + { + name: 'kc2', + description: 'Controls for the synthesizer:', + type: 'performance' + }, + { + name: 'kc1', + description: 'Mod index 1 * _kc2_ -- Crossfade of two outputs * _Algorithm_ -- 5', + type: 'performance' + }, + { + name: 'kvdepth', + description: 'Vibrator depth', + type: 'performance' + }, + { + name: 'kvrate', + description: 'Vibrator rate', + type: 'performance' + }, + ], + seeAlso: ['FM Synthesis', 'http://en.wikipedia.org/wiki/Frequency_modulation_synthesis'] +}, +{ + name: 'foscil', + type: 'opcode', + category: 'Signal Generators:FM Synthesis', + description: 'A basic frequency modulated oscillator.', + syntax: 'ares = foscil(xamp, kcps, xcar, xmod, kndx [, ifn , iphs])', + example: '--8<-- "examples/foscil.csd"', + rates: ['a-rate', 'k-rate', 'i-rate'], + parameters: [ + { + name: 'xamp', + description: 'the amplitude of the output signal.', + type: 'performance' + }, + { + name: 'kcps', + description: 'a common denominator, in cycles per second, for the carrier and modulating frequencies.', + type: 'performance' + }, + { + name: 'xcar', + description: 'a factor that, when multiplied by the _kcps_ parameter, gives the carrier frequency.', + type: 'performance' + }, + { + name: 'xmod', + description: 'a factor that, when multiplied by the _kcps_ parameter, gives the modulating frequency.', + type: 'performance' + }, + { + name: 'kndx', + description: 'the modulation index.', + type: 'performance' + }, + { + name: 'xcar', + description: '_n_ * _xmod_), _n_ = 0,1,2,... The input _kndx_ is the index of modulation (usually time-varying and ranging 0 to 4 or so) which determines the spread of acoustic energy over the partial positions given by _n_ = 0,1,2,.., etc. _ifn_ should point to a stored sine wave. Previous to version 3.50, _xcar_ and _xmod_ could be k-rate only.', + type: 'performance' + }, + ], + seeAlso: ['FM Synthesis', 'http://en.wikipedia.org/wiki/Frequency_modulation_synthesis'] +}, +{ + name: 'foscili', + type: 'opcode', + category: 'Signal Generators:FM Synthesis', + description: 'Basic frequency modulated oscillator with linear interpolation.', + syntax: 'ares = foscili(xamp, kcps, xcar, xmod, kndx [, ifn, iphs])', + example: '--8<-- "examples/foscili.csd"', + rates: ['a-rate', 'k-rate', 'i-rate'], + parameters: [ + { + name: 'xamp', + description: 'the amplitude of the output signal.', + type: 'performance' + }, + { + name: 'kcps', + description: 'a common denominator, in cycles per second, for the carrier and modulating frequencies.', + type: 'performance' + }, + { + name: 'xcar', + description: 'a factor that, when multiplied by the _kcps_ parameter, gives the carrier frequency.', + type: 'performance' + }, + { + name: 'xmod', + description: 'a factor that, when multiplied by the _kcps_ parameter, gives the modulating frequency.', + type: 'performance' + }, + { + name: 'kndx', + description: 'the modulation index.', + type: 'performance' + }, + ], + seeAlso: ['FM Synthesis', 'http://en.wikipedia.org/wiki/Frequency_modulation_synthesis'] +}, +] diff --git a/src/lib/csound-reference/signal-generators-granular-synthesis.ts b/src/lib/csound-reference/signal-generators-granular-synthesis.ts new file mode 100644 index 0000000..05db354 --- /dev/null +++ b/src/lib/csound-reference/signal-generators-granular-synthesis.ts @@ -0,0 +1,1004 @@ +import type { CsoundReference } from './types' + +// Signal Generators:Granular Synthesis +export const signalGeneratorsGranularSynthesis: CsoundReference[] = [ +{ + name: 'diskgrain', + type: 'opcode', + category: 'Signal Generators:Granular Synthesis', + description: 'Synchronous granular synthesis, using a soundfile as source.', + syntax: 'asig = diskgrain(Sfname, kamp, kfreq, kpitch, kgrsize, kprate, \\\n ifun, iolaps [,imaxgrsize , ioffset])', + example: '--8<-- "examples/diskgrain.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'Sfilename', + description: 'source soundfile.', + type: 'initialization' + }, + { + name: 'ifun', + description: 'grain envelope function table.', + type: 'initialization' + }, + { + name: 'iolaps', + description: 'maximum number of overlaps, max(kfreq)*max(kgrsize). Estimating a large value should not affect performance, but exceeding this value will probably have disastrous consequences.', + type: 'initialization' + }, + { + name: 'imaxgrsize', + description: 'max grain size in secs (default 1.0).', + type: 'initialization' + }, + { + name: 'ioffset', + description: 'start offset in secs from beginning of file (default: 0).', + type: 'initialization' + }, + { + name: 'kamp', + description: 'amplitude scaling', + type: 'performance' + }, + { + name: 'kfreq', + description: 'frequency of grain generation, or density, in grains/sec.', + type: 'performance' + }, + { + name: 'kpitch', + description: 'grain pitch scaling (1=normal pitch, < 1 lower, > 1 higher; negative, backwards)', + type: 'performance' + }, + { + name: 'kgrsize', + description: 'grain size in secs.', + type: 'performance' + }, + { + name: 'kprate', + description: 'readout pointer rate, in grains. The value of 1 will advance the reading pointer 1 grain ahead in the source table. Larger values will time-compress and smaller values will time-expand the source signal. Negative values will cause the pointer to run backwards and zero will freeze it.', + type: 'performance' + }, + ], + seeAlso: ['Granular Synthesis'] +}, +{ + name: 'fof', + type: 'opcode', + category: 'Signal Generators:Granular Synthesis', + description: 'Produces sinusoid bursts useful for formant and granular synthesis.', + syntax: 'ares = fof(xamp, xfund, xform, koct, kband, kris, kdur, kdec, iolaps, \\\n ifna, ifnb, itotdur [, iphs] [, ifmode] [, iskip])', + example: '--8<-- "examples/fof.csd"', + rates: ['a-rate', 'i-rate'], + parameters: [ + { + name: 'iolaps', + description: 'number of preallocated spaces needed to hold overlapping burst data. Overlaps are frequency dependent, and the space required depends on the maximum value of _xfund * kdur_. Can be over-estimated at no computation cost. Uses less than 50 bytes of memory per _iolap_.', + type: 'initialization' + }, + { + name: 'ifna', + description: 'table numbers of two stored functions. The first is a sine table for sineburst synthesis (size of at least 4096 recommended). The second is a rise shape, used forwards and backwards to shape the sineburst rise and decay; this may be linear ([GEN07](../scoregens/gen07.md)) or perhaps a sigmoid ([GEN19](../scoregens/gen19.md)).', + type: 'initialization' + }, + { + name: 'ifnb', + description: 'table numbers of two stored functions. The first is a sine table for sineburst synthesis (size of at least 4096 recommended). The second is a rise shape, used forwards and backwards to shape the sineburst rise and decay; this may be linear ([GEN07](../scoregens/gen07.md)) or perhaps a sigmoid ([GEN19](../scoregens/gen19.md)).', + type: 'initialization' + }, + { + name: 'itotdur', + description: 'total time during which this _fof_ will be active. Normally set to p3. No new sineburst is created if it cannot complete its _kdur_ within the remaining _itotdur_.', + type: 'initialization' + }, + { + name: 'xamp', + description: 'peak amplitude of each sineburst, observed at the true end of its rise pattern. The rise may exceed this value given a large bandwidth (say, Q < 10) and/or when the bursts are overlapping.', + type: 'performance' + }, + { + name: 'xfund', + description: 'the fundamental frequency (in Hertz) of the impulses that create new sinebursts.', + type: 'performance' + }, + { + name: 'xform', + description: 'the formant frequency, i.e. freq of the sinusoid burst induced by each _xfund_ impulse. This frequency can be fixed for each burst or can vary continuously (see _ifmode_).', + type: 'performance' + }, + { + name: 'koct', + description: 'octaviation index, normally zero. If greater than zero, lowers the effective _xfund_ frequency by attenuating odd-numbered sinebursts. Whole numbers are full octaves, fractions transitional.', + type: 'performance' + }, + { + name: 'kband', + description: 'the formant bandwidth (at -6dB), expressed in Hz. The bandwidth determines the rate of exponential decay throughout the sineburst, before the enveloping described below is applied.', + type: 'performance' + }, + { + name: 'kris', + description: 'rise, overall duration, and decay times (in seconds) of the sinusoid burst. These values apply an enveloped duration to each burst, in similar fashion to a Csound _linen_ generator but with rise and decay shapes derived from the _ifnb_ input. _kris_ inversely determines the skirtwidth (at -40 dB) of the induced formant region. _kdur_ affects the density of sineburst overlaps, and thus the speed of computation. Typical values for vocal imitation are .003,.02,.007.', + type: 'performance' + }, + { + name: 'kdur', + description: 'rise, overall duration, and decay times (in seconds) of the sinusoid burst. These values apply an enveloped duration to each burst, in similar fashion to a Csound _linen_ generator but with rise and decay shapes derived from the _ifnb_ input. _kris_ inversely determines the skirtwidth (at -40 dB) of the induced formant region. _kdur_ affects the density of sineburst overlaps, and thus the speed of computation. Typical values for vocal imitation are .003,.02,.007.', + type: 'performance' + }, + { + name: 'kdec', + description: 'rise, overall duration, and decay times (in seconds) of the sinusoid burst. These values apply an enveloped duration to each burst, in similar fashion to a Csound _linen_ generator but with rise and decay shapes derived from the _ifnb_ input. _kris_ inversely determines the skirtwidth (at -40 dB) of the induced formant region. _kdur_ affects the density of sineburst overlaps, and thus the speed of computation. Typical values for vocal imitation are .003,.02,.007.', + type: 'performance' + }, + ], + seeAlso: ['Granular Synthesis'] +}, +{ + name: 'fof2', + type: 'opcode', + category: 'Signal Generators:Granular Synthesis', + description: 'Produces sinusoid bursts including k-rate incremental indexing with each successive burst.', + syntax: 'ares = fof2(xamp, xfund, xform, koct, kband, kris, kdur, kdec, iolaps, \\\n ifna, ifnb, itotdur, kphs, kgliss [, iskip])', + example: '--8<-- "examples/fof2.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'iolaps', + description: 'number of preallocated spaces needed to hold overlapping burst data. Overlaps are frequency dependent, and the space required depends on the maximum value of _xfund * kdur_. Can be over-estimated at no computation cost. Uses less than 50 bytes of memory per _iolap_.', + type: 'initialization' + }, + { + name: 'ifna', + description: 'table numbers of two stored functions. The first is a sine table for sineburst synthesis (size of at least 4096 recommended). The second is a rise shape, used forwards and backwards to shape the sineburst rise and decay; this may be linear ([GEN07](../scoregens/gen07.md)) or perhaps a sigmoid ([GEN19](../scoregens/gen19.md)).', + type: 'initialization' + }, + { + name: 'ifnb', + description: 'table numbers of two stored functions. The first is a sine table for sineburst synthesis (size of at least 4096 recommended). The second is a rise shape, used forwards and backwards to shape the sineburst rise and decay; this may be linear ([GEN07](../scoregens/gen07.md)) or perhaps a sigmoid ([GEN19](../scoregens/gen19.md)).', + type: 'initialization' + }, + { + name: 'itotdur', + description: 'total time during which this _fof_ will be active. Normally set to p3. No new sineburst is created if it cannot complete its _kdur_ within the remaining _itotdur_.', + type: 'initialization' + }, + { + name: 'xamp', + description: 'peak amplitude of each sineburst, observed at the true end of its rise pattern. The rise may exceed this value given a large bandwidth (say, Q < 10) and/or when the bursts are overlapping.', + type: 'performance' + }, + { + name: 'xfund', + description: 'the fundamental frequency (in Hertz) of the impulses that create new sinebursts.', + type: 'performance' + }, + { + name: 'xform', + description: 'the formant frequency, i.e. freq of the sinusoid burst induced by each _xfund_ impulse. This frequency can be fixed for each burst or can vary continuously.', + type: 'performance' + }, + { + name: 'koct', + description: 'octaviation index, normally zero. If greater than zero, lowers the effective _xfund_ frequency by attenuating odd-numbered sinebursts. Whole numbers are full octaves, fractions transitional.', + type: 'performance' + }, + { + name: 'kband', + description: 'the formant bandwidth (at -6dB), expressed in Hz. The bandwidth determines the rate of exponential decay throughout the sineburst, before the enveloping described below is applied.', + type: 'performance' + }, + { + name: 'kris', + description: 'rise, overall duration, and decay times (in seconds) of the sinusoid burst. These values apply an enveloped duration to each burst, in similar fashion to a Csound _linen_ generator but with rise and decay shapes derived from the _ifnb_ input. _kris_ inversely determines the skirtwidth (at -40 dB) of the induced formant region. _kdur_ affects the density of sineburst overlaps, and thus the speed of computation. Typical values for vocal imitation are .003,.02,.007.', + type: 'performance' + }, + { + name: 'kdur', + description: 'rise, overall duration, and decay times (in seconds) of the sinusoid burst. These values apply an enveloped duration to each burst, in similar fashion to a Csound _linen_ generator but with rise and decay shapes derived from the _ifnb_ input. _kris_ inversely determines the skirtwidth (at -40 dB) of the induced formant region. _kdur_ affects the density of sineburst overlaps, and thus the speed of computation. Typical values for vocal imitation are .003,.02,.007.', + type: 'performance' + }, + { + name: 'kdec', + description: 'rise, overall duration, and decay times (in seconds) of the sinusoid burst. These values apply an enveloped duration to each burst, in similar fashion to a Csound _linen_ generator but with rise and decay shapes derived from the _ifnb_ input. _kris_ inversely determines the skirtwidth (at -40 dB) of the induced formant region. _kdur_ affects the density of sineburst overlaps, and thus the speed of computation. Typical values for vocal imitation are .003,.02,.007.', + type: 'performance' + }, + { + name: 'kphs', + description: 'allows k-rate indexing of function table _ifna_ with each successive burst, making it suitable for time-warping applications. Values of _kphs_ are normalized from 0 to 1, 1 being the end of the function table _ifna_.', + type: 'performance' + }, + { + name: 'kgliss', + description: 'sets the end pitch of each grain relative to the initial pitch, in octaves. Thus _kgliss_ = 2 means that the grain ends two octaves above its initial pitch, while _kgliss_ = -3/4 has the grain ending a major sixth below. Each 1/12 added to _kgliss_ raises the ending frequency one half-step. If you want no glissando, set _kgliss_ to 0.', + type: 'performance' + }, + ], + seeAlso: ['Granular Synthesis'] +}, +{ + name: 'fog', + type: 'opcode', + category: 'Signal Generators:Granular Synthesis', + description: 'Audio output is a succession of grains derived from data in a stored function table.', + syntax: 'ares = fog(xamp, xdens, xtrans, aspd, koct, kband, kris, kdur, kdec, \\\n iolaps, ifna, ifnb, itotdur [, iphs] [, itmode] [, iskip])', + example: '--8<-- "examples/fog.csd"', + rates: ['a-rate', 'i-rate'], + parameters: [ + { + name: 'iolaps', + description: 'number of pre-located spaces needed to hold overlapping grain data. Overlaps are density dependent, and the space required depends on the maximum value of _xdens_ * _kdur_. Can be over-estimated at no computation cost. Uses less than 50 bytes of memory per _iolap_.', + type: 'initialization' + }, + { + name: 'ifna', + description: 'table numbers of two stored functions. The first is the data used for granulation, usually from a soundfile ([GEN01](../scoregens/gen01.md)). The second is a rise shape, used forwards and backwards to shape the grain rise and decay; this is normally a sigmoid ([GEN19](../scoregens/gen19.md)) but may be linear ([GEN05](../scoregens/gen05.md)).', + type: 'initialization' + }, + { + name: 'ifnb', + description: 'table numbers of two stored functions. The first is the data used for granulation, usually from a soundfile ([GEN01](../scoregens/gen01.md)). The second is a rise shape, used forwards and backwards to shape the grain rise and decay; this is normally a sigmoid ([GEN19](../scoregens/gen19.md)) but may be linear ([GEN05](../scoregens/gen05.md)).', + type: 'initialization' + }, + { + name: 'itotdur', + description: 'total time during which this _fog_ will be active. Normally set to p3. No new grain is created if it cannot complete its _kdur_ within the remaining _itotdur_.', + type: 'initialization' + }, + { + name: 'xamp', + description: 'amplitude factor. Amplitude is also dependent on the number of overlapping grains, the interaction of the rise shape (_ifnb_) and the exponential decay (_kband_), and the scaling of the grain waveform (_ifna_). The actual amplitude may therefore exceed _xamp_.', + type: 'performance' + }, + { + name: 'xdens', + description: 'density. The frequency of grains per second.', + type: 'performance' + }, + { + name: 'xtrans', + description: 'transposition factor. The rate at which data from the stored function table _ifna_ is read within each grain. This has the effect of transposing the original material. A value of 1 produces the original pitch. Higher values transpose upwards, lower values downwards. Negative values result in the function table being read backwards.', + type: 'performance' + }, + { + name: 'aspd', + description: 'Starting index pointer. _aspd_ is the normalized index (0 to 1) to table _ifna_ that determines the movement of a pointer used as the starting point for reading data within each grain. (_xtrans_ determines the rate at which data is read starting from this pointer.)', + type: 'performance' + }, + { + name: 'koct', + description: 'octaviation index. The operation of this parameter is identical to that in [fof](../opcodes/fof.md).', + type: 'performance' + }, + { + name: 'kband', + description: 'grain envelope shape. These parameters determine the exponential decay (_kband_), and the rise (_kris_), overall duration (_kdur_,) and decay (_kdec_ ) times of the grain envelope. Their operation is identical to that of the local envelope parameters in _fof_.', + type: 'performance' + }, + { + name: 'kris', + description: 'grain envelope shape. These parameters determine the exponential decay (_kband_), and the rise (_kris_), overall duration (_kdur_,) and decay (_kdec_ ) times of the grain envelope. Their operation is identical to that of the local envelope parameters in _fof_.', + type: 'performance' + }, + { + name: 'kdur', + description: 'grain envelope shape. These parameters determine the exponential decay (_kband_), and the rise (_kris_), overall duration (_kdur_,) and decay (_kdec_ ) times of the grain envelope. Their operation is identical to that of the local envelope parameters in _fof_.', + type: 'performance' + }, + { + name: 'kdec', + description: 'grain envelope shape. These parameters determine the exponential decay (_kband_), and the rise (_kris_), overall duration (_kdur_,) and decay (_kdec_ ) times of the grain envelope. Their operation is identical to that of the local envelope parameters in _fof_.', + type: 'performance' + }, + ], + seeAlso: ['Granular Synthesis'] +}, +{ + name: 'grain', + type: 'opcode', + category: 'Signal Generators:Granular Synthesis', + description: 'Generates granular synthesis textures.', + syntax: 'ares = grain(xamp, xpitch, xdens, kampoff, kpitchoff, kgdur, igfn, \\\n iwfn, imgdur [, igrnd])', + example: '--8<-- "examples/grain.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'igfn', + description: 'The ftable number of the grain waveform. This can be just a sine wave or a sampled sound.', + type: 'initialization' + }, + { + name: 'iwfn', + description: 'Ftable number of the amplitude envelope used for the grains (see also [GEN20](../scoregens/gen20.md)).', + type: 'initialization' + }, + { + name: 'imgdur', + description: 'Maximum grain duration in seconds. This is the biggest value to be assigned to _kgdur_.', + type: 'initialization' + }, + { + name: 'xamp', + description: 'Amplitude of each grain.', + type: 'performance' + }, + { + name: 'xpitch', + description: 'Grain pitch. To use the original frequency of the input sound, use the formula:', + type: 'performance' + }, + { + name: 'xdens', + description: 'Density of grains measured in grains per second. If this is constant then the output is synchronous granular synthesis, very similar to [fof](../opcodes/fof.md). If _xdens_ has a random element (like added noise), then the result is more like asynchronous granular synthesis.', + type: 'performance' + }, + { + name: 'kampoff', + description: 'Maximum amplitude deviation from _xamp_. This means that the maximum amplitude a grain can have is _xamp_ + _kampoff_ and the minimum is _xamp_. If _kampoff_ is set to zero then there is no random amplitude for each grain.', + type: 'performance' + }, + { + name: 'kpitchoff', + description: 'Maximum pitch deviation from _xpitch_ in Hz. Similar to _kampoff_.', + type: 'performance' + }, + { + name: 'kgdur', + description: 'Grain duration in seconds. The maximum value for this should be declared in _imgdur_. If _kgdur_ at any point becomes greater than _imgdur_, it will be truncated to _imgdur_.', + type: 'performance' + }, + ], + seeAlso: ['Granular Synthesis'] +}, +{ + name: 'grain2', + type: 'opcode', + category: 'Signal Generators:Granular Synthesis', + description: 'Easy-to-use granular synthesis texture generator.', + syntax: 'ares = grain2(kcps, kfmd, kgdur, iovrlp, kfn, iwfn [, irpow] \\\n [, iseed] [, imode])', + example: '--8<-- "examples/grain2.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'iovrlp', + description: '(fixed) number of overlapping grains.', + type: 'initialization' + }, + { + name: 'iwfn', + description: 'function table containing window waveform (Use [GEN20](../scoregens/gen20.md) to calculate _iwfn_).', + type: 'initialization' + }, + { + name: 'ares', + description: 'output signal.', + type: 'performance' + }, + { + name: 'kcps', + description: 'grain frequency in Hz.', + type: 'performance' + }, + { + name: 'kfmd', + description: 'random variation (bipolar) in grain frequency in Hz.', + type: 'performance' + }, + { + name: 'kgdur', + description: 'grain duration in seconds. _kgdur_ also controls the duration of already active grains (actually the speed at which the window function is read). This behavior does not depend on the _imode_ flags.', + type: 'performance' + }, + { + name: 'kfn', + description: 'function table containing grain waveform. Table number can be changed at k-rate (this is useful to select from a set of band-limited tables generated by [GEN30](../scoregens/gen30.md), to avoid aliasing).', + type: 'performance' + }, + ], + seeAlso: ['Granular Synthesis'] +}, +{ + name: 'grain3', + type: 'opcode', + category: 'Signal Generators:Granular Synthesis', + description: 'Generate granular synthesis textures with more user control.', + syntax: 'ares = grain3(kcps, kphs, kfmd, kpmd, kgdur, kdens, imaxovr, kfn, iwfn, \\\n kfrpow, kprpow [, iseed] [, imode])', + example: '--8<-- "examples/grain3.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'imaxovr', + description: 'maximum number of overlapping grains. The number of overlaps can be calculated by (_kdens_ * _kgdur_); however, it can be overestimated at no cost in rendering time, and a single overlap uses (depending on system) 16 to 32 bytes of memory.', + type: 'initialization' + }, + { + name: 'iwfn', + description: 'function table containing window waveform (Use Use [GEN20](../scoregens/gen20.md) to calculate _iwfn_).', + type: 'initialization' + }, + { + name: 'ares', + description: 'output signal.', + type: 'performance' + }, + { + name: 'kcps', + description: 'grain frequency in Hz.', + type: 'performance' + }, + { + name: 'kphs', + description: 'grain phase. This is the location in the grain waveform table, expressed as a fraction (between 0 to 1) of the table length.', + type: 'performance' + }, + { + name: 'kfmd', + description: 'random variation (bipolar) in grain frequency in Hz.', + type: 'performance' + }, + { + name: 'kpmd', + description: 'random variation (bipolar) in start phase.', + type: 'performance' + }, + { + name: 'kgdur', + description: 'grain duration in seconds. _kgdur_ also controls the duration of already active grains (actually the speed at which the window function is read). This behavior does not depend on the _imode_ flags.', + type: 'performance' + }, + { + name: 'kdens', + description: 'number of grains per second.', + type: 'performance' + }, + { + name: 'kfrpow', + description: 'this value controls the distribution of grain frequency variation. If _kfrpow_ is positive, the random distribution (x is in the range -1 to 1) is:', + type: 'performance' + }, + { + name: 'kprpow', + description: 'distribution of random phase variation (see _kfrpow_). Setting _kphs_ and _kpmd_ to 0.5, and _kprpow_ to 0 will emulate _grain2_.', + type: 'performance' + }, + { + name: 'kfn', + description: 'function table containing grain waveform. Table number can be changed at k-rate (this is useful to select from a set of band-limited tables generated by Use [GEN30](../scoregens/gen30.md), to avoid aliasing).', + type: 'performance' + }, + ], + seeAlso: ['Granular Synthesis'] +}, +{ + name: 'granule', + type: 'opcode', + category: 'Signal Generators:Granular Synthesis', + description: 'A more complex granular synthesis texture generator.', + syntax: 'ares = granule(xamp, ivoice, iratio, imode, ithd, ifn, ipshift, igskip, \\\n igskip_os, ilength, kgap, igap_os, kgsize, igsize_os, iatt, idec \\\n [, iseed] [, ipitch1] [, ipitch2] [, ipitch3] [, ipitch4] [, ifnenv])', + example: '--8<-- "examples/granule.csd"', + rates: ['a-rate', 'i-rate'], + parameters: [ + { + name: 'ivoice', + description: 'number of voices.', + type: 'initialization' + }, + { + name: 'iratio', + description: 'ratio of the speed of the gskip pointer relative to output audio sample rate. eg. 0.5 will be half speed.', + type: 'initialization' + }, + { + name: 'imode', + description: '+1 grain pointer move forward (same direction of the gskip pointer), -1 backward (oppose direction to the gskip pointer) or 0 for random.', + type: 'initialization' + }, + { + name: 'ithd', + description: 'threshold, if the sampled signal in the wavetable is smaller then _ithd_, it will be skipped.', + type: 'initialization' + }, + { + name: 'ifn', + description: 'function table number of sound source.', + type: 'initialization' + }, + { + name: 'ipshift', + description: 'pitch shift control. If _ipshift_ is 0, pitch will be set randomly up and down an octave. If _ipshift_ is 1, 2, 3 or 4, up to four different pitches can be set amount the number of voices defined in _ivoice_. The optional parameters _ipitch1_, _ipitch2_, _ipitch3_ and _ipitch4_ are used to quantify the pitch shifts.', + type: 'initialization' + }, + { + name: 'igskip', + description: 'initial skip from the beginning of the function table in sec.', + type: 'initialization' + }, + { + name: 'igskip_os', + description: 'gskip pointer random offset in sec, 0 will be no offset.', + type: 'initialization' + }, + { + name: 'ilength', + description: 'length of the table to be used starting from _igskip_ in sec.', + type: 'initialization' + }, + { + name: 'igap_os', + description: 'gap random offset in % of the gap size, 0 gives no offset.', + type: 'initialization' + }, + { + name: 'igsize_os', + description: 'grain size random offset in % of grain size, 0 gives no offset.', + type: 'initialization' + }, + { + name: 'iatt', + description: 'attack of the grain envelope in % of grain size.', + type: 'initialization' + }, + { + name: 'idec', + description: 'decade of the grain envelope in % of grain size.', + type: 'initialization' + }, + { + name: 'xamp', + description: 'amplitude.', + type: 'performance' + }, + { + name: 'kgap', + description: 'gap between grains in sec.', + type: 'performance' + }, + { + name: 'kgsize', + description: 'grain size in sec.', + type: 'performance' + }, + ], + seeAlso: ['Granular Synthesis'] +}, +{ + name: 'partikkel', + type: 'opcode', + category: 'Signal Generators:Granular Synthesis', + description: 'Granular synthesizer with "per grain" control over many of its parameters. Has a sync input to sychronize its internal grain scheduler clock to an external clock source.', + syntax: 'a1 [, a2, a3, a4, a5, a6, a7, a8] = partikkel(agrainfreq, \\\n kdistribution, idisttab, async, kenv2amt, ienv2tab, ienv_attack, \\\n ienv_decay, ksustain_amount, ka_d_ratio, kduration, kamp, igainmasks, \\\n kwavfreq, ksweepshape, iwavfreqstarttab, iwavfreqendtab, awavfm, \\\n ifmamptab, kfmenv, icosine, ktraincps, knumpartials, kchroma, \\\n ichannelmasks, krandommask, kwaveform1, kwaveform2, kwaveform3, \\\n kwaveform4, iwaveamptab, asamplepos1, asamplepos2, asamplepos3, \\\n asamplepos4, kwavekey1, kwavekey2, kwavekey3, kwavekey4, imax_grains \\\n [, iopcode_id, ipanlaws])', + example: '--8<-- "examples/partikkel.csd"', + rates: ['k-rate'], + parameters: [ + { + name: 'idisttab', + description: 'function table number, distribution for random grain displacements over time. The table values are interpreted as "displacement amount" scaled by 1/grainrate. This means that a value of 0.5 in the table will displace a grain by half the grainrate period. The table values are read randomly, and scaled by _kdistribution_. For realistic stochastic results, it is advisable not to use a too small table size, as this limits the amount of possible displacement values. This can also be utilized for other purposes, e.g. using quantized displacement values to work with controlled time displacement from the periodic grain rate. If _kdistribution_ is negative, the table values will be read sequentially. A default table might be selected by using -1 as the ftable number, for _idisttab_ the default uses a zero distribution (no displacement).', + type: 'initialization' + }, + { + name: 'ienv_attack', + description: 'function table number, attack shape of grain. Needs extended guard point. A default table might be selected by using -1 as the ftable number, for _ienv_attack_ the default uses a square window (no enveloping).', + type: 'initialization' + }, + { + name: 'ienv_decay', + description: 'function table number, decay shape of grain. Needs extended guard point. A default table might be selected by using -1 as the ftable number, for _ienv_decay_ the default uses a square window (no enveloping).', + type: 'initialization' + }, + { + name: 'ienv2tab', + description: 'function table number, additional envelope applied to grain, done after attack and decay envelopes. Can be used e.g. for fof formant synthesis. Needs extended guard point. A default table might be selected by using -1 as the ftable number, for _ienv2tab_ the default uses a square window (no enveloping).', + type: 'initialization' + }, + { + name: 'icosine', + description: 'function table number, must contain a cosine, used for trainlets. Table size should be at least 2048 for good quality trainlets.', + type: 'initialization' + }, + { + name: 'igainmasks', + description: 'function table number, gain per grain. The sequence of values in the table is as follows: index 0 is used as a loop start point in reading the values, index 1 is used as a loop end point. Remaining indices contain gain values (normally in range 0 - 1, but other values are allowed, negative values will invert phase of waveform inside grain) for a sequence of grains, these are read at grain rate enabling exact patterns of "gain per grain". The loop start and end points are zero based with an origin at index 2, e.g. a loop start value of 0 and loop end value of 3 will read indices 2,3,4,5 in a loop at grain rate. A default table might be selected by using -1 as the ftable number, for _igainmasks_ the default disables gain masking (all grains are given a gain masking value of 1).', + type: 'initialization' + }, + { + name: 'ichannelmasks', + description: 'function table number, see _igainmasks_ for a description of how the values in the table are read. Range is 0 to N, where N is the number of output channels. A value of zero will send the grain to audio output 1 from the opcode. Fractional values are allowed, e.g. a value of 3.5 will mix the grain equally to outputs 4 and 5. The channelmask value wraps around from the last to the first output, so that a vaalue of N-0.5 will mix the grain equally between the last and the first output. If another panning law between outputs is desired, this can be described in the _ipanlaws_ table. The user is responsible for keeping the values in range, the opcode will crash with out of range values. A default table might be selected by using -1 as the ftable number, for _ichannelmasks_ the default disables channel masking (all grains are given a channel masking value of 0 and are sent to _partikkel_ audio out 1).', + type: 'initialization' + }, + { + name: 'iwavfreqstarttab', + description: 'function table number, see _igainmasks_ for a description of how the values in the table are read. Start frequency multiplicator for each grain. Pitch will glide from start frequency to end frequency following a line or curve as set by _ksweepshape_. A default table might be selected by using -1 as the ftable number, for _iwavfreqstarttab_ the default uses a multiplicator of 1, disabling any start frequency modification.', + type: 'initialization' + }, + { + name: 'iwavfreqendtab', + description: 'function table number, see _iwavfreqstarttab_. End frequency multiplicator for each grain. A default table might be selected by using -1 as the ftable number, for _iwavfreqendtab_ the default uses a multiplicator of 1, disabling any end frequency modification.', + type: 'initialization' + }, + { + name: 'ifmamptab', + description: 'function table number, see _igainmasks_ for a description of how the values in the table are read. Frequency modulation index per grain. The signal _awavfm_ will be multiplied by values read from this table. A default table might be selected by using -1 as the ftable number, for _ifmamptab_ the default uses 1 as the index multiplicator, enabling fm for all grains.', + type: 'initialization' + }, + { + name: 'iwaveamptab', + description: 'function table number, the indices are read in a similar way to what is used for _igainmasks_. Index 0 is used as a loop start point, and index 1 is used as a loop end point. The rest of the indices are read in groups of 5, where each value represent a gain value for each of the 4 source waveforms, and the 5th value represent trainlet amplitude. A default table might be selected by using -1 as the ftable number, for _iwaveamptab_ the default uses an equal mix of all 4 source waveforms (each with an amplitude of 0.5) and setting trainlet amp to zero.', + type: 'initialization' + }, + { + name: 'imax_grains', + description: 'maximum number of grains per k-period. Estimating a large value should not affect performance, exceeding this value will lead to "oldest grains" being deleted.', + type: 'initialization' + }, + { + name: 'iopcode_id', + description: 'the opcode id, linking an instance of _partikkel_ to an instance of [partikkelsync](../opcodes/partikkelsync.md), the linked _partikkelsync_ will output trigger pulses synchronized to _partikkel_\'s grain maker scheduler. The default value is zero, which means no connection to any _partikkelsync_ instances.', + type: 'initialization' + }, + { + name: 'ipanlaws', + description: 'function table number. The table describes the panning curve used for fractional channelmask values. Fractional channelmask values will mix a grain to two neighbouring outputs, with the relative gain set by the fractional value. By default if no _ipanlaws_ table is described, a linear gain relationship is used, so that a channelmask value of e.g. 1.5 distributes the grain with 0.5 gain to output 2 and 0.5 gain to output 3. The _ipanlaws_ table can be used to describe other gain control curves (panning laws). The table should contain 8 such gain control curves, each governing the panning between two neighbouring outputs. The curves should appear one after another in the table, in a concatenated fashion. GEN 18 can be used to create this table from separate panning curve tables (see example below). The first curve describes the panning law between output 1 and output 2, the next is for panning between outputs 2 and 3, and so on. The last curve describes the panning law between the last and the first output. The table is indexed by the channelmask value such that one output (of an output pair goverened by the panning law) uses the index (tablesize/8*channelmask) while the other of the two outputs reads the value at index (tablesize/8*(int(channelmask+1)-frac(channelmask))). This means that if the panning law value halfway between these two channel masks is e.g. 0.7 (which would give approximately equal power panning), then each of those two outputs will use 0.7 as the gain value.', + type: 'initialization' + }, + { + name: 'xgrainfreq', + description: 'number of grains per second. A value of zero is allowed, and this will defer all grain scheduling to the sync input.', + type: 'performance' + }, + { + name: 'async', + description: 'sync input. Input values are added to the phase value of the internal grain maker clock, enabling tempo synchronization with an external clock source. As this is an a-rate signal, inputs are usually pulses of length 1/_sr_. Using such pulses, the internal phase value can be "nudged" up or down, enabling soft or hard synchronization. Negative input values decrements the internal phase, while positive values in the range 0 to 1 increments the internal phase. An input value of 1 will always make _partikkel_ generate a grain. If the value remains at 1, the internal grain scheduler clock will pause but any currently playing grains will still play to end.', + type: 'performance' + }, + { + name: 'kdistribution', + description: 'periodic or stochastic distribution of grains, 0 = periodic. Stochastic grain displacement is in the range of _kdistribution/grainrate_ seconds. The stochastic distribution profile (random distribution) can be set in the _idisttab_ table. If _kdistribution_ is negative, the result is deterministic time displacement as described by _idisttab_ (sequential read of displacement values). Maximum grain displacement in all cases is limited to 10 seconds, and a grain will keep the values (duration, pitch etc) it was given when it was first generated (before time displacement). Since grain displacement is relative to the grain rate, displacement amount is undefined at 0Hz grain rate and kdistribution is completely disabled in this case.', + type: 'performance' + }, + { + name: 'kenv2amt', + description: 'amount of enveloping for the secondary envelope for each grain. Range 0 to 1, where 0 is no secondary enveloping (square window), a value of 0.5 will use an interpolation between a square window and the shape set by _ienv2tab_.', + type: 'performance' + }, + { + name: 'ksustain_amount', + description: 'sustain time as fraction of grain duration. I.e. balance between enveloped time(attack+decay) and sustain level time. The sustain level is taken from the last value of the _ienv_attack_ ftable.', + type: 'performance' + }, + { + name: 'ka_d_ratio', + description: 'balance between attack time and decay time. For example, with _ksustain_amount_ set to 0.5 and _ka_d_ratio_ set to 0.5, the attack envelope of each grain will take 25% of the grain duration, full amplitude (sustain) will be held for 50% of the grain duration, and the decay envelope will take the remaining 25% of the grain duration.', + type: 'performance' + }, + { + name: 'kduration', + description: 'grain duration in milliseconds.', + type: 'performance' + }, + { + name: 'kamp', + description: 'amplitude scaling of the opcode\'s output. Multiplied by per grain amplitude read from _igainmasks_. Source waveform playback inside grains can consume a significant amount of CPU cycles, especially if grain duration is long so that we have a lot of overlapping grains. Setting kamp to zero will skip waveform playback inside grains (and not generate any sound, obviously). This can be used as a "soft" bypass method if we want to keep the opcode active but silent for some periods of time.', + type: 'performance' + }, + { + name: 'kwavfreq', + description: 'transposition scaling. Multiplied with start and end transposition values read from _iwavfreqstarttab_ and _iwavfreqendtab_.', + type: 'performance' + }, + { + name: 'ksweepshape', + description: 'transposition sweep shape, controls the curvature of the transposition sweep. Range 0 to 1. Low values will hold the transposition at the start value longer and then drop to the end value quickly, high values will drop to the end value quickly. A value of 0.5 will give a linear sweep. A value of exactly 0 will bypass sweep and only use the start frequency, while a value of exactly 1 will bypass sweep and only use the end frequency. The sweep generator might be slightly inaccurate in hitting the end frequency when using a steep curve and very long grains.', + type: 'performance' + }, + { + name: 'awavfm', + description: 'audio input for frequency modulation inside grain.', + type: 'performance' + }, + { + name: 'kfmenv', + description: 'function table number, envelope for FM modulator signal enabling the modulation index to change over the duration of a grain.', + type: 'performance' + }, + { + name: 'ktraincps', + description: 'trainlet fundamental frequency.', + type: 'performance' + }, + { + name: 'knumpartials', + description: 'number of partials in trainlets.', + type: 'performance' + }, + { + name: 'kchroma', + description: 'chroma of trainlets. A value of 1 give equal amplitude to each partial, higher values will reduce the amplitude of lower partials while strengthening the amplitude of the higher partials.', + type: 'performance' + }, + { + name: 'krandommask', + description: 'random masking (muting) of individual grains. Range 0 to 1, where a value of 0 will give no masking (all grains are played), and a value of 1 will mute all grains.', + type: 'performance' + }, + { + name: 'kwaveform1', + description: 'table number for source waveform 1.', + type: 'performance' + }, + { + name: 'kwaveform2', + description: 'table number for source waveform 2.', + type: 'performance' + }, + { + name: 'kwaveform3', + description: 'table number for source waveform 3.', + type: 'performance' + }, + { + name: 'kwaveform4', + description: 'table number for source waveform 4.', + type: 'performance' + }, + { + name: 'asamplepos1', + description: 'start position for reading source waveform 1 (in range 0..1).', + type: 'performance' + }, + { + name: 'asamplepos2', + description: 'start position for reading source waveform 2.', + type: 'performance' + }, + { + name: 'asamplepos3', + description: 'start position for reading source waveform 3.', + type: 'performance' + }, + { + name: 'asamplepos4', + description: 'start position for reading source waveform 4.', + type: 'performance' + }, + { + name: 'kwavekey1', + description: 'original key of source waveform 1. Can be used to transpose each source waveform independently.', + type: 'performance' + }, + { + name: 'kwavekey2', + description: 'as _kwavekey1_, but for source waveform 2.', + type: 'performance' + }, + { + name: 'kwavekey3', + description: 'as _kwavekey1_, but for source waveform 3.', + type: 'performance' + }, + { + name: 'kwavekey4', + description: 'as _kwavekey1_, but for source waveform 4.', + type: 'performance' + }, + ], + seeAlso: ['Granular Synthesis'] +}, +{ + name: 'partikkelget', + type: 'opcode', + category: 'Signal Generators:Granular Synthesis', + description: 'Get mask index for a specific mask parameter of a running _partikkel_ instance.', + syntax: 'kindex = partikkelget(kparameterindex, iopcode_id)', + example: '--8<-- "examples/partikkelgetset.csd"', + parameters: [ + { + name: 'iopcode_id', + description: 'the opcode id, linking an instance of [partikkel](../opcodes/partikkel.md) to an instance of _partikkelsync_.', + type: 'initialization' + }, + { + name: 'kmaskindex', + description: 'mask index output. Outputs the current mask index for the parameter specified with _kparameterindex_ in the partikkel instance identified with _iopcode_id_.', + type: 'performance' + }, + { + name: 'kparameterindex', + description: 'mask parameter. Selection of the masking parameter for which to output the current mask index. The different parameters are identified as:', + type: 'performance' + }, + ], + seeAlso: ['partikkel'] +}, +{ + name: 'partikkelset', + type: 'opcode', + category: 'Signal Generators:Granular Synthesis', + description: 'Set mask index for a specific mask parameter of a running _partikkel_ instance.', + syntax: 'partikkelset(kparameterindex, kmaskindex, iopcode_id)', + example: '--8<-- "examples/partikkelgetset.csd"', + parameters: [ + { + name: 'iopcode_id', + description: 'the opcode id, linking an instance of [partikkel](../opcodes/partikkel.md) to an instance of _partikkelsync_.', + type: 'initialization' + }, + { + name: 'kparameterindex', + description: 'mask parameter. Selection of the masking parameter for which to set the current mask index. The different parameters are identified as:', + type: 'performance' + }, + { + name: 'kmaskindex', + description: 'value to set mask index to. Sets the current mask index for the parameter specified with _kparameterindex_ in the partikkel instance identified with _iopcode_id_.', + type: 'performance' + }, + ], + seeAlso: ['partikkel'] +}, +{ + name: 'partikkelsync', + type: 'opcode', + category: 'Signal Generators:Granular Synthesis', + description: 'Outputs _partikkel_\'s grain scheduler clock pulse and phase to synchronize several instances of the _partikkel_ opcode to the same clock source.', + syntax: 'async [,aphase] = partikkelsync(iopcode_id)', + example: '--8<-- "examples/partikkelsync.csd"', + parameters: [ + { + name: 'iopcode_id', + description: 'the opcode id, linking an instance of [partikkel](../opcodes/partikkel.md) to an instance of _partikkelsync_.', + type: 'initialization' + }, + { + name: 'async', + description: 'trigger pulse signal. Outputs trigger pulses synchronized to a _partikkel_ opcode\'s grain scheduler clock. One trigger pulse is generated for each grain started in the _partikkel_ opcode with the same _opcode_id_. The normal usage would be to send this signal to another _partikkel_ opcode\'s _async_ input to synchronize several instances of _partikkel_.', + type: 'performance' + }, + { + name: 'aphase', + description: 'clock phase. Outputs a linear ramping phase signal. Can be used e.g. for softsynchronization, or just as a phase generator ala _phasor_.', + type: 'performance' + }, + ], + seeAlso: ['Granular Synthesis'] +}, +{ + name: 'sndwarp', + type: 'opcode', + category: 'Signal Generators:Granular Synthesis', + description: 'Reads a mono sound sample from a table and applies time-stretching and/or pitch modification.', + syntax: 'ares [, ac] = sndwarp(xamp, xtimewarp, xresample, ifn1, ibeg, iwsize, \\\n irandw, ioverlap, ifn2, itimemode)', + example: '--8<-- "examples/sndwarp.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'ifn1', + description: 'the number of the table holding the sound samples which will be subjected to the _sndwarp_ processing. [GEN01](../scoregens/gen01.md) is the appropriate function generator to use to store the sound samples from a pre-existing soundfile.', + type: 'initialization' + }, + { + name: 'ibeg', + description: 'the time in seconds to begin reading in the table (or soundfile). When _itimemode_ is non- zero, the value of _xtimewarp_ is offset by _ibeg_.', + type: 'initialization' + }, + { + name: 'iwsize', + description: 'the window size in samples used in the time scaling algorithm.', + type: 'initialization' + }, + { + name: 'irandw', + description: 'the bandwidth of a random number generator. The random numbers will be added to _iwsize_.', + type: 'initialization' + }, + { + name: 'ioverlap', + description: 'determines the density of overlapping windows.', + type: 'initialization' + }, + { + name: 'ifn2', + description: 'a function used to shape the window. It is usually used to create a ramp of some kind from zero at the beginning and back down to zero at the end of each window. Try using a half sine (i.e.: f1 0 16384 9 .5 1 0) which works quite well. Other shapes can also be used.', + type: 'initialization' + }, + { + name: 'ares', + description: 'the single channel of output from the _sndwarp_ unit generator. _sndwarp_ assumes that the function table holding the sampled signal is a mono one. This simply means that _sndwarp_ will index the table by single-sample frame increments. The user must be aware then that if a stereo signal is used with _sndwarp_, time and pitch will be altered accordingly.', + type: 'performance' + }, + { + name: 'xamp', + description: 'the value by which to scale the amplitude (see note on the use of this when using _ac_).', + type: 'performance' + }, + { + name: 'xtimewarp', + description: 'determines how the input signal will be stretched or shrunk in time. There are two ways to use this argument depending upon the value given for _itimemode_. When the value of _itimemode_ is 0, _xtimewarp_ will scale the time of the sound. For example, a value of 2 will stretch the sound by 2 times. When _itimemode_ is any non-zero value then _xtimewarp_ is used as a time pointer in a similar way in which the time pointer works in [lpread](../opcodes/lpread.md) and [pvoc](../opcodes/pvoc.md). An example below illustrates this. In both cases, the pitch will _not_ be altered by this process. Pitch shifting is done independently using _xresample_.', + type: 'performance' + }, + { + name: 'xresample', + description: 'the factor by which to change the pitch of the sound. For example, a value of 2 will produce a sound one octave higher than the original. The timing of the sound, however, will _not_ be altered.', + type: 'performance' + }, + ], + seeAlso: ['Granular Synthesis'] +}, +{ + name: 'sndwarpst', + type: 'opcode', + category: 'Signal Generators:Granular Synthesis', + description: 'Reads a stereo sound sample from a table and applies time-stretching and/or pitch modification.', + syntax: 'ar1, ar2 [,ac1] [, ac2] = sndwarpst(xamp, xtimewarp, xresample, ifn1, \\\n ibeg, iwsize, irandw, ioverlap, ifn2, itimemode)', + example: '--8<-- "examples/sndwarpst.csd"', + parameters: [ + { + name: 'ifn1', + description: 'the number of the table holding the sound samples which will be subjected to the _sndwarpst_ processing. [GEN01](../scoregens/gen01.md) is the appropriate function generator to use to store the sound samples from a pre-existing soundfile.', + type: 'initialization' + }, + { + name: 'ibeg', + description: 'the time in seconds to begin reading in the table (or soundfile). When _itimemode_ is non-zero, the value of _xtimewarp_ is offset by _ibeg_.', + type: 'initialization' + }, + { + name: 'iwsize', + description: 'the window size in samples used in the time scaling algorithm.', + type: 'initialization' + }, + { + name: 'irandw', + description: 'the bandwidth of a random number generator. The random numbers will be added to _iwsize_.', + type: 'initialization' + }, + { + name: 'ioverlap', + description: 'determines the density of overlapping windows.', + type: 'initialization' + }, + { + name: 'ifn2', + description: 'a function used to shape the window. It is usually used to create a ramp of some kind from zero at the beginning and back down to zero at the end of each window. Try using a half a sine (i.e.: f1 0 16384 9 .5 1 0) which works quite well. Other shapes can also be used.', + type: 'initialization' + }, + { + name: 'ar1', + description: '_ar1_ and _ar2_ are the stereo (left and right) outputs from _sndwarpst_. _sndwarpst_ assumes that the function table holding the sampled signal is a stereo one. _sndwarpst_ will index the table by a two-sample frame increment. The user must be aware then that if a mono signal is used with _sndwarpst_, time and pitch will be altered accordingly.', + type: 'performance' + }, + { + name: 'ar2', + description: '_ar1_ and _ar2_ are the stereo (left and right) outputs from _sndwarpst_. _sndwarpst_ assumes that the function table holding the sampled signal is a stereo one. _sndwarpst_ will index the table by a two-sample frame increment. The user must be aware then that if a mono signal is used with _sndwarpst_, time and pitch will be altered accordingly.', + type: 'performance' + }, + { + name: 'ac1', + description: '_ac1_ and _ac2_ are single-layer (no overlaps), unwindowed versions of the time and/or pitch altered signal. They are supplied in order to be able to balance the amplitude of the signal output, which typically contains many overlapping and windowed versions of the signal, with a clean version of the time-scaled and pitch-shifted signal. The _sndwarpst_ process can cause noticeable changes in amplitude, (up and down), due to a time differential between the overlaps when time-shifting is being done. When used with a [balance](../opcodes/balance.md) unit, _ac1_ and _ac2_ can greatly enhance the quality of sound. They are optional, but note that they must both be present in the syntax (use both or neither). An example of how to use this is given below.', + type: 'performance' + }, + { + name: 'ac2', + description: '_ac1_ and _ac2_ are single-layer (no overlaps), unwindowed versions of the time and/or pitch altered signal. They are supplied in order to be able to balance the amplitude of the signal output, which typically contains many overlapping and windowed versions of the signal, with a clean version of the time-scaled and pitch-shifted signal. The _sndwarpst_ process can cause noticeable changes in amplitude, (up and down), due to a time differential between the overlaps when time-shifting is being done. When used with a [balance](../opcodes/balance.md) unit, _ac1_ and _ac2_ can greatly enhance the quality of sound. They are optional, but note that they must both be present in the syntax (use both or neither). An example of how to use this is given below.', + type: 'performance' + }, + { + name: 'xamp', + description: 'the value by which to scale the amplitude (see note on the use of this when using _ac1_ and _ac2_).', + type: 'performance' + }, + { + name: 'xtimewarp', + description: 'determines how the input signal will be stretched or shrunk in time. There are two ways to use this argument depending upon the value given for _itimemode_. When the value of _itimemode_ is 0, _xtimewarp_ will scale the time of the sound. For example, a value of 2 will stretch the sound by 2 times. When _itimemode_ is any non-zero value then _xtimewarp_ is used as a time pointer in a similar way in which the time pointer works in [lpread](../opcodes/lpread.md) and [pvoc](../opcodes/pvoc.md). An example below illustrates this. In both cases, the pitch will _not_ be altered by this process. Pitch shifting is done independently using _xresample_.', + type: 'performance' + }, + { + name: 'xresample', + description: 'the factor by which to change the pitch of the sound. For example, a value of 2 will produce a sound one octave higher than the original. The timing of the sound, however, will _not_ be altered.', + type: 'performance' + }, + ], + seeAlso: ['Granular Synthesis'] +}, +] diff --git a/src/lib/csound-reference/signal-generators-hyper-vectorial-synthesis.ts b/src/lib/csound-reference/signal-generators-hyper-vectorial-synthesis.ts new file mode 100644 index 0000000..0988a1f --- /dev/null +++ b/src/lib/csound-reference/signal-generators-hyper-vectorial-synthesis.ts @@ -0,0 +1,172 @@ +import type { CsoundReference } from './types' + +// Signal Generators:Hyper Vectorial Synthesis +export const signalGeneratorsHyperVectorialSynthesis: CsoundReference[] = [ +{ + name: 'hvs1', + type: 'opcode', + category: 'Signal Generators:Hyper Vectorial Synthesis', + description: 'Allows one-dimensional Hyper Vectorial Synthesis (HVS) controlled by externally-updated k-variables.', + syntax: 'hvs1(kx, inumParms, inumPointsX, iOutTab, iPositionsTab, iSnapTab [, iConfigTab])', + example: '--8<-- "examples/hvs1.csd"', + parameters: [ + { + name: 'inumParms', + description: 'number of parameters controlled by the HVS. Each HVS snapshot is made up of inumParms elements.', + type: 'initialization' + }, + { + name: 'inumPointsX', + description: 'number of points that each dimension of the HVS cube (or square in case of two-dimensional HVS; or line in case of one-dimensional HVS) is made up.', + type: 'initialization' + }, + { + name: 'iOutTab', + description: 'number of the table receiving the set of output-parameter instant values of the HVS. The total amount of parameters is defined by the _inumParms_ argument.', + type: 'initialization' + }, + { + name: 'iPositionsTab', + description: 'a table filled with the individual positions of snapshots in the HVS matrix (see below for more information).', + type: 'initialization' + }, + { + name: 'iSnapTab', + description: 'a table filled with all the snapshots. Each snapshot is made up of a set of parameter values. The amount of elements contained in each snapshots is specified by the _inumParms_ argument. The set of elements of each snapshot follows (and is adjacent) to the previous one in this table. So the total size of this table should be >= to _inumParms_ multiplied the number of snapshots you intend to store for the HVS.', + type: 'initialization' + }, + { + name: 'iConfigTab', + description: '(optional) a table containing the behavior of the HVS for each parameter. If the value of _iConfigTab_ is zero (default), this argument is ignored, meaning that each parameter is treated with linear interpolation by the HVS. If _iConfigTab_ is different than zero, then it must refer to an existing table whose contents are in its turn referring to a particolar kind of interpolation. In this table, a value of -1 indicates that corresponding parameter is leaved unchanged (ignored) by the HVS; a value of zero indicates that corresponding parameter is treated with linear-interpolation; each other values must be integer numbers indicating an existing table filled with a shape which will determine the kind of special interpolation to be used (table-based interpolation).', + type: 'initialization' + }, + { + name: 'kx', + description: 'these are externally-modified variables which controls the motion of the pointer in the HVS matrix cube (or square or line in case of HVS matrices made up of less than 3 dimensions). The range of these input arguments must be 0 to 1.', + type: 'performance' + }, + ], + seeAlso: ['Hyper Vectorial Synthesis'] +}, +{ + name: 'hvs2', + type: 'opcode', + category: 'Signal Generators:Hyper Vectorial Synthesis', + description: 'Allows two-dimensional Hyper Vectorial Synthesis (HVS) controlled by externally-updated k-variables.', + syntax: 'hvs2(kx, ky, inumParms, inumPointsX, inumPointsY, iOutTab, iPositionsTab, \\\n iSnapTab [, iConfigTab])', + example: '--8<-- "examples/hvs2.csd"', + parameters: [ + { + name: 'inumParms', + description: 'number of parameters controlled by the HVS. Each HVS snapshot is made up of _inumParms_ elements.', + type: 'initialization' + }, + { + name: 'inumPointsX', + description: 'number of points that each dimension of the HVS cube (or square in case of two-dimensional HVS; or line in case of one-dimensional HVS) is made up.', + type: 'initialization' + }, + { + name: 'inumPointsY', + description: 'number of points that each dimension of the HVS cube (or square in case of two-dimensional HVS; or line in case of one-dimensional HVS) is made up.', + type: 'initialization' + }, + { + name: 'iOutTab', + description: 'number of the table receiving the set of output-parameter instant values of the HVS. The total amount of parameters is defined by the _inumParms_ argument.', + type: 'initialization' + }, + { + name: 'iPositionsTab', + description: 'a table filled with the individual positions of snapshots in the HVS matrix (see below for more information).', + type: 'initialization' + }, + { + name: 'iSnapTab', + description: 'a table filled with all the snapshots. Each snapshot is made up of a set of parameter values. The amount of elements contained in each snapshots is specified by the _inumParms_ argument. The set of elements of each snapshot follows (and is adjacent) to the previous one in this table. So the total size of this table should be >= to _inumParms_ multiplied the number of snapshots you intend to store for the HVS.', + type: 'initialization' + }, + { + name: 'iConfigTab', + description: '(optional) a table containing the behavior of the HVS for each parameter. If the value of _iConfigTab_ is zero (default), this argument is ignored, meaning that each parameter is treated with linear interpolation by the HVS. If _iConfigTab_ is different than zero, then it must refer to an existing table whose contents are in its turn referring to a particolar kind of interpolation. In this table, a value of -1 indicates that corresponding parameter is leaved unchanged (ignored) by the HVS; a value of zero indicates that corresponding parameter is treated with linear-interpolation; each other values must be integer numbers indicating an existing table filled with a shape which will determine the kind of special interpolation to be used (table-based interpolation).', + type: 'initialization' + }, + { + name: 'kx', + description: 'these are externally-modified variables which controls the motion of the pointer in the HVS matrix cube (or square or line in case of HVS matrices made up of less than 3 dimensions). The range of these input arguments must be 0 to 1.', + type: 'performance' + }, + { + name: 'ky', + description: 'these are externally-modified variables which controls the motion of the pointer in the HVS matrix cube (or square or line in case of HVS matrices made up of less than 3 dimensions). The range of these input arguments must be 0 to 1.', + type: 'performance' + }, + ], + seeAlso: ['Hyper Vectorial Synthesis'] +}, +{ + name: 'hvs3', + type: 'opcode', + category: 'Signal Generators:Hyper Vectorial Synthesis', + description: 'Allows three-dimensional Hyper Vectorial Synthesis (HVS) controlled by externally-updated k-variables.', + syntax: 'hvs3(kx, ky, kz, inumParms, inumPointsX, inumPointsY, inumPointsZ, iOutTab, \\\n iPositionsTab, iSnapTab [, iConfigTab])', + parameters: [ + { + name: 'inumParms', + description: 'number of parameters controlled by the HVS. Each HVS snapshot is made up of _inumParms_ elements.', + type: 'initialization' + }, + { + name: 'inumPointsX', + description: 'number of points that each dimension of the HVS cube (or square in case of two-dimensional HVS; or line in case of one-dimensional HVS) is made up.', + type: 'initialization' + }, + { + name: 'inumPointsY', + description: 'number of points that each dimension of the HVS cube (or square in case of two-dimensional HVS; or line in case of one-dimensional HVS) is made up.', + type: 'initialization' + }, + { + name: 'inumPointsZ', + description: 'number of points that each dimension of the HVS cube (or square in case of two-dimensional HVS; or line in case of one-dimensional HVS) is made up.', + type: 'initialization' + }, + { + name: 'iOutTab', + description: 'number of the table receiving the set of output-parameter instant values of the HVS. The total amount of parameters is defined by the _inumParms_ argument.', + type: 'initialization' + }, + { + name: 'iPositionsTab', + description: 'a table filled with the individual positions of snapshots in the HVS matrix (see below for more information).', + type: 'initialization' + }, + { + name: 'iSnapTab', + description: 'a table filled with all the snapshots. Each snapshot is made up of a set of parameter values. The amount of elements contained in each snapshots is specified by the _inumParms_ argument. The set of elements of each snapshot follows (and is adjacent) to the previous one in this table. So the total size of this table should be >= to _inumParms_ multiplied the number of snapshots you intend to store for the HVS.', + type: 'initialization' + }, + { + name: 'iConfigTab', + description: '(optional) a table containing the behavior of the HVS for each parameter. If the value of _iConfigTab_ is zero (default), this argument is ignored, meaning that each parameter is treated with linear interpolation by the HVS. If _iConfigTab_ is different than zero, then it must refer to an existing table whose contents are in its turn referring to a particolar kind of interpolation. In this table, a value of -1 indicates that corresponding parameter is leaved unchanged (ignored) by the HVS; a value of zero indicates that corresponding parameter is treated with linear-interpolation; each other values must be integer numbers indicating an existing table filled with a shape which will determine the kind of special interpolation to be used (table-based interpolation).', + type: 'initialization' + }, + { + name: 'kx', + description: 'these are externally-modified variables which controls the motion of the pointer in the HVS matrix cube (or square or line in case of HVS matrices made up of less than 3 dimensions). The range of these input arguments must be 0 to 1.', + type: 'performance' + }, + { + name: 'ky', + description: 'these are externally-modified variables which controls the motion of the pointer in the HVS matrix cube (or square or line in case of HVS matrices made up of less than 3 dimensions). The range of these input arguments must be 0 to 1.', + type: 'performance' + }, + { + name: 'kz', + description: 'these are externally-modified variables which controls the motion of the pointer in the HVS matrix cube (or square or line in case of HVS matrices made up of less than 3 dimensions). The range of these input arguments must be 0 to 1.', + type: 'performance' + }, + ], + seeAlso: ['Hyper Vectorial Synthesis'] +}, +] diff --git a/src/lib/csound-reference/signal-generators-linear-and-exponential-generators.ts b/src/lib/csound-reference/signal-generators-linear-and-exponential-generators.ts new file mode 100644 index 0000000..d8a1e5b --- /dev/null +++ b/src/lib/csound-reference/signal-generators-linear-and-exponential-generators.ts @@ -0,0 +1,771 @@ +import type { CsoundReference } from './types' + +// Signal Generators:Linear and Exponential Generators +export const signalGeneratorsLinearAndExponentialGenerators: CsoundReference[] = [ +{ + name: 'bpf', + type: 'opcode', + category: 'Signal Generators:Linear and Exponential Generators', + description: 'Break point function with linear interpolation.', + syntax: 'ky = bpf(kx, kx1, ky1, kx2, ..., kxn, kyn)\n iy = bpf(ix, ix1, iy1, ix2, ..., ixn, iyn)\n kys[] = bpf(kxs[], kx1, ky1, kx2, ..., kxn, kyn)\n iys[] = bpf(ixs[], ix1, iy1, ix2, ..., ixn, iyn)\n ky = bpf(kx, kxs[], kys[])\n iy = bpf(ix, ixs[], iys[])\n ay = bpf(ax, kx1, ky1, kx2, ..., kxn, kyn)\n ay = bpf(ax, kxs[], kys[])\n ky, kw = bpf(kx, kxs[], kys[], kws[])', + example: '--8<-- "examples/bpf.csd"', + parameters: [ + { + name: 'kx', + description: 'Input value', + type: 'performance' + }, + { + name: 'kxn', + description: 'Defines a breakpoint. Can be changed at krate, but all _kx_s must be sorted.', + type: 'performance' + }, + { + name: 'kyn', + description: 'Defines a breakpoint. Can be changed at krate, but all _kx_s must be sorted.', + type: 'performance' + }, + ], + seeAlso: ['Linear and Exponential Generators'] +}, +{ + name: 'bpfcos', + type: 'opcode', + category: 'Signal Generators:Linear and Exponential Generators', + description: 'Break point function with cosine (easy-in/easy-out) interpolation.', + syntax: 'ky = bpfcos(kx, kx1, ky1, kx2, ..., kxn, kyn)\n kys[] = bpfcos(kxs[], kx1, ky1, kx2, ..., kxn, kyn)\n ky = bpfcos(kx, kxs[], kys[])\n ky = bpfcos(kx, ixs[], iys[])\n ky, kz = bpfcos(kx, kxs[], kys[], kzs[])\n ky, kz = bpfcos(kx, ixs[], iys[], izs[])', + example: '--8<-- "examples/bpfcos.csd"', + parameters: [ + { + name: 'kx', + description: 'Input value. Can also be an array', + type: 'performance' + }, + { + name: 'kxn', + description: 'Defines a breakpoint. Can be changed at krate, but all _kx_s must be sorted', + type: 'performance' + }, + { + name: 'kyn', + description: 'Defines a breakpoint. Can be changed at krate, but all _kx_s must be sorted', + type: 'performance' + }, + ], + seeAlso: ['Linear and Exponential Generators'] +}, +{ + name: 'cosseg', + type: 'opcode', + category: 'Signal Generators:Linear and Exponential Generators', + description: 'Trace a series of line segments between specified points with cosine interpolation.', + syntax: 'ares = cosseg(ia, idur1, ib [, idur2] [, ic] [...])\n kres = cosseg(ia, idur1, ib [, idur2] [, ic] [...])', + example: '--8<-- "examples/cosseg.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'ia', + description: 'starting value.', + type: 'initialization' + }, + { + name: 'idur1', + description: 'duration in seconds of first segment. A zero or negative value will cause all initialization to be skipped.', + type: 'initialization' + }, + ], + seeAlso: ['Linear and Exponential Generators'] +}, +{ + name: 'cossegb', + type: 'opcode', + category: 'Signal Generators:Linear and Exponential Generators', + description: 'Trace a series of line segments between specified absolute points with cosine interpolation.', + syntax: 'ares = cossegb(ia, itim1, ib [, itim2] [, ic] [...])\n kres = cossegb(ia, itim1, ib [, itim2] [, ic] [...])', + example: '--8<-- "examples/cossegb.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'ia', + description: 'starting value.', + type: 'initialization' + }, + { + name: 'itim1', + description: 'time in seconds of end of first segment. A zero or negative value will cause all initialization to be skipped.', + type: 'initialization' + }, + ], + seeAlso: ['Linear and Exponential Generators'] +}, +{ + name: 'cossegr', + type: 'opcode', + category: 'Signal Generators:Linear and Exponential Generators', + description: 'Trace a series of line segments between specified points with cosine interpolation, including a release segment.', + syntax: 'ares = cossegr(ia, idur1, ib [, idur2] [, ic] [...], irel, iz)\n kres = cossegr(ia, idur1, ib [, idur2] [, ic] [...], irel, iz)', + example: '--8<-- "examples/cossegr.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'ia', + description: 'starting value.', + type: 'initialization' + }, + { + name: 'idur1', + description: 'duration in seconds of first segment. A zero or negative value will cause all initialization to be skipped.', + type: 'initialization' + }, + { + name: 'irel', + description: 'duration in seconds and final value of a note releasing segment.', + type: 'initialization' + }, + { + name: 'iz', + description: 'duration in seconds and final value of a note releasing segment.', + type: 'initialization' + }, + ], + seeAlso: ['Linear and Exponential Generators'] +}, +{ + name: 'expcurve', + type: 'opcode', + category: 'Signal Generators:Linear and Exponential Generators', + description: 'Generates a normalised exponential curve in range 0 to 1 of arbitrary steepness.', + syntax: 'kout = expcurve(kindex, ksteepness)', + example: '--8<-- "examples/expcurve.csd"', + parameters: [ + { + name: 'kindex', + description: 'Index value. Expected range 0 to 1.', + type: 'performance' + }, + { + name: 'ksteepness', + description: 'Steepness of the generated curve. Values closer to 1.0 result in a straighter line while larger values steepen the curve.', + type: 'performance' + }, + { + name: 'kout', + description: 'Scaled output.', + type: 'performance' + }, + ], + seeAlso: ['Linear and Exponential Generators'] +}, +{ + name: 'expon', + type: 'opcode', + category: 'Signal Generators:Linear and Exponential Generators', + description: 'Trace an exponential curve between specified points.', + syntax: 'ares = expon(ia, idur, ib)\n kres = expon(ia, idur, ib)', + example: '--8<-- "examples/expon.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'ia', + description: 'starting value. Zero is illegal for exponentials.', + type: 'initialization' + }, + { + name: 'ib', + description: 'value after _idur_ seconds. For exponentials, must be non-zero and must agree in sign with _ia_.', + type: 'initialization' + }, + { + name: 'idur', + description: 'duration in seconds of the segment. A zero or negative value will cause all initialization to be skipped.', + type: 'initialization' + }, + ], + seeAlso: ['Linear and Exponential Generators'] +}, +{ + name: 'expseg', + type: 'opcode', + category: 'Signal Generators:Linear and Exponential Generators', + description: 'Trace a series of exponential segments between specified points.', + syntax: 'ares = expseg(ia, idur1, ib [, idur2] [, ic] [...])\n kres = expseg(ia, idur1, ib [, idur2] [, ic] [...])', + example: '--8<-- "examples/expseg.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'ia', + description: 'starting value. Zero is illegal for exponentials.', + type: 'initialization' + }, + { + name: 'idur1', + description: 'duration in seconds of first segment. A zero or negative value will cause all initialization to be skipped.', + type: 'initialization' + }, + ], + seeAlso: ['Linear and Exponential Generators'] +}, +{ + name: 'expsega', + type: 'opcode', + category: 'Signal Generators:Linear and Exponential Generators', + description: 'An exponential segment generator operating at a-rate.', + syntax: 'ares = expsega(ia, idur1, ib [, idur2] [, ic] [...])', + example: '--8<-- "examples/expsega.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'ia', + description: 'starting value. Zero is illegal.', + type: 'initialization' + }, + { + name: 'idur1', + description: 'duration in seconds of first segment. A zero or negative value will cause all initialization to be skipped.', + type: 'initialization' + }, + ], + seeAlso: ['Linear and Exponential Generators'] +}, +{ + name: 'expsegb', + type: 'opcode', + category: 'Signal Generators:Linear and Exponential Generators', + description: 'Trace a series of exponential segments between specified absolute points.', + syntax: 'ares = expsegb(ia, itim1, ib [, itim2] [, ic] [...])\n kres = expsegb(ia, itim1, ib [, itim2] [, ic] [...])', + example: '--8<-- "examples/expsegb.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'ia', + description: 'starting value. Zero is illegal for exponentials.', + type: 'initialization' + }, + { + name: 'itim1', + description: 'time in seconds of end of first segment.', + type: 'initialization' + }, + ], + seeAlso: ['Linear and Exponential Generators'] +}, +{ + name: 'expsegba', + type: 'opcode', + category: 'Signal Generators:Linear and Exponential Generators', + description: 'An exponential segment generator operating at a-rate with absolute times.', + syntax: 'ares = expsegba(ia, itim1, ib [, itim2] [, ic] [...])', + example: '--8<-- "examples/expsegba.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'ia', + description: 'starting value. Zero is illegal.', + type: 'initialization' + }, + { + name: 'itim1', + description: 'time in seconds at end of first segment.', + type: 'initialization' + }, + ], + seeAlso: ['Linear and Exponential Generators'] +}, +{ + name: 'expsegr', + type: 'opcode', + category: 'Signal Generators:Linear and Exponential Generators', + description: 'Trace a series of exponential segments between specified points including a release segment.', + syntax: 'ares = expsegr(ia, idur1, ib [, idur2] [, ic] [...], irel, iz)\n kres = expsegr(ia, idur1, ib [, idur2] [, ic] [...], irel, iz)', + example: '--8<-- "examples/expsegr.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'ia', + description: 'starting value. Zero is illegal for exponentials.', + type: 'initialization' + }, + { + name: 'idur1', + description: 'duration in seconds of first segment. A zero or negative value will cause all initialization to be skipped.', + type: 'initialization' + }, + { + name: 'irel', + description: 'duration in seconds and final value of a note releasing segment.', + type: 'initialization' + }, + { + name: 'iz', + description: 'duration in seconds and final value of a note releasing segment.', + type: 'initialization' + }, + ], + seeAlso: ['Linear and Exponential Generators'] +}, +{ + name: 'gainslider', + type: 'opcode', + category: 'Signal Generators:Linear and Exponential Generators', + description: 'An implementation of a logarithmic gain curve which is similar to the gainslider~ object from Cycling 74 Max / MSP.', + syntax: 'kout = gainslider(kindex)', + example: '--8<-- "examples/gainslider.csd"', + parameters: [ + { + name: 'kindex', + description: 'Index value. Nominal range from 0-127. For example a range of 0-152 will give you a range from -∞ to +18.0 dB.', + type: 'performance' + }, + { + name: 'kout', + description: 'Scaled output.', + type: 'performance' + }, + ], + seeAlso: ['Linear and Exponential Generators'] +}, +{ + name: 'lincos', + type: 'opcode', + category: 'Signal Generators:Linear and Exponential Generators', + description: 'Linear to cosine interpolation.', + syntax: 'ky = lincos(kx, ky0, ky1 [, kx0, kx1 ])\n iy = lincos(ix, iy0, iy1 [, ix0, ix1 ])', + example: '--8<-- "examples/lincos.csd"', + parameters: [ + { + name: 'kx', + description: 'Input signal', + type: 'performance' + }, + { + name: 'ky0', + description: 'Lower limit of output range', + type: 'performance' + }, + { + name: 'ky1', + description: 'Higher limit of output range', + type: 'performance' + }, + { + name: 'kx0', + description: 'Lower limit of input range (default = 0)', + type: 'performance' + }, + { + name: 'kx1', + description: 'Higher limit of input range (default = 1)', + type: 'performance' + }, + ], + seeAlso: ['Linear and Exponential Generators'] +}, +{ + name: 'line', + type: 'opcode', + category: 'Signal Generators:Linear and Exponential Generators', + description: 'Trace a straight line between specified points.', + syntax: 'ares = line(ia, idur, ib)\n kres = line(ia, idur, ib)', + example: '--8<-- "examples/line.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'ia', + description: 'starting value.', + type: 'initialization' + }, + { + name: 'ib', + description: 'value after _idur_ seconds.', + type: 'initialization' + }, + { + name: 'idur', + description: 'duration in seconds of segment. A zero or negative value will cause all initialization to be skipped.', + type: 'initialization' + }, + ], + seeAlso: ['Linear and Exponential Generators'] +}, +{ + name: 'linlin', + type: 'opcode', + category: 'Signal Generators:Linear and Exponential Generators', + description: 'Linear to linear interpolation.', + syntax: 'ky = linlin(kx, ky0, ky1 [, kx0, kx1 ])\n iy = linlin(ix, iy0, iy1 [, ix0, ix1 ])\n kys[] = linlin(kxs[], ky0, ky1 [, kx0, kx1 ])\n iys[] = linlin(ixs[], ky0, ky1, [ kx0, kx1 ])\n kC[] = linlin(kx, kA[], kB[] [, kx0, kx1 ])', + example: '--8<-- "examples/linlin.csd"', + parameters: [ + { + name: 'kx', + description: 'Input signal', + type: 'performance' + }, + { + name: 'kx0', + description: 'Lower limit of input range. _Defaults to 0_', + type: 'performance' + }, + { + name: 'kx1', + description: 'Higher limit of input range. _Defaults to 1_', + type: 'performance' + }, + { + name: 'ky0', + description: 'Lower limit of output range', + type: 'performance' + }, + { + name: 'ky1', + description: 'Higher limit of output range', + type: 'performance' + }, + ], + seeAlso: ['Linear and Exponential Generators'] +}, +{ + name: 'linseg', + type: 'opcode', + category: 'Signal Generators:Linear and Exponential Generators', + description: 'Trace a series of line segments between specified points.', + syntax: 'ares = linseg(ia, idur1, ib [, idur2] [, ic] [...])\n kres = linseg(ia, idur1, ib [, idur2] [, ic] [...])', + example: '--8<-- "examples/linseg.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'ia', + description: 'starting value.', + type: 'initialization' + }, + { + name: 'idur1', + description: 'duration in seconds of first segment. A zero or negative value will cause all initialization to be skipped.', + type: 'initialization' + }, + ], + seeAlso: ['Linear and Exponential Generators'] +}, +{ + name: 'linsegb', + type: 'opcode', + category: 'Signal Generators:Linear and Exponential Generators', + description: 'Trace a series of line segments between specified absolute points.', + syntax: 'ares = linsegb(ia, itim1, ib [, itim2] [, ic] [...])\n kres = linsegb(ia, itim1, ib [, itim2] [, ic] [...])', + example: '--8<-- "examples/linsegb.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'ia', + description: 'starting value.', + type: 'initialization' + }, + { + name: 'itim1', + description: 'time in seconds of end of first segment. A zero or negative value will cause all initialization to be skipped.', + type: 'initialization' + }, + ], + seeAlso: ['Linear and Exponential Generators'] +}, +{ + name: 'linsegr', + type: 'opcode', + category: 'Signal Generators:Linear and Exponential Generators', + description: 'Trace a series of line segments between specified points including a release segment.', + syntax: 'ares = linsegr(ia, idur1, ib [, idur2] [, ic] [...], irel, iz)\n kres = linsegr(ia, idur1, ib [, idur2] [, ic] [...], irel, iz)', + example: '--8<-- "examples/linsegr.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'ia', + description: 'starting value.', + type: 'initialization' + }, + { + name: 'idur1', + description: 'duration in seconds of first segment. A zero or negative value will cause all initialization to be skipped.', + type: 'initialization' + }, + { + name: 'irel', + description: 'duration in seconds and final value of a note releasing segment.', + type: 'initialization' + }, + { + name: 'iz', + description: 'duration in seconds and final value of a note releasing segment.', + type: 'initialization' + }, + ], + seeAlso: ['Linear and Exponential Generators'] +}, +{ + name: 'logcurve', + type: 'opcode', + category: 'Signal Generators:Linear and Exponential Generators', + description: 'This opcode implements a formula for generating a normalised logarithmic curve in range 0 - 1. It is based on the Max / MSP work of Eric Singer (c) 1994.', + syntax: 'kout = logcurve(kindex, ksteepness)', + example: '--8<-- "examples/logcurve.csd"', + parameters: [ + { + name: 'kindex', + description: 'Index value. Expected range 0 to 1.', + type: 'performance' + }, + { + name: 'ksteepness', + description: 'Steepness of the generated curve. Values closer to 1.0 result in a straighter line while larger values steepen the curve.', + type: 'performance' + }, + { + name: 'kout', + description: 'Scaled output.', + type: 'performance' + }, + ], + seeAlso: ['Linear and Exponential Generators'] +}, +{ + name: 'loopseg', + type: 'opcode', + category: 'Signal Generators:Linear and Exponential Generators', + description: 'Generate control signal consisting of linear segments delimited by two or more specified points.', + syntax: 'ksig = loopseg(kfreq, ktrig, iphase, kvalue0, ktime0 [, kvalue1] [, ktime1] \\\n [, kvalue2] [, ktime2][...])', + example: '--8<-- "examples/loopseg.csd"', + parameters: [ + { + name: 'iphase', + description: 'A value between 0 and 1 to say where to start the loop. Zero, the commonest value, indicates the beginning.', + type: 'initialization' + }, + { + name: 'ksig', + description: 'Output signal.', + type: 'performance' + }, + { + name: 'kfreq', + description: 'Repeat rate in Hz or fraction of Hz.', + type: 'performance' + }, + { + name: 'ktrig', + description: 'If non-zero, retriggers the envelope from start (see [trigger opcode](../opcodes/trigger.md)), before the envelope cycle is completed.', + type: 'performance' + }, + ], + seeAlso: ['Linear and Exponential Generators'] +}, +{ + name: 'loopsegp', + type: 'opcode', + category: 'Signal Generators:Linear and Exponential Generators', + description: 'Control signals based on linear segments.', + syntax: 'ksig = loopsegp(kphase, kvalue0, kdur0, kvalue1 \\\n [, kdur1, ... , kdurN-1, kvalueN])', + example: '--8<-- "examples/loopsegp.csd"', + parameters: [ + { + name: 'ksig', + description: 'output signal', + type: 'performance' + }, + { + name: 'kphase', + description: 'point of the sequence read, expressed as a fraction of a cycle (0 to 1)', + type: 'performance' + }, + { + name: 'kvalueN', + description: 'values of points', + type: 'performance' + }, + ], + seeAlso: ['Linear and Exponential Generators'] +}, +{ + name: 'looptseg', + type: 'opcode', + category: 'Signal Generators:Linear and Exponential Generators', + description: 'Generate control signal consisting of exponential or linear segments delimited by two or more specified points.', + syntax: 'ksig = looptseg(kfreq, ktrig, iphase, kvalue0, ktype0, ktime0, [, kvalue1] \\\n [,ktype1] [, ktime1] [, kvalue2] [,ktype2] [, ktime2] [...] \\\n [, kvalueN] [,ktypeN] [, ktimeN])', + example: '--8<-- "examples/looptseg.csd"', + parameters: [ + { + name: 'iphase', + description: 'A value between 0 and 1 to say where to start the loop. Zero, the commonest value, indicates the beginning.', + type: 'initialization' + }, + { + name: 'ksig', + description: 'Output signal.', + type: 'performance' + }, + { + name: 'kfreq', + description: 'Repeat rate in Hz or fraction of Hz.', + type: 'performance' + }, + { + name: 'ktrig', + description: 'If non-zero, retriggers the envelope from start (see [trigger opcode](../opcodes/trigger.md)), before the envelope cycle is completed.', + type: 'performance' + }, + ], + seeAlso: ['Linear and Exponential Generators'] +}, +{ + name: 'loopxseg', + type: 'opcode', + category: 'Signal Generators:Linear and Exponential Generators', + description: 'Generate control signal consisting of exponential segments delimited by two or more specified points.', + syntax: 'ksig = loopxseg(kfreq, ktrig, iphase, kvalue0, ktime0 [, kvalue1] [, ktime1] \\\n [, kvalue2] [, ktime2] [...])', + example: '--8<-- "examples/loopxseg.csd"', + parameters: [ + { + name: 'ksig', + description: 'Output signal.', + type: 'performance' + }, + { + name: 'kfreq', + description: 'Repeat rate in Hz or fraction of Hz.', + type: 'performance' + }, + { + name: 'ktrig', + description: 'If non-zero, retriggers the envelope from start (see [trigger opcode](../opcodes/trigger.md)), before the envelope cycle is completed.', + type: 'performance' + }, + { + name: 'iphase', + description: 'A value between 0 and 1 to say where to start the loop. Zero, the commonest value, indicates the beginning.', + type: 'performance' + }, + ], + seeAlso: ['Linear and Exponential Generators'] +}, +{ + name: 'lpshold', + type: 'opcode', + category: 'Signal Generators:Linear and Exponential Generators', + description: 'Generate control signal consisting of held segments.', + syntax: 'ksig = lpshold(kfreq, ktrig, iphase, kvalue0, ktime0 [, kvalue1] [, ktime1] \\\n [, kvalue2] [, ktime2] [...])', + example: '--8<-- "examples/lpshold.csd"', + parameters: [ + { + name: 'ksig', + description: 'Output signal', + type: 'performance' + }, + { + name: 'kfreq', + description: 'Repeat rate in Hz or fraction of Hz', + type: 'performance' + }, + { + name: 'ktrig', + description: 'If non-zero, retriggers the envelope from start (see [trigger opcode](../opcodes/trigger.md)), before the envelope cycle is completed.', + type: 'performance' + }, + { + name: 'iphase', + description: 'A vaue between 0 and 1 to say where to start the loop. Zero, the commonest value, indicates the beginning.', + type: 'performance' + }, + ], + seeAlso: ['Linear and Exponential Generators'] +}, +{ + name: 'lpsholdp', + type: 'opcode', + category: 'Signal Generators:Linear and Exponential Generators', + description: 'Control signals based on held segments.', + syntax: 'ksig = lpsholdp(kphase, kvalue0, ktime0 [, kvalue1] [, ktime1] \\\n [, kvalue2] [, ktime2] [...])', + example: '--8<-- "examples/lpsholdp.csd"', + parameters: [ + { + name: 'ksig', + description: 'output signal', + type: 'performance' + }, + { + name: 'kphase', + description: 'point of the sequence read, expressed as a fraction of a cycle (0 to 1)', + type: 'performance' + }, + ], + seeAlso: ['Linear and Exponential Generators'] +}, +{ + name: 'scale', + type: 'opcode', + category: 'Signal Generators:Linear and Exponential Generators', + description: 'Arbitrary signal scaling.', + syntax: 'kscl = scale(kinput, kmax, kmin[, kimax, kimin])', + example: '--8<-- "examples/scale.csd"', + parameters: [ + { + name: 'kin', + description: 'Input value. Can originate from any k-rate source as long as that source\'s output is in range', + type: 'performance' + }, + { + name: 'kmin', + description: 'Minimum value of the resultant scale operation.', + type: 'performance' + }, + { + name: 'kmax', + description: 'Maximum value of the resultant scale operation.', + type: 'performance' + }, + { + name: 'kimin', + description: 'Optional; Minimum of the incoming value range, defaulting to zero.', + type: 'performance' + }, + { + name: 'kimax', + description: 'Optional; Maximum of the incoming value range, defaulting to one.', + type: 'performance' + }, + ], + seeAlso: ['Linear and Exponential Generators'] +}, +{ + name: 'scale2', + type: 'opcode', + category: 'Signal Generators:Linear and Exponential Generators', + description: 'Arbitrary signal scaling with optional smoothing.', + syntax: 'kscl = scale2(kinput, kmin, kmax[, kimin, kimax][ihtime])', + example: '--8<-- "examples/scale2.csd"', + parameters: [ + { + name: 'kin', + description: 'Input value. Can originate from any k-rate source and should be in the range _kimin_ to _kimax_. If it is larger than kimax it is treated as kimax, and if less than kimin then it is treated as kimin.', + type: 'performance' + }, + { + name: 'kmin', + description: 'Minimum value of the resultant scale operation.', + type: 'performance' + }, + { + name: 'kmax', + description: 'Maximum value of the resultant scale operation.', + type: 'performance' + }, + { + name: 'kimin', + description: 'Optional; Minimum of the incoming value range, defaulting to zero.', + type: 'performance' + }, + { + name: 'kimax', + description: 'Optional; Maximum of the incoming value range, defaulting to one.', + type: 'performance' + }, + ], + seeAlso: ['Linear and Exponential Generators'] +}, +] diff --git a/src/lib/csound-reference/signal-generators-models-and-emulations.ts b/src/lib/csound-reference/signal-generators-models-and-emulations.ts new file mode 100644 index 0000000..f93b55a --- /dev/null +++ b/src/lib/csound-reference/signal-generators-models-and-emulations.ts @@ -0,0 +1,1002 @@ +import type { CsoundReference } from './types' + +// Signal Generators:Models and Emulations +export const signalGeneratorsModelsAndEmulations: CsoundReference[] = [ +{ + name: 'bamboo', + type: 'opcode', + category: 'Signal Generators:Models and Emulations', + description: 'Semi-physical model of a bamboo sound.', + syntax: 'ares = bamboo(kamp, idettack [, inum] [, idamp] [, imaxshake] [, ifreq] \\\n [, ifreq1] [, ifreq2])', + example: '--8<-- "examples/bamboo-modern.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'idettack', + description: 'period of time over which all sound is stopped', + type: 'initialization' + }, + { + name: 'kamp', + description: 'Amplitude of output. Note: As these instruments are stochastic, this is only an approximation.', + type: 'performance' + }, + ], + seeAlso: ['Models and Emulations'] +}, +{ + name: 'barmodel', + type: 'opcode', + category: 'Signal Generators:Models and Emulations', + description: 'Creates a tone similar to a struck metal bar.', + syntax: 'ares = barmodel(kbcL, kbcR, iK, ib, kscan, iT30, ipos, ivel, iwid)', + example: '--8<-- "examples/barmodel-modern.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'iK', + description: 'dimensionless stiffness parameter. If this parameter is negative then the initialisation is skipped and the previous state of the bar is continued.', + type: 'initialization' + }, + { + name: 'ib', + description: 'high-frequency loss parameter (keep this small).', + type: 'initialization' + }, + { + name: 'iT30', + description: '30 db decay time in seconds.', + type: 'initialization' + }, + { + name: 'ipos', + description: 'position along the bar that the strike occurs.', + type: 'initialization' + }, + { + name: 'ivel', + description: 'normalized strike velocity.', + type: 'initialization' + }, + { + name: 'iwid', + description: 'spatial width of strike.', + type: 'initialization' + }, + { + name: 'kbcL', + description: 'Boundary condition at left end of bar (1 is clamped, 2 pivoting and 3 free).', + type: 'performance' + }, + { + name: 'kbcR', + description: 'Boundary condition at right end of bar (1 is clamped, 2 pivoting and 3 free).', + type: 'performance' + }, + { + name: 'kscan', + description: 'Speed of scanning the output location.', + type: 'performance' + }, + ], + seeAlso: ['Models and Emulations'] +}, +{ + name: 'cabasa', + type: 'opcode', + category: 'Signal Generators:Models and Emulations', + description: 'Semi-physical model of a cabasa sound.', + syntax: 'ares = cabasa(iamp, idettack [, inum] [, idamp] [, imaxshake])', + example: '--8<-- "examples/cabasa-modern.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'iamp', + description: 'Amplitude of output. Note: As these instruments are stochastic, this is only a approximation.', + type: 'initialization' + }, + { + name: 'idettack', + description: 'period of time over which all sound is stopped', + type: 'initialization' + }, + ], + seeAlso: ['Models and Emulations'] +}, +{ + name: 'crunch', + type: 'opcode', + category: 'Signal Generators:Models and Emulations', + description: 'Semi-physical model of a crunch sound.', + syntax: 'ares = crunch(iamp, idettack [, inum] [, idamp] [, imaxshake])', + example: '--8<-- "examples/crunch.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'iamp', + description: 'Amplitude of output. Note: As these instruments are stochastic, this is only a approximation.', + type: 'initialization' + }, + { + name: 'idettack', + description: 'period of time over which all sound is stopped', + type: 'initialization' + }, + ], + seeAlso: ['Models and Emulations'] +}, +{ + name: 'dripwater', + type: 'opcode', + category: 'Signal Generators:Models and Emulations', + description: 'Semi-physical model of a water drop.', + syntax: 'ares = dripwater(kamp, idettack [, inum] [, idamp] [, imaxshake] [, ifreq] \\\n [, ifreq1] [, ifreq2])', + example: '--8<-- "examples/dripwater.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'idettack', + description: 'period of time over which all sound is stopped', + type: 'initialization' + }, + { + name: 'kamp', + description: 'Amplitude of output. Note: As these instruments are stochastic, this is only an approximation.', + type: 'performance' + }, + ], + seeAlso: ['Models and Emulations'] +}, +{ + name: 'fareylen', + type: 'opcode', + category: 'Signal Generators:Models and Emulations', + description: 'Returns the length of a Farey Sequence.', + syntax: 'kfl = fareylen(kfn)', + example: '--8<-- "examples/fareylen.csd"', + parameters: [ + { + name: 'kfn', + description: 'Integer identifying the sequence.', + type: 'performance' + }, + ], + seeAlso: ['Models and Emulations'] +}, +{ + name: 'fareyleni', + type: 'opcode', + category: 'Signal Generators:Models and Emulations', + description: 'Returns the length of a Farey Sequence.', + syntax: 'ifl = fareyleni(ifn)', + example: '--8<-- "examples/fareyleni.csd"', + rates: ['i-rate'], + seeAlso: ['Models and Emulations'] +}, +{ + name: 'gendy', + type: 'opcode', + category: 'Signal Generators:Models and Emulations', + description: 'Dynamic stochastic approach to waveform synthesis conceived by Iannis Xenakis.', + syntax: 'ares = gendy(kamp, kampdist, kdurdist, kadpar, kddpar, kminfreq, kmaxfreq, \\\n kampscl, kdurscl [, initcps] [, knum])\n kres = gendy(kamp, kampdist, kdurdist, kadpar, kddpar, kminfreq, kmaxfreq, \\\n kampscl, kdurscl [, initcps] [, knum])', + example: '--8<-- "examples/gendy.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'kamp', + description: 'amplitude.', + type: 'performance' + }, + { + name: 'kampdist', + description: 'choice of probability distribution for the next perturbation of the amplitude of a control point. The valid distributions are:', + type: 'performance' + }, + { + name: 'kdurdist', + description: 'choice of distribution for the perturbation of the current inter control point duration. See _kampdist_ for the valid distributions. If _kdurdist_=6, the user can use an external k-rate signal through _kddpar_.', + type: 'performance' + }, + { + name: 'kadpar', + description: 'parameter for the _kampdist_ distribution. Should be in the range of 0.0001 to 1.', + type: 'performance' + }, + { + name: 'kddpar', + description: 'parameter for the _kdurdist_ distribution. Should be in the range of 0.0001 to 1.', + type: 'performance' + }, + { + name: 'kminfreq', + description: 'minimum allowed frequency of oscillation.', + type: 'performance' + }, + { + name: 'kmaxfreq', + description: 'maximum allowed frequency of oscillation.', + type: 'performance' + }, + { + name: 'kampscl', + description: 'multiplier for the distribution\'s delta value for amplitude (1.0 is full range).', + type: 'performance' + }, + { + name: 'kdurscl', + description: 'multiplier for the distribution\'s delta value for duration.', + type: 'performance' + }, + { + name: 'knum', + description: '1 segments and is repeated in the time. The vertexes (control points) are moved according to a stochastic action and they are limited within the boundaries of a mirror formed by an amplitude barrier and a time barrier.', + type: 'performance' + }, + ], + seeAlso: ['Models and Emulations', 'gendyc', 'gendyx'] +}, +{ + name: 'gendyc', + type: 'opcode', + category: 'Signal Generators:Models and Emulations', + description: 'Dynamic stochastic approach to waveform synthesis using cubic interpolation.', + syntax: 'ares = gendyc(kamp, kampdist, kdurdist, kadpar, kddpar, kminfreq, kmaxfreq, \\\n kampscl, kdurscl [, initcps] [, knum])\n kres = gendyc(kamp, kampdist, kdurdist, kadpar, kddpar, kminfreq, kmaxfreq, \\\n kampscl, kdurscl [, initcps] [, knum])', + example: '--8<-- "examples/gendyc.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'kamp', + description: 'amplitude.', + type: 'performance' + }, + { + name: 'kampdist', + description: 'choice of probability distribution for the next perturbation of the amplitude of a control point. The valid distributions are:', + type: 'performance' + }, + { + name: 'kdurdist', + description: 'choice of distribution for the perturbation of the current inter control point duration. See _kampdist_ for the valid distributions. If _kdurdist_=6, the user can use an external k-rate signal through _kddpar_.', + type: 'performance' + }, + { + name: 'kadpar', + description: 'parameter for the _kampdist_ distribution. Should be in the range of 0.0001 to 1.', + type: 'performance' + }, + { + name: 'kddpar', + description: 'parameter for the _kdurdist_ distribution. Should be in the range of 0.0001 to 1.', + type: 'performance' + }, + { + name: 'kminfreq', + description: 'minimum allowed frequency of oscillation.', + type: 'performance' + }, + { + name: 'kmaxfreq', + description: 'maximum allowed frequency of oscillation.', + type: 'performance' + }, + { + name: 'kampscl', + description: 'multiplier for the distribution\'s delta value for amplitude (1.0 is full range).', + type: 'performance' + }, + { + name: 'kdurscl', + description: 'multiplier for the distribution\'s delta value for duration.', + type: 'performance' + }, + { + name: 'knum', + description: '1 segments and is repeated in the time. The vertexes (control points) are moved according to a stochastic action and they are limited within the boundaries of a mirror formed by an amplitude barrier and a time barrier.', + type: 'performance' + }, + ], + seeAlso: ['Models and Emulations', 'gendy', 'gendyx'] +}, +{ + name: 'gendyx', + type: 'opcode', + category: 'Signal Generators:Models and Emulations', + description: 'Variation of the dynamic stochastic approach to waveform synthesis conceived by Iannis Xenakis.', + syntax: 'ares = gendyx(kamp, kampdist, kdurdist, kadpar, kddpar, kminfreq, kmaxfreq, \\\n kampscl, kdurscl, kcurveup, kcurvedown [, initcps] [, knum])\n kres = gendyx(kamp, kampdist, kdurdist, kadpar, kddpar, kminfreq, kmaxfreq, \\\n kampscl, kdurscl, kcurveup, kcurvedown [, initcps] [, knum])', + example: '--8<-- "examples/gendyx.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'kamp', + description: 'amplitude.', + type: 'performance' + }, + { + name: 'kampdist', + description: 'choice of probability distribution for the next perturbation of the amplitude of a control point. The valid distributions are:', + type: 'performance' + }, + { + name: 'kdurdist', + description: 'choice of distribution for the perturbation of the current inter control point duration. See _kampdist_ for the valid distributions. If _kdurdist_=6, the user can use an external k-rate signal through _kddpar_.', + type: 'performance' + }, + { + name: 'kadpar', + description: 'parameter for the _kampdist_ distribution. Should be in the range of 0.0001 to 1.', + type: 'performance' + }, + { + name: 'kddpar', + description: 'parameter for the _kdurdist_ distribution. Should be in the range of 0.0001 to 1.', + type: 'performance' + }, + { + name: 'kminfreq', + description: 'minimum allowed frequency of oscillation.', + type: 'performance' + }, + { + name: 'kmaxfreq', + description: 'maximum allowed frequency of oscillation.', + type: 'performance' + }, + { + name: 'kampscl', + description: 'multiplier for the distribution\'s delta value for amplitude (1.0 is full range).', + type: 'performance' + }, + { + name: 'kdurscl', + description: 'multiplier for the distribution\'s delta value for duration.', + type: 'performance' + }, + { + name: 'kcurveup', + description: 'controls the curve for the increasing amplitudes between two points; it has to be non negative.', + type: 'performance' + }, + { + name: 'kcurvedown', + description: 'controls the curve for the decreasing amplitudes between two points; it has to be non negative.', + type: 'performance' + }, + { + name: 'knum', + description: '1 curves and is repeated in the time. The vertexes (control points) are moved according to a stochastic action and they are limited within the boundaries of a mirror formed by an amplitude barrier and a time barrier.', + type: 'performance' + }, + ], + seeAlso: ['Models and Emulations', 'gendyc', 'gendy'] +}, +{ + name: 'gogobel', + type: 'opcode', + category: 'Signal Generators:Models and Emulations', + description: 'Audio output is a tone related to the striking of a cow bell or similar.', + syntax: 'ares = gogobel(kamp, kfreq, ihrd, ipos, imp, kvibf, kvamp, ivfn)', + example: '--8<-- "examples/gogobel.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'ihrd', + description: 'the hardness of the stick used in the strike. A range of 0 to 1 is used. 0.5 is a suitable value.', + type: 'initialization' + }, + { + name: 'ipos', + description: 'where the block is hit, in the range 0 to 1.', + type: 'initialization' + }, + { + name: 'imp', + description: 'a table of the strike impulses. The file [marmstk1.wav](../examples/marmstk1.wav) is a suitable function from measurements and can be loaded with a [GEN01](../scoregens/gen01.md) table. It is also available at [ftp://ftp.cs.bath.ac.uk/pub/dream/documentation/sounds/modelling/](ftp://ftp.cs.bath.ac.uk/pub/dream/documentation/sounds/modelling/).', + type: 'initialization' + }, + { + name: 'ivfn', + description: 'shape of vibrato, usually a sine table, created by a function.', + type: 'initialization' + }, + { + name: 'kamp', + description: 'Amplitude of note.', + type: 'performance' + }, + { + name: 'kfreq', + description: 'Frequency of note played.', + type: 'performance' + }, + { + name: 'kvibf', + description: 'frequency of vibrato in Hertz. Suggested range is 0 to 12', + type: 'performance' + }, + { + name: 'kvamp', + description: 'amplitude of the vibrato', + type: 'performance' + }, + ], + seeAlso: ['Models and Emulations'] +}, +{ + name: 'guiro', + type: 'opcode', + category: 'Signal Generators:Models and Emulations', + description: 'Semi-physical model of a guiro sound.', + syntax: 'ares = guiro(kamp, idettack [, inum] [, idamp] [, imaxshake] [, ifreq] [, ifreq1])', + example: '--8<-- "examples/guiro.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'idettack', + description: 'period of time over which all sound is stopped', + type: 'initialization' + }, + { + name: 'kamp', + description: 'Amplitude of output. Note: As these instruments are stochastic, this is only an approximation.', + type: 'performance' + }, + ], + seeAlso: ['Models and Emulations'] +}, +{ + name: 'lorenz', + type: 'opcode', + category: 'Signal Generators:Models and Emulations', + description: 'Implements the Lorenz system of equations.', + syntax: 'ax, ay, az = lorenz(ksv, krv, kbv, kh, ix, iy, iz, iskip [, iskipinit])', + example: '--8<-- "examples/lorenz.csd"', + parameters: [ + { + name: 'ix', + description: 'the initial coordinates of the particle.', + type: 'initialization' + }, + { + name: 'iy', + description: 'the initial coordinates of the particle.', + type: 'initialization' + }, + { + name: 'iz', + description: 'the initial coordinates of the particle.', + type: 'initialization' + }, + { + name: 'iskip', + description: 'used to skip generated values. If _iskip_ is set to 5, only every fifth value generated is output. This is useful in generating higher pitched tones.', + type: 'initialization' + }, + { + name: 'ksv', + description: 'the Prandtl number or sigma', + type: 'performance' + }, + { + name: 'krv', + description: 'the Rayleigh number', + type: 'performance' + }, + { + name: 'kbv', + description: 'the ratio of the length and width of the box in which the convection currents are generated', + type: 'performance' + }, + { + name: 'kh', + description: 'the step size used in approximating the differential equation. This can be used to control the pitch of the systems. Values of .1-.001 are typical.', + type: 'performance' + }, + ], + seeAlso: ['Models and Emulations'] +}, +{ + name: 'mandel', + type: 'opcode', + category: 'Signal Generators:Models and Emulations', + description: 'Mandelbrot set.', + syntax: 'kiter, koutrig = mandel( ktrig, kx, ky, kmaxIter)', + example: '--8<-- "examples/mandel.csd"', + parameters: [ + { + name: 'kiter', + description: 'number of iterations', + type: 'performance' + }, + { + name: 'koutrig', + description: 'output trigger signal', + type: 'performance' + }, + { + name: 'ktrig', + description: 'input trigger signal', + type: 'performance' + }, + { + name: 'kx', + description: 'coordinates of a given point belonging to the complex plane', + type: 'performance' + }, + { + name: 'ky', + description: 'coordinates of a given point belonging to the complex plane', + type: 'performance' + }, + { + name: 'kmaxIter', + description: 'maximum iterations allowed', + type: 'performance' + }, + ], + seeAlso: ['Models and Emulations'] +}, +{ + name: 'mandol', + type: 'opcode', + category: 'Signal Generators:Models and Emulations', + description: 'An emulation of a mandolin.', + syntax: 'ares = mandol(kamp, kfreq, kpluck, kdetune, kgain, ksize \\\n [, ifn] [, iminfreq])', + example: '--8<-- "examples/mandol.csd"', + rates: ['a-rate', 'k-rate', 'i-rate'], + parameters: [ + { + name: 'ifn', + description: 'table number containing the pluck wave form. The file [mandpluk.aiff](../examples/mandpluk.aiff) is suitable for this. It is also available at [ftp://ftp.cs.bath.ac.uk/pub/dream/documentation/sounds/modelling/](ftp://ftp.cs.bath.ac.uk/pub/dream/documentation/sounds/modelling/).', + type: 'initialization' + }, + { + name: 'kamp', + description: 'Amplitude of note.', + type: 'performance' + }, + { + name: 'kfreq', + description: 'Frequency of note played.', + type: 'performance' + }, + { + name: 'kpluck', + description: 'The pluck position, in range 0 to 1. Suggest 0.4.', + type: 'performance' + }, + { + name: 'kdetune', + description: 'The proportional detuning between the two strings. Suggested range 0.9 to 1.', + type: 'performance' + }, + { + name: 'kgain', + description: 'the loop gain of the model, in the range 0.97 to 1.', + type: 'performance' + }, + { + name: 'ksize', + description: 'The size of the body of the mandolin. Range 0 to 2.', + type: 'performance' + }, + ], + seeAlso: ['Models and Emulations'] +}, +{ + name: 'marimba', + type: 'opcode', + category: 'Signal Generators:Models and Emulations', + description: 'Physical model related to the striking of a wooden block as found in a marimba.', + syntax: 'ares = marimba(kamp, kfreq, ihrd, ipos, imp, kvibf, kvamp, ivibfn, idec \\\n [, idoubles] [, itriples])', + example: '--8<-- "examples/marimba.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'ihrd', + description: 'the hardness of the stick used in the strike. A range of 0 to 1 is used. 0.5 is a suitable value.', + type: 'initialization' + }, + { + name: 'ipos', + description: 'where the block is hit, in the range 0 to 1.', + type: 'initialization' + }, + { + name: 'imp', + description: 'a table of the strike impulses. The file [marmstk1.wav](../examples/marmstk1.wav) is a suitable function from measurements and can be loaded with a [GEN01](../scoregens/gen01.md) table. It is also available at [ftp://ftp.cs.bath.ac.uk/pub/dream/documentation/sounds/modelling/](ftp://ftp.cs.bath.ac.uk/pub/dream/documentation/sounds/modelling/).', + type: 'initialization' + }, + { + name: 'ivfn', + description: 'shape of vibrato, usually a sine table, created by a function', + type: 'initialization' + }, + { + name: 'idec', + description: 'time before end of note when damping is introduced', + type: 'initialization' + }, + { + name: 'kamp', + description: 'Amplitude of note.', + type: 'performance' + }, + { + name: 'kfreq', + description: 'Frequency of note played.', + type: 'performance' + }, + { + name: 'kvibf', + description: 'frequency of vibrato in Hertz. Suggested range is 0 to 12', + type: 'performance' + }, + { + name: 'kvamp', + description: 'amplitude of the vibrato', + type: 'performance' + }, + ], + seeAlso: ['Models and Emulations'] +}, +{ + name: 'moog', + type: 'opcode', + category: 'Signal Generators:Models and Emulations', + description: 'An emulation of a mini-Moog synthesizer.', + syntax: 'ares = moog(kamp, kfreq, kfiltq, kfiltrate, kvibf, kvamp, iafn, iwfn, ivfn)', + example: '--8<-- "examples/moog.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'iafn', + description: 'three table numbers containing the attack waveform (unlooped), the main looping wave form, and the vibrato waveform. The files [mandpluk.aiff](../examples/mandpluk.aiff) and [impuls20.aiff](../examples/impuls20.aiff) are suitable for the first two, and a sine wave for the last.', + type: 'initialization' + }, + { + name: 'iwfn', + description: 'three table numbers containing the attack waveform (unlooped), the main looping wave form, and the vibrato waveform. The files [mandpluk.aiff](../examples/mandpluk.aiff) and [impuls20.aiff](../examples/impuls20.aiff) are suitable for the first two, and a sine wave for the last.', + type: 'initialization' + }, + { + name: 'ivfn', + description: 'three table numbers containing the attack waveform (unlooped), the main looping wave form, and the vibrato waveform. The files [mandpluk.aiff](../examples/mandpluk.aiff) and [impuls20.aiff](../examples/impuls20.aiff) are suitable for the first two, and a sine wave for the last.', + type: 'initialization' + }, + { + name: 'kamp', + description: 'Amplitude of note.', + type: 'performance' + }, + { + name: 'kfreq', + description: 'Frequency of note played.', + type: 'performance' + }, + { + name: 'kfiltq', + description: 'Q of the filter, in the range 0.8 to 0.9', + type: 'performance' + }, + { + name: 'kfiltrate', + description: 'rate control for the filter in the range 0 to 0.0002', + type: 'performance' + }, + { + name: 'kvibf', + description: 'frequency of vibrato in Hertz. Suggested range is 0 to 12', + type: 'performance' + }, + { + name: 'kvamp', + description: 'amplitude of the vibrato', + type: 'performance' + }, + ], + seeAlso: ['Models and Emulations'] +}, +{ + name: 'planet', + type: 'opcode', + category: 'Signal Generators:Models and Emulations', + description: 'Simulates a planet orbiting in a binary star system.', + syntax: 'ax, ay, az = planet(kmass1, kmass2, ksep, ix, iy, iz, ivx, ivy, ivz, idelta \\\n [, ifriction] [, iskip])', + example: '--8<-- "examples/planet.csd"', + parameters: [ + { + name: 'ix', + description: 'the initial x, y and z coordinates of the planet', + type: 'initialization' + }, + { + name: 'iy', + description: 'the initial x, y and z coordinates of the planet', + type: 'initialization' + }, + { + name: 'iz', + description: 'the initial x, y and z coordinates of the planet', + type: 'initialization' + }, + { + name: 'ivx', + description: 'the initial velocity vector components for the planet.', + type: 'initialization' + }, + { + name: 'ivy', + description: 'the initial velocity vector components for the planet.', + type: 'initialization' + }, + { + name: 'ivz', + description: 'the initial velocity vector components for the planet.', + type: 'initialization' + }, + { + name: 'idelta', + description: 'the step size used to approximate the differential equation.', + type: 'initialization' + }, + { + name: 'ax', + description: 'the output x, y, and z coodinates of the planet', + type: 'performance' + }, + { + name: 'ay', + description: 'the output x, y, and z coodinates of the planet', + type: 'performance' + }, + { + name: 'az', + description: 'the output x, y, and z coodinates of the planet', + type: 'performance' + }, + { + name: 'ksep', + description: 'the separation between the two stars', + type: 'performance' + }, + { + name: 'kmass1', + description: 'the mass of the first star', + type: 'performance' + }, + { + name: 'kmass2', + description: 'the mass of the second star', + type: 'performance' + }, + ], + seeAlso: ['Models and Emulations', 'http://www.csoundjournal.com/issue9/FlutesInOrbit.html'] +}, +{ + name: 'prepiano', + type: 'opcode', + category: 'Signal Generators:Models and Emulations', + description: 'Creates a tone similar to a piano string prepared in a Cageian fashion.', + syntax: 'ares = prepiano(ifreq, iNS, iD, iK, iT30, iB, kbcl, kbcr, imass, ihvfreq, \\\n iinit, ipos, ivel, isfreq, isspread[, irattles, irubbers])\n al, ar = prepiano(ifreq, iNS, iD, iK, iT30, iB, kbcl, kbcr, imass, ihvfreq, \\\n iinit, ipos, ivel, isfreq, isspread[, irattles, irubbers])', + example: '--8<-- "examples/prepiano.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'ifreq', + description: 'The base frequency of the string.', + type: 'initialization' + }, + { + name: 'iNS', + description: 'the number of strings involved. In a real piano 1, 2 or 3 strings are found in different frequency regions.', + type: 'initialization' + }, + { + name: 'iD', + description: 'the amount each string other that the first is detuned from the main frequency, measured in cents.', + type: 'initialization' + }, + { + name: 'iK', + description: 'dimensionless stiffness parameter.', + type: 'initialization' + }, + { + name: 'iT30', + description: '30 db decay time in seconds.', + type: 'initialization' + }, + { + name: 'ib', + description: 'high-frequency loss parameter (keep this small).', + type: 'initialization' + }, + { + name: 'imass', + description: 'the mass of the piano hammer.', + type: 'initialization' + }, + { + name: 'ihvfreq', + description: 'the frequency of the natural vibrations of the hammer.', + type: 'initialization' + }, + { + name: 'iinit', + description: 'the initial position of the hammer.', + type: 'initialization' + }, + { + name: 'ipos', + description: 'position along the string that the strike occurs.', + type: 'initialization' + }, + { + name: 'ivel', + description: 'normalized strike velocity.', + type: 'initialization' + }, + { + name: 'isfreq', + description: 'scanning frequency of the reading place.', + type: 'initialization' + }, + { + name: 'isspread', + description: 'scanning frequency spread.', + type: 'initialization' + }, + { + name: 'irattles', + description: 'table number giving locations of any rattle(s).', + type: 'initialization' + }, + { + name: 'irubbers', + description: 'table number giving locations of any rubbers(s).', + type: 'initialization' + }, + { + name: 'kbcL', + description: 'Boundary condition at left end of string (1 is clamped, 2 pivoting and 3 free).', + type: 'performance' + }, + { + name: 'kbcR', + description: 'Boundary condition at right end of string (1 is clamped, 2 pivoting and 3 free).', + type: 'performance' + }, + ], + seeAlso: ['Models and Emulations'] +}, +{ + name: 'sandpaper', + type: 'opcode', + category: 'Signal Generators:Models and Emulations', + description: 'Semi-physical model of a sandpaper sound.', + syntax: 'ares = sandpaper(iamp, idettack [, inum] [, idamp] [, imaxshake])', + example: '--8<-- "examples/sandpaper.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'iamp', + description: 'Amplitude of output. Note: As these instruments are stochastic, this is only a approximation.', + type: 'initialization' + }, + { + name: 'idettack', + description: 'period of time over which all sound is stopped', + type: 'initialization' + }, + ], + seeAlso: ['Models and Emulations'] +}, +{ + name: 'sekere', + type: 'opcode', + category: 'Signal Generators:Models and Emulations', + description: 'Semi-physical model of a sekere sound.', + syntax: 'ares = sekere(iamp, idettack [, inum] [, idamp] [, imaxshake])', + example: '--8<-- "examples/sekere.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'iamp', + description: 'Amplitude of output. Note: As these instruments are stochastic, this is only a approximation.', + type: 'initialization' + }, + { + name: 'idettack', + description: 'period of time over which all sound is stopped', + type: 'initialization' + }, + ], + seeAlso: ['Models and Emulations'] +}, +{ + name: 'shaker', + type: 'opcode', + category: 'Signal Generators:Models and Emulations', + description: 'Sounds like the shaking of a maraca or similar gourd instrument.', + syntax: 'ares = shaker(kamp, kfreq, kbeans, kdamp, ktimes [, idecay])', + example: '--8<-- "examples/shaker.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'idecay', + description: 'If present indicates for how long at the end of the note the shaker is to be damped. The default value is zero.', + type: 'initialization' + }, + { + name: 'kamp', + description: 'Amplitude of note.', + type: 'performance' + }, + { + name: 'kfreq', + description: 'Frequency of note played.', + type: 'performance' + }, + { + name: 'kbeans', + description: 'The number of beans in the gourd. A value of 8 seems suitable.', + type: 'performance' + }, + { + name: 'kdamp', + description: 'The damping value of the shaker. Values of 0.98 to 1 seems suitable, with 0.99 a reasonable default.', + type: 'performance' + }, + { + name: 'ktimes', + description: 'Number of times shaken.', + type: 'performance' + }, + ], + seeAlso: ['Models and Emulations'] +}, +{ + name: 'sleighbells', + type: 'opcode', + category: 'Signal Generators:Models and Emulations', + description: 'Semi-physical model of a sleighbell sound.', + syntax: 'ares = sleighbells(kamp, idettack [, inum] [, idamp] [, imaxshake] [, ifreq] \\\n [, ifreq1] [, ifreq2])', + example: '--8<-- "examples/sleighbells.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'idettack', + description: 'period of time over which all sound is stopped', + type: 'initialization' + }, + { + name: 'kamp', + description: 'Amplitude of output. Note: As these instruments are stochastic, this is only an approximation.', + type: 'performance' + }, + ], + seeAlso: ['Models and Emulations'] +}, +{ + name: 'stix', + type: 'opcode', + category: 'Signal Generators:Models and Emulations', + description: 'Semi-physical model of a stick sound.', + syntax: 'ares = stix(iamp, idettack [, inum] [, idamp] [, imaxshake])', + example: '--8<-- "examples/stix.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'iamp', + description: 'Amplitude of output. Note: As these instruments are stochastic, this is only a approximation.', + type: 'initialization' + }, + { + name: 'idettack', + description: 'period of time over which all sound is stopped', + type: 'initialization' + }, + ], + seeAlso: ['Models and Emulations'] +}, +] diff --git a/src/lib/csound-reference/signal-generators-phasors.ts b/src/lib/csound-reference/signal-generators-phasors.ts new file mode 100644 index 0000000..f98df03 --- /dev/null +++ b/src/lib/csound-reference/signal-generators-phasors.ts @@ -0,0 +1,63 @@ +import type { CsoundReference } from './types' + +// Signal Generators:Phasors +export const signalGeneratorsPhasors: CsoundReference[] = [ +{ + name: 'ephasor', + type: 'opcode', + category: 'Signal Generators:Phasors', + description: 'Produces two outputs: a periodic phase signal and a periodic exponential decaying signal.', + syntax: 'aexp,aph = ephasor(kfreq, kR)', + example: '--8<-- "examples/ephasor.csd"', + parameters: [ + { + name: 'kfreq', + description: 'the rate at which the phase and exponential signals are generated', + type: 'performance' + }, + { + name: 'kR', + description: 'a parameter controlling the decay rate of the exponential signal, 0 < kR < 1. Lower values produce faster decays.', + type: 'performance' + }, + ], + seeAlso: ['Phasors'] +}, +{ + name: 'phasor', + type: 'opcode', + category: 'Signal Generators:Phasors', + description: 'Produce a normalized moving phase value.', + syntax: 'ares = phasor(xcps [, iphs])\n kres = phasor(kcps [, iphs])', + example: '--8<-- "examples/phasor.csd"', + rates: ['a-rate', 'k-rate', 'i-rate'], + seeAlso: ['Phasors'] +}, +{ + name: 'phasorbnk', + type: 'opcode', + category: 'Signal Generators:Phasors', + description: 'Produce an arbitrary number of normalized moving phase values, accessable by an index.', + syntax: 'ares = phasorbnk(xcps, kndx, icnt [, iphs])\n kres = phasorbnk(kcps, kndx, icnt [, iphs])', + example: '--8<-- "examples/phasorbnk.csd"', + rates: ['a-rate', 'k-rate', 'i-rate'], + parameters: [ + { + name: 'icnt', + description: 'maximum number of phasors to be used.', + type: 'initialization' + }, + { + name: 'iphs', + description: 'initial phase, expressed as a fraction of a cycle (0 to 1). If -1 initialization is skipped. If _iphas_>1 each phasor will be initialized with a random value.', + type: 'initialization' + }, + { + name: 'kndx', + description: 'index value to access individual phasors', + type: 'performance' + }, + ], + seeAlso: ['Phasors'] +}, +] diff --git a/src/lib/csound-reference/signal-generators-random-noise-generators.ts b/src/lib/csound-reference/signal-generators-random-noise-generators.ts new file mode 100644 index 0000000..fc37a58 --- /dev/null +++ b/src/lib/csound-reference/signal-generators-random-noise-generators.ts @@ -0,0 +1,956 @@ +import type { CsoundReference } from './types' + +// Signal Generators:Random (Noise) Generators +export const signalGeneratorsRandomNoiseGenerators: CsoundReference[] = [ +{ + name: 'betarand', + type: 'opcode', + category: 'Signal Generators:Random (Noise) Generators', + description: 'Beta distribution random number generator (positive values only).', + syntax: 'ares = betarand(krange, kalpha, kbeta)\n ires = betarand(krange, kalpha, kbeta)\n kres = betarand(krange, kalpha, kbeta)', + example: '--8<-- "examples/betarand-modern.csd"', + rates: ['a-rate', 'k-rate', 'i-rate'], + parameters: [ + { + name: 'krange', + description: 'range of the random numbers (0 - _krange_).', + type: 'performance' + }, + { + name: 'kalpha', + description: 'alpha value. If _kalpha_ is smaller than one, smaller values favor values near 0.', + type: 'performance' + }, + { + name: 'kbeta', + description: 'beta value. If _kbeta_ is smaller than one, smaller values favor values near _krange_.', + type: 'performance' + }, + ], + seeAlso: ['Random (Noise) Generators'] +}, +{ + name: 'bexprnd', + type: 'opcode', + category: 'Signal Generators:Random (Noise) Generators', + description: 'Exponential distribution random number generator.', + syntax: 'ares = bexprnd(krange)\n ires = bexprnd(krange)\n kres = bexprnd(krange)', + example: '--8<-- "examples/bexprnd-modern.csd"', + rates: ['a-rate', 'k-rate', 'i-rate'], + parameters: [ + { + name: 'krange', + description: 'the range of the random numbers (-_krange_ to +_krange_)', + type: 'performance' + }, + ], + seeAlso: ['Random (Noise) Generators'] +}, +{ + name: 'cauchy', + type: 'opcode', + category: 'Signal Generators:Random (Noise) Generators', + description: 'Cauchy distribution random number generator.', + syntax: 'ares = cauchy(kalpha)\n ires = cauchy(kalpha)\n kres = cauchy(kalpha)', + example: '--8<-- "examples/cauchy-modern.csd"', + rates: ['a-rate', 'k-rate', 'i-rate'], + parameters: [ + { + name: 'kalpha', + description: 'controls the spread from zero (big _kalpha_ = big spread). Outputs both positive and negative numbers.', + type: 'performance' + }, + ], + seeAlso: ['Random (Noise) Generators'] +}, +{ + name: 'cauchyi', + type: 'opcode', + category: 'Signal Generators:Random (Noise) Generators', + description: 'Cauchy distribution random number generator with interpolation between values.', + syntax: 'ares = cauchyi(klambda, xamp, xcps)\n ires = cauchyi(klambda, xamp, xcps)\n kres = cauchyi(klambda, xamp, xcps)', + example: '--8<-- "examples/cauchyi-modern.csd"', + rates: ['a-rate', 'k-rate', 'i-rate'], + parameters: [ + { + name: 'kalpha', + description: 'controls the spread from zero (big _kalpha_ = big spread). Outputs both positive and negative numbers.', + type: 'performance' + }, + { + name: 'xamp', + description: 'range over which random numbers are distributed.', + type: 'performance' + }, + { + name: 'xcps', + description: 'the frequency which new random numbers are generated.', + type: 'performance' + }, + ], + seeAlso: ['Random (Noise) Generators'] +}, +{ + name: 'cuserrnd', + type: 'opcode', + category: 'Signal Generators:Random (Noise) Generators', + description: 'Continuous USER-defined-distribution RaNDom generator.', + syntax: 'aout = cuserrnd(kmin, kmax, ktableNum)\n iout = cuserrnd(imin, imax, itableNum)\n kout = cuserrnd(kmin, kmax, ktableNum)', + example: '--8<-- "examples/cuserrnd.csd"', + parameters: [ + { + name: 'imin', + description: 'minimum range limit', + type: 'initialization' + }, + { + name: 'imax', + description: 'maximum range limit', + type: 'initialization' + }, + { + name: 'itableNum', + description: 'number of table containing the random-distribution function. Such table is generated by the user. See [GEN40](../scoregens/gen40.md), [GEN41](../scoregens/gen41.md), and [GEN42](../scoregens/gen42.md). The table length does not need to be a power of 2.', + type: 'initialization' + }, + { + name: 'ktableNum', + description: 'number of table containing the random-distribution function. Such table is generated by the user. See [GEN40](../scoregens/gen40.md), [GEN41](../scoregens/gen41.md), and [GEN42](../scoregens/gen42.md). The table length does not need to be a power of 2.', + type: 'performance' + }, + { + name: 'kmin', + description: 'minimum range limit', + type: 'performance' + }, + { + name: 'kmax', + description: 'maximum range limit', + type: 'performance' + }, + ], + seeAlso: ['Random (Noise) Generators'] +}, +{ + name: 'duserrnd', + type: 'opcode', + category: 'Signal Generators:Random (Noise) Generators', + description: 'Discrete USER-defined-distribution RaNDom generator.', + syntax: 'aout = duserrnd(ktableNum)\n iout = duserrnd(itableNum)\n kout = duserrnd(ktableNum)', + example: '--8<-- "examples/duserrnd.csd"', + parameters: [ + { + name: 'itableNum', + description: 'number of table containing the random-distribution function. Such table is generated by the user. See [GEN40](../scoregens/gen40.md), [GEN41](../scoregens/gen41.md), and [GEN42](../scoregens/gen42.md). The table length does not need to be a power of 2', + type: 'initialization' + }, + { + name: 'ktableNum', + description: 'number of table containing the random-distribution function. Such table is generated by the user. See [GEN40](../scoregens/gen40.md), [GEN41](../scoregens/gen41.md), and [GEN42](../scoregens/gen42.md). The table length does not need to be a power of 2', + type: 'performance' + }, + ], + seeAlso: ['Random (Noise) Generators'] +}, +{ + name: 'dust', + type: 'opcode', + category: 'Signal Generators:Random (Noise) Generators', + description: 'Generates random impulses from 0 to 1.', + syntax: 'ares = dust(kamp, kdensity)\n kres = dust(kamp, kdensity)', + example: '--8<-- "examples/dust.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'kamp', + description: 'amplitude.', + type: 'performance' + }, + { + name: 'kdensity', + description: 'average number of impulses per second.', + type: 'performance' + }, + ], + seeAlso: ['Random (Noise) Generators'] +}, +{ + name: 'dust2', + type: 'opcode', + category: 'Signal Generators:Random (Noise) Generators', + description: 'Generates random impulses from -1 to 1.', + syntax: 'ares = dust2(kamp, kdensity)\n kres = dust2(kamp, kdensity)', + example: '--8<-- "examples/dust2.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'kamp', + description: 'amplitude.', + type: 'performance' + }, + { + name: 'kdensity', + description: 'average number of impulses per second.', + type: 'performance' + }, + ], + seeAlso: ['Random (Noise) Generators'] +}, +{ + name: 'exprand', + type: 'opcode', + category: 'Signal Generators:Random (Noise) Generators', + description: 'Exponential distribution random number generator (positive values only).', + syntax: 'ares = exprand(klambda)\n ires = exprand(klambda)\n kres = exprand(klambda)', + example: '--8<-- "examples/exprand.csd"', + rates: ['a-rate', 'k-rate', 'i-rate'], + parameters: [ + { + name: 'klambda', + description: 'reciprocal of lambda parameter for the exponential distribution.', + type: 'performance' + }, + ], + seeAlso: ['Random (Noise) Generators'] +}, +{ + name: 'exprandi', + type: 'opcode', + category: 'Signal Generators:Random (Noise) Generators', + description: 'Exponential distribution random number generator with interpolation (positive values only).', + syntax: 'ares = exprandi(klambda, xamp, xcps)\n ires = exprandi(klambda, xamp, xcps)\n kres = exprandi(klambda, xamp, xcps)', + example: '--8<-- "examples/exprandi.csd"', + rates: ['a-rate', 'k-rate', 'i-rate'], + parameters: [ + { + name: 'klambda', + description: 'lambda parameter for the exponential distribution.', + type: 'performance' + }, + { + name: 'xamp', + description: 'range over which random numbers are distributed.', + type: 'performance' + }, + { + name: 'xcps', + description: 'the frequency which new random numbers are generated.', + type: 'performance' + }, + ], + seeAlso: ['Random (Noise) Generators'] +}, +{ + name: 'fractalnoise', + type: 'opcode', + category: 'Signal Generators:Random (Noise) Generators', + description: 'A fractal noise generator.', + syntax: 'ares = fractalnoise(kamp, kbeta)', + example: '--8<-- "examples/fractalnoise.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'kamp', + description: 'amplitude.', + type: 'performance' + }, + { + name: 'kbeta', + description: 'spectral parameter related to the fractal dimension', + type: 'performance' + }, + ], + seeAlso: ['Random (Noise) Generators'] +}, +{ + name: 'gauss', + type: 'opcode', + category: 'Signal Generators:Random (Noise) Generators', + description: 'Gaussian distribution random number generator.', + syntax: 'ares = gauss(krange)\n ires = gauss(irange)\n kres = gauss(krange)\n ares = gauss(kmean, ksdev)\n ires = gauss(imean, isdev)\n kres = gauss(kmean, ksdev)', + example: '--8<-- "examples/gauss.csd"', + rates: ['a-rate', 'k-rate', 'i-rate'], + parameters: [ + { + name: 'krange', + description: 'the range of the random numbers (-_krange_ to +_krange_). Outputs both positive and negative numbers.', + type: 'performance' + }, + { + name: 'kmean', + description: 'normal distribution mean.', + type: 'performance' + }, + { + name: 'ksdev', + description: 'normal distribution standard deviation.', + type: 'performance' + }, + ], + seeAlso: ['Random (Noise) Generators'] +}, +{ + name: 'gaussi', + type: 'opcode', + category: 'Signal Generators:Random (Noise) Generators', + description: 'Gaussian distribution random number generator with controlled interpolation between values.', + syntax: 'ares = gaussi(krange, xamp, xcps)\n ires = gaussi(krange, xamp, xcps)\n kres = gaussi(krange, xamp, xcps)', + example: '--8<-- "examples/gaussi.csd"', + rates: ['a-rate', 'k-rate', 'i-rate'], + parameters: [ + { + name: 'krange', + description: 'the range of the random numbers (-_krange_ to +_krange_). Outputs both positive and negative numbers.', + type: 'performance' + }, + { + name: 'xamp', + description: 'range over which random numbers are distributed.', + type: 'performance' + }, + { + name: 'xcps', + description: 'the frequency which new random numbers are generated.', + type: 'performance' + }, + ], + seeAlso: ['Random (Noise) Generators'] +}, +{ + name: 'gausstrig', + type: 'opcode', + category: 'Signal Generators:Random (Noise) Generators', + description: 'Random impulses around a certain frequency.', + syntax: 'ares = gausstrig(kamp, kcps, kdev [, imode] [, ifrst1])\n kres = gausstrig(kamp, kcps, kdev [, imode] [, ifrst1])', + example: '--8<-- "examples/gausstrig.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'kamp', + description: 'amplitude.', + type: 'performance' + }, + { + name: 'kcps', + description: 'the mean frequency over which random impulses are distributed.', + type: 'performance' + }, + { + name: 'kdev', + description: 'random deviation from mean (0 <= dev < 1).', + type: 'performance' + }, + ], + seeAlso: ['Random (Noise) Generators'] +}, +{ + name: 'getseed', + type: 'opcode', + category: 'Signal Generators:Random (Noise) Generators', + description: 'Reads the global seed value.', + syntax: 'ians = getseed()\n kans = getseed()', + example: '--8<-- "examples/getseed.csd"', + seeAlso: ['Random (Noise) Generators'] +}, +{ + name: 'jitter', + type: 'opcode', + category: 'Signal Generators:Random (Noise) Generators', + description: 'Generates a segmented line whose segments are randomly generated.', + syntax: 'kout = jitter(kamp, kcpsMin, kcpsMax)', + example: '--8<-- "examples/jitter.csd"', + rates: ['k-rate'], + parameters: [ + { + name: 'kamp', + description: 'Amplitude of jitter deviation', + type: 'performance' + }, + { + name: 'kcpsMin', + description: 'Minimum speed of random frequency variations (expressed in cps)', + type: 'performance' + }, + { + name: 'kcpsMax', + description: 'Maximum speed of random frequency variations (expressed in cps)', + type: 'performance' + }, + ], + seeAlso: ['Random (Noise) Generators'] +}, +{ + name: 'jitter2', + type: 'opcode', + category: 'Signal Generators:Random (Noise) Generators', + description: 'Generates a segmented line with user-controllable random segments.', + syntax: 'kout = jitter2(ktotamp, kamp1, kcps1, kamp2, kcps2, kamp3, kcps3[ , iopt])', + example: '--8<-- "examples/jitter2.csd"', + parameters: [ + { + name: 'ktotamp', + description: 'Resulting amplitude of jitter2', + type: 'performance' + }, + { + name: 'kamp1', + description: 'Amplitude of the first jitter component', + type: 'performance' + }, + { + name: 'kcps1', + description: 'Speed of random variation of the first jitter component (expressed in cps)', + type: 'performance' + }, + { + name: 'kamp2', + description: 'Amplitude of the second jitter component', + type: 'performance' + }, + { + name: 'kcps2', + description: 'Speed of random variation of the second jitter component (expressed in cps)', + type: 'performance' + }, + { + name: 'kamp3', + description: 'Amplitude of the third jitter component', + type: 'performance' + }, + { + name: 'kcps3', + description: 'Speed of random variation of the third jitter component (expressed in cps)', + type: 'performance' + }, + ], + seeAlso: ['Random (Noise) Generators'] +}, +{ + name: 'jspline', + type: 'opcode', + category: 'Signal Generators:Random (Noise) Generators', + description: 'A jitter-spline generator.', + syntax: 'ares = jspline(xamp, kcpsMin, kcpsMax)\n kres = jspline(kamp, kcpsMin, kcpsMax)', + example: '--8<-- "examples/jspline.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'kres', + description: 'Output signal', + type: 'performance' + }, + { + name: 'ares', + description: 'Output signal', + type: 'performance' + }, + { + name: 'xamp', + description: 'Amplitude factor', + type: 'performance' + }, + { + name: 'kcpsMin', + description: 'Range of point-generation rate. Min and max limits are expressed in cps.', + type: 'performance' + }, + { + name: 'kcpsMax', + description: 'Range of point-generation rate. Min and max limits are expressed in cps.', + type: 'performance' + }, + { + name: 'cpsMin', + description: '_cpsMax_ interval is big, some little discontinuity could occurr, but it should not be a problem, in most cases. Maybe the algorithm will be improved in next versions.', + type: 'performance' + }, + ], + seeAlso: ['Linear and Exponential Generators'] +}, +{ + name: 'lfsr', + type: 'opcode', + category: 'Signal Generators:Random (Noise) Generators', + description: 'Linear Feedback Shift Register (LFSR).', + syntax: 'knum = lfsr(ilen, iprob [, iseed])', + example: '--8<-- "examples/lfsr.csd"', + parameters: [ + { + name: 'ilen', + description: 'length of shift register, valid values are 1-31 (inclusive). The larger the length, the larger the resulting integers in the output. You can use this to constrain the output to a suitable range.', + type: 'initialization' + }, + { + name: 'iprob', + description: 'probability, valid values 1-255 (inclusive). Controls the spread of the output; larger values result in a wider spread of values.', + type: 'initialization' + }, + { + name: 'knum', + description: 'integer output', + type: 'performance' + }, + ], + seeAlso: ['Random (Noise) Generators'] +}, +{ + name: 'linrand', + type: 'opcode', + category: 'Signal Generators:Random (Noise) Generators', + description: 'Linear distribution random number generator (positive values only).', + syntax: 'ares = linrand(krange)\n ires = linrand(krange)\n kres = linrand(krange)', + example: '--8<-- "examples/linrand.csd"', + rates: ['a-rate', 'k-rate', 'i-rate'], + parameters: [ + { + name: 'krange', + description: 'the range of the random numbers (0 - _krange_). Outputs only positive numbers.', + type: 'performance' + }, + ], + seeAlso: ['Random (Noise) Generators'] +}, +{ + name: 'noise', + type: 'opcode', + category: 'Signal Generators:Random (Noise) Generators', + description: 'A white noise generator with an IIR lowpass filter.', + syntax: 'ares = noise(xamp, kbeta)', + example: '--8<-- "examples/noise.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'xamp', + description: 'amplitude of final output', + type: 'performance' + }, + { + name: 'kbeta', + description: 'beta of the lowpass filter. Should be in the range of -1 to 1, exclusive of the end-points.', + type: 'performance' + }, + ], + seeAlso: ['Random (Noise) Generators'] +}, +{ + name: 'pcauchy', + type: 'opcode', + category: 'Signal Generators:Random (Noise) Generators', + description: 'Cauchy distribution random number generator (positive values only).', + syntax: 'ares = pcauchy(kalpha)\n ires = pcauchy(kalpha)\n kres = pcauchy(kalpha)', + example: '--8<-- "examples/pcauchy.csd"', + rates: ['a-rate', 'k-rate', 'i-rate'], + parameters: [ + { + name: 'pcauchy_ _kalpha', + description: 'controls the spread from zero (big kalpha = big spread). Outputs positive numbers only.', + type: 'performance' + }, + ], + seeAlso: ['Random (Noise) Generators'] +}, +{ + name: 'pinker', + type: 'opcode', + category: 'Signal Generators:Random (Noise) Generators', + description: 'Generates pink noise (-3dB/oct response) by the _NewShade of Pink_ algorithm of Stefan Stenzel.', + syntax: 'ares = pinker()', + example: '--8<-- "examples/pinker.csd"', + rates: ['a-rate'], + seeAlso: ['Random (Noise) Generators'] +}, +{ + name: 'pinkish', + type: 'opcode', + category: 'Signal Generators:Random (Noise) Generators', + description: 'Generates approximate pink noise (-3dB/oct response).', + syntax: 'ares = pinkish(xin [, imethod] [, inumbands] [, iseed] [, iskip])', + example: '--8<-- "examples/pinkish.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'xin', + description: 'for Gardner method: k- or a-rate amplitude. For Kellet filters: normally a-rate uniform random noise from rand (31-bit) or unirand, but can be any a-rate signal. The output peak value varies widely (±15%) even over long runs, and will usually be well below the input amplitude. Peak values may also occasionally overshoot input amplitude or noise.', + type: 'performance' + }, + ], + seeAlso: ['Random (Noise) Generators'] +}, +{ + name: 'poisson', + type: 'opcode', + category: 'Signal Generators:Random (Noise) Generators', + description: 'Poisson distribution random number generator (positive values only).', + syntax: 'ares = poisson(klambda)\n ires = poisson(klambda)\n kres = poisson(klambda)', + example: '--8<-- "examples/poisson.csd"', + rates: ['a-rate', 'k-rate', 'i-rate'], + parameters: [ + { + name: 'ares', + description: 'number of events occuring (always an integer).', + type: 'performance' + }, + { + name: 'kres', + description: 'number of events occuring (always an integer).', + type: 'performance' + }, + { + name: 'ires', + description: 'number of events occuring (always an integer).', + type: 'performance' + }, + { + name: 'klambda', + description: 'the expected number of occurrences that occur during the rate interval.', + type: 'performance' + }, + ], + seeAlso: ['Random (Noise) Generators'] +}, +{ + name: 'rand', + type: 'opcode', + category: 'Signal Generators:Random (Noise) Generators', + description: 'Output is a controlled random number series between -*amp* and +*amp*.', + syntax: 'ares = rand(xamp [, iseed] [, isel] [, ioffset])\n kres = rand(xamp [, iseed] [, isel] [, ioffset])', + example: '--8<-- "examples/rand.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'kamp', + description: 'range over which random numbers are distributed.', + type: 'performance' + }, + { + name: 'xamp', + description: 'range over which random numbers are distributed.', + type: 'performance' + }, + { + name: 'ares', + description: 'Random number produced.', + type: 'performance' + }, + { + name: 'kres', + description: 'Random number produced.', + type: 'performance' + }, + { + name: 'kamp_ to', + description: 'kamp_. _rand_ will thus generate uniform white noise with an R.M.S value of _kamp / root 2_.', + type: 'performance' + }, + ], + seeAlso: ['Random (Noise) Generators', 'randh', 'randi'] +}, +{ + name: 'randc', + type: 'opcode', + category: 'Signal Generators:Random (Noise) Generators', + description: 'Generates a controlled random number series with cubic interpolation between each new number.', + syntax: 'ares = randc(xamp, xcps [, iseed] [, isize] [, ioffset])\n kres = randc(kamp, kcps [, iseed] [, isize] [, ioffset])', + example: '--8<-- "examples/randc.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'kamp', + description: 'range over which random numbers are distributed.', + type: 'performance' + }, + { + name: 'xamp', + description: 'range over which random numbers are distributed.', + type: 'performance' + }, + { + name: 'kcps', + description: 'the frequency which new random numbers are generated.', + type: 'performance' + }, + { + name: 'xcps', + description: 'the frequency which new random numbers are generated.', + type: 'performance' + }, + { + name: 'kamp_ to', + description: 'kamp_. _rand_ will thus generate uniform white noise with an R.M.S value of _kamp / root 2_.', + type: 'performance' + }, + ], + seeAlso: ['Random (Noise) Generators', 'randh', 'rand'] +}, +{ + name: 'randh', + type: 'opcode', + category: 'Signal Generators:Random (Noise) Generators', + description: 'Generates random numbers and holds them for a period of time.', + syntax: 'ares = randh(xamp, xcps [, iseed] [, isize] [, ioffset])\n kres = randh(kamp, kcps [, iseed] [, isize] [, ioffset])', + example: '--8<-- "examples/randh.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'kamp', + description: 'range over which random numbers are distributed.', + type: 'performance' + }, + { + name: 'xamp', + description: 'range over which random numbers are distributed.', + type: 'performance' + }, + { + name: 'kcps', + description: 'the frequency which new random numbers are generated.', + type: 'performance' + }, + { + name: 'xcps', + description: 'the frequency which new random numbers are generated.', + type: 'performance' + }, + ], + seeAlso: ['Random (Noise) Generators', 'rand', 'randi'] +}, +{ + name: 'randi', + type: 'opcode', + category: 'Signal Generators:Random (Noise) Generators', + description: 'Generates a controlled random number series with interpolation between each new number.', + syntax: 'ares = randi(xamp, xcps [, iseed] [, isize] [, ioffset])\n kres = randi(kamp, kcps [, iseed] [, isize] [, ioffset])', + example: '--8<-- "examples/randi.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'kamp', + description: 'range over which random numbers are distributed.', + type: 'performance' + }, + { + name: 'xamp', + description: 'range over which random numbers are distributed.', + type: 'performance' + }, + { + name: 'kcps', + description: 'the frequency which new random numbers are generated.', + type: 'performance' + }, + { + name: 'xcps', + description: 'the frequency which new random numbers are generated.', + type: 'performance' + }, + { + name: 'kamp_ to', + description: 'kamp_. _rand_ will thus generate uniform white noise with an R.M.S value of _kamp / root 2_.', + type: 'performance' + }, + ], + seeAlso: ['Random (Noise) Generators', 'randh', 'rand'] +}, +{ + name: 'random', + type: 'opcode', + category: 'Signal Generators:Random (Noise) Generators', + description: 'Generates a controlled pseudo-random number series between min and max values.', + syntax: 'ares = random(kmin, kmax)\n ires = random(imin, imax)\n kres = random(kmin, kmax)', + example: '--8<-- "examples/random.csd"', + rates: ['a-rate', 'k-rate', 'i-rate'], + parameters: [ + { + name: 'imin', + description: 'minimum range limit', + type: 'initialization' + }, + { + name: 'imax', + description: 'maximum range limit', + type: 'initialization' + }, + { + name: 'kmin', + description: 'minimum range limit', + type: 'performance' + }, + { + name: 'kmax', + description: 'maximum range limit', + type: 'performance' + }, + ], + seeAlso: ['Random (Noise) Generators'] +}, +{ + name: 'randomh', + type: 'opcode', + category: 'Signal Generators:Random (Noise) Generators', + description: 'Generates random numbers with a user-defined limit and holds them for a period of time.', + syntax: 'ares = randomh(kmin, kmax, xcps [,imode] [,ifirstval])\n kres = randomh(kmin, kmax, kcps [,imode] [,ifirstval])', + example: '--8<-- "examples/randomh.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'kmin', + description: 'minimum range limit', + type: 'performance' + }, + { + name: 'kmax', + description: 'maximum range limit', + type: 'performance' + }, + { + name: 'kcps', + description: 'rate of random break-point generation', + type: 'performance' + }, + { + name: 'xcps', + description: 'rate of random break-point generation', + type: 'performance' + }, + ], + seeAlso: ['Random (Noise) Generators'] +}, +{ + name: 'randomi', + type: 'opcode', + category: 'Signal Generators:Random (Noise) Generators', + description: 'Generates a user-controlled random number series with interpolation between each new number.', + syntax: 'ares = randomi(kmin, kmax, xcps [,imode] [,ifirstval])\n kres = randomi(kmin, kmax, kcps [,imode] [,ifirstval])', + example: '--8<-- "examples/randomi.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'kmin', + description: 'minimum range limit', + type: 'performance' + }, + { + name: 'kmax', + description: 'maximum range limit', + type: 'performance' + }, + { + name: 'kcps', + description: 'rate of random break-point generation', + type: 'performance' + }, + { + name: 'xcps', + description: 'rate of random break-point generation', + type: 'performance' + }, + ], + seeAlso: ['Random (Noise) Generators'] +}, +{ + name: 'rnd31', + type: 'opcode', + category: 'Signal Generators:Random (Noise) Generators', + description: '31-bit bipolar random opcodes with controllable distribution.', + syntax: 'ax = rnd31(kscl, krpow [, iseed])\n ix = rnd31(iscl, irpow [, iseed])\n kx = rnd31(kscl, krpow [, iseed])', + example: '--8<-- "examples/rnd31.csd"', + parameters: [ + { + name: 'ix', + description: 'i-rate output value.', + type: 'initialization' + }, + { + name: 'iscl', + description: 'output scale. The generated random numbers are in the range -iscl to iscl.', + type: 'initialization' + }, + { + name: 'irpow', + description: 'controls the distribution of random numbers. If irpow is positive, the random distribution (x is in the range -1 to 1) is _abs(x) ˆ ((1 / irpow) - 1)_; for negative irpow values, it is _(1 - abs(x)) ˆ ((-1 / irpow) - 1)_. Setting _irpow_ to -1, 0, or 1 will result in uniform distribution (this is also faster to calculate).', + type: 'initialization' + }, + { + name: 'ax', + description: 'a-rate output value.', + type: 'performance' + }, + { + name: 'kx', + description: 'k-rate output value.', + type: 'performance' + }, + { + name: 'kscl', + description: 'output scale. The generated random numbers are in the range -kscl to kscl. It is the same as _iscl_, but can be varied at k-rate.', + type: 'performance' + }, + { + name: 'krpow', + description: 'controls the distribution of random numbers. It is the same as _irpow_, but can be varied at k-rate.', + type: 'performance' + }, + ], + seeAlso: ['Random (Noise) Generators'] +}, +{ + name: 'rndseed', + type: 'opcode', + category: 'Signal Generators:Random (Noise) Generators', + description: 'Sets the global seed value for [rnd](../opcodes/rnd.md) and [birnd](../opcodes/birnd.md).', + syntax: 'rndseed(ival)', + example: '--8<-- "examples/rndseed.csd"', + seeAlso: ['Random (Noise) Generators'] +}, +{ + name: 'rspline', + type: 'opcode', + category: 'Signal Generators:Random (Noise) Generators', + description: 'Generate random spline curves.', + syntax: 'ares = rspline(xrangeMin, xrangeMax, kcpsMin, kcpsMax)\n kres = rspline(krangeMin, krangeMax, kcpsMin, kcpsMax)', + example: '--8<-- "examples/rspline.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'kres', + description: 'Output signal', + type: 'performance' + }, + { + name: 'ares', + description: 'Output signal', + type: 'performance' + }, + { + name: 'xrangeMin', + description: 'Range of values of random-generated points', + type: 'performance' + }, + { + name: 'xrangeMax', + description: 'Range of values of random-generated points', + type: 'performance' + }, + { + name: 'kcpsMin', + description: 'Range of point-generation rate. Min and max limits are expressed in cps.', + type: 'performance' + }, + { + name: 'kcpsMax', + description: 'Range of point-generation rate. Min and max limits are expressed in cps.', + type: 'performance' + }, + ], + seeAlso: ['Linear and Exponential Generators'] +}, +{ + name: 'seed', + type: 'opcode', + category: 'Signal Generators:Random (Noise) Generators', + description: 'Sets the global seed value for all _x-class noise generators_, as well as other opcodes that use a random call, such as [grain](../opcodes/grain.md).', + syntax: 'seed(ival)', + example: '--8<-- "examples/seed.csd"', + seeAlso: ['Random (Noise) Generators', 'Orchestra Header Statements'] +}, +] diff --git a/src/lib/csound-reference/signal-generators-sample-playback.ts b/src/lib/csound-reference/signal-generators-sample-playback.ts new file mode 100644 index 0000000..e431fcc --- /dev/null +++ b/src/lib/csound-reference/signal-generators-sample-playback.ts @@ -0,0 +1,1133 @@ +import type { CsoundReference } from './types' + +// Signal Generators:Sample Playback +export const signalGeneratorsSamplePlayback: CsoundReference[] = [ +{ + name: 'bbcutm', + type: 'opcode', + category: 'Signal Generators:Sample Playback', + description: 'Generates breakbeat-style cut-ups of a mono audio stream.', + syntax: 'a1 = bbcutm(asource, ibps, isubdiv, ibarlength, iphrasebars, inumrepeats \\\n [, istutterspeed] [, istutterchance] [, ienvchoice ])', + example: '--8<-- "examples/bbcutm-modern.csd"', + parameters: [ + { + name: 'ibps', + description: 'Tempo to cut at, in beats per second.', + type: 'initialization' + }, + { + name: 'isubdiv', + description: 'Subdivisions unit, for a bar. So 8 is eighth notes (of a 4/4 bar).', + type: 'initialization' + }, + { + name: 'ibarlength', + description: 'How many beats per bar. Set to 4 for default 4/4 bar behaviour.', + type: 'initialization' + }, + { + name: 'iphrasebars', + description: 'The output cuts are generated in phrases, each phrase is up to iphrasebars long', + type: 'initialization' + }, + { + name: 'inumrepeats', + description: 'In normal use the algorithm would allow up to one additional repeat of a given cut at a time. This parameter allows that to be changed. Value 1 is normal- up to one extra repeat. 0 would avoid repeating, and you would always get back the original source except for enveloping and stuttering.', + type: 'initialization' + }, + { + name: 'istutterspeed', + description: '(optional, default=1) The stutter can be an integer multiple of the subdivision speed. For instance, if subdiv is 8 (quavers) and stutterspeed is 2, then the stutter is in semiquavers (sixteenth notes= subdiv 16). The default is 1.', + type: 'initialization' + }, + { + name: 'istutterchance', + description: '(optional, default=0) The tail of a phrase has this chance of becoming a single repeating one unit cell stutter (0.0 to 1.0). The default is 0.', + type: 'initialization' + }, + { + name: 'ienvchoice', + description: '(optional, default=1) choose 1 for on (exponential envelope for cut grains) or 0 for off. Off will cause clicking, but may give good noisy results, especially for percussive sources. The default is 1, on.', + type: 'initialization' + }, + { + name: 'asource', + description: 'The audio signal to be cut up. This version runs in real-time without knowledge of future audio.', + type: 'performance' + }, + ], + seeAlso: ['Sample Playback'] +}, +{ + name: 'bbcuts', + type: 'opcode', + category: 'Signal Generators:Sample Playback', + description: 'Generates breakbeat-style cut-ups of a stereo audio stream.', + syntax: 'a1,a2 = bbcuts(asource1, asource2, ibps, isubdiv, ibarlength, iphrasebars, \\\n inumrepeats [, istutterspeed] [, istutterchance] [, ienvchoice])', + example: '--8<-- "examples/bbcuts-modern.csd"', + parameters: [ + { + name: 'ibps', + description: 'Tempo to cut at, in beats per second.', + type: 'initialization' + }, + { + name: 'isubdiv', + description: 'Subdivisions unit, for a bar. So 8 is eighth notes (of a 4/4 bar).', + type: 'initialization' + }, + { + name: 'ibarlength', + description: 'How many beats per bar. Set to 4 for default 4/4 bar behaviour.', + type: 'initialization' + }, + { + name: 'iphrasebars', + description: 'The output cuts are generated in phrases, each phrase is up to iphrasebars long', + type: 'initialization' + }, + { + name: 'inumrepeats', + description: 'In normal use the algorithm would allow up to one additional repeat of a given cut at a time. This parameter allows that to be changed. Value 1 is normal- up to one extra repeat. 0 would avoid repeating, and you would always get back the original source except for enveloping and stuttering.', + type: 'initialization' + }, + { + name: 'istutterspeed', + description: '(optional, default=1) The stutter can be an integer multiple of the subdivision speed. For instance, if subdiv is 8 (quavers) and stutterspeed is 2, then the stutter is in semiquavers (sixteenth notes= subdiv 16). The default is 1.', + type: 'initialization' + }, + { + name: 'istutterchance', + description: '(optional, default=0) The tail of a phrase has this chance of becoming a single repeating one unit cell stutter (0.0 to 1.0). The default is 0.', + type: 'initialization' + }, + { + name: 'ienvchoice', + description: '(optional, default=1) choose 1 for on (exponential envelope for cut grains) or 0 for off. Off will cause clicking, but may give good noisy results, especially for percussive sources. The default is 1, on.', + type: 'initialization' + }, + { + name: 'asource', + description: 'The audio signal to be cut up. This version runs in real-time without knowledge of future audio.', + type: 'performance' + }, + ], + seeAlso: ['Sample Playback'] +}, +{ + name: 'flooper', + type: 'opcode', + category: 'Signal Generators:Sample Playback', + description: 'Function-table-based crossfading looper.', + syntax: 'asig1[, asig2] = flooper(kamp, kpitch, istart, idur, ifad, ifn)', + example: 'aout flooper 16000, 1, 1, 4, 0.05, 1 ; loop starts at 1 sec, for 4 secs, 0.05 crossfade\n out aout', + rates: ['k-rate', 'i-rate'], + parameters: [ + { + name: 'istart', + description: 'loop start pos in seconds', + type: 'initialization' + }, + { + name: 'idur', + description: 'loop duration in seconds', + type: 'initialization' + }, + { + name: 'ifad', + description: 'crossfade duration in seconds', + type: 'initialization' + }, + { + name: 'ifn', + description: 'function table number, generally created using GEN01', + type: 'initialization' + }, + { + name: 'kamp', + description: 'amplitude control', + type: 'performance' + }, + { + name: 'kpitch', + description: 'pitch control (transposition ratio); negative values play the loop back in reverse', + type: 'performance' + }, + ], + seeAlso: ['Sample Playback'] +}, +{ + name: 'flooper2', + type: 'opcode', + category: 'Signal Generators:Sample Playback', + description: 'Function-table-based crossfading looper.', + syntax: 'asig1[,asig2] = flooper2(kamp, kpitch, kloopstart, kloopend, kcrossfade, ifn \\\n [, istart, imode, ifenv, iskip])', + example: 'aout flooper2 16000, 1, 1, 5, 0.05, 1 ; loop starts at 1 sec, for 4 secs, 0.05 crossfade\n out aout', + rates: ['k-rate', 'i-rate'], + parameters: [ + { + name: 'ifn', + description: 'sound source function table number, generally created using GEN01', + type: 'initialization' + }, + { + name: 'istart', + description: 'playback start pos in seconds', + type: 'initialization' + }, + { + name: 'imode', + description: 'loop modes: 0 forward, 1 backward, 2 back-and-forth [def: 0]', + type: 'initialization' + }, + { + name: 'ifenv', + description: 'if non-zero, crossfade envelope shape table number. The default, 0, sets the crossfade to linear.', + type: 'initialization' + }, + { + name: 'iskip', + description: 'if 1, the opcode initialisation is skipped, for tied notes, performance continues from the position in the loop where the previous note stopped. The default, 0, does not skip initialisation', + type: 'initialization' + }, + { + name: 'kamp', + description: 'amplitude control', + type: 'performance' + }, + { + name: 'kpitch', + description: 'pitch control (transposition ratio); negative values are not allowed.', + type: 'performance' + }, + { + name: 'kloopstart', + description: 'loop start point (secs). Note that although k-rate, loop parameters such as this are only updated once per loop cycle.', + type: 'performance' + }, + { + name: 'kloopend', + description: 'loop end point (secs), updated once per loop cycle.', + type: 'performance' + }, + { + name: 'kcrossfade', + description: 'crossfade length (secs), updated once per loop cycle and limited to loop length.', + type: 'performance' + }, + ], + seeAlso: ['Sample Playback'] +}, +{ + name: 'loscil', + type: 'opcode', + category: 'Signal Generators:Sample Playback', + description: 'Read sampled sound (mono or stereo) from a table.', + syntax: 'ar1 [,ar2] = loscil(xamp, kcps, ifn [, ibas] [, imod1] [, ibeg1] [, iend1] \\\n [, imod2] [, ibeg2] [, iend2])\n aph, ar1 [,ar2] = loscilphs(xamp, kcps, ifn [, ibas] [, imod1] [, ibeg1] \\\n [, iend1] [, imod2] [, ibeg2] [, iend2])', + example: '--8<-- "examples/loscil.csd"', + rates: ['k-rate', 'i-rate'], + parameters: [ + { + name: 'ifn', + description: 'function table number, typically denoting an sampled sound segment with prescribed looping points loaded using [GEN01](../scoregens/gen01.md). The source file may be mono or stereo.', + type: 'initialization' + }, + { + name: 'aph', + description: 'the normalised table position corresponding to the output sample (loscilphs only).', + type: 'performance' + }, + { + name: 'ar1', + description: 'the output at audio-rate. There is just _ar1_ for mono output. However, there is both _ar1_ and _ar2_ for stereo output.', + type: 'performance' + }, + { + name: 'ar2', + description: 'the output at audio-rate. There is just _ar1_ for mono output. However, there is both _ar1_ and _ar2_ for stereo output.', + type: 'performance' + }, + { + name: 'xamp', + description: 'the amplitude of the output signal.', + type: 'performance' + }, + { + name: 'kcps', + description: 'the frequency of the output signal in cycles per second.', + type: 'performance' + }, + ], + seeAlso: ['Sample Playback'] +}, +{ + name: 'loscil3', + type: 'opcode', + category: 'Signal Generators:Sample Playback', + description: 'Read sampled sound from a table using cubic interpolation.', + syntax: 'ar1 [,ar2] = loscil3(xamp, kcps, ifn [, ibas] [, imod1] [, ibeg1] [, iend1] \\\n [, imod2] [, ibeg2] [, iend2])\n aph, ar1 [,ar2] = loscil3phs(xamp, kcps, ifn [, ibas] [, imod1] [, ibeg1] \\\n [, iend1] [, imod2] [, ibeg2] [, iend2])', + example: '--8<-- "examples/loscil3.csd"', + rates: ['k-rate', 'i-rate'], + parameters: [ + { + name: 'ifn', + description: 'function table number, typically denoting an sampled sound segment with prescribed looping points loaded using [GEN01](../scoregens/gen01.md). The source file may be mono or stereo.', + type: 'initialization' + }, + { + name: 'aph', + description: 'the normalised table position corresponding to the output sample (loscil3phs only).', + type: 'performance' + }, + { + name: 'ar1', + description: 'the output at audio-rate. There is just _ar1_ for mono output. However, there is both _ar1_ and _ar2_ for stereo output.', + type: 'performance' + }, + { + name: 'ar2', + description: 'the output at audio-rate. There is just _ar1_ for mono output. However, there is both _ar1_ and _ar2_ for stereo output.', + type: 'performance' + }, + { + name: 'xamp', + description: 'the amplitude of the output signal.', + type: 'performance' + }, + { + name: 'kcps', + description: 'the frequency of the output signal in cycles per second.', + type: 'performance' + }, + ], + seeAlso: ['Sample Playback'] +}, +{ + name: 'loscilx', + type: 'opcode', + category: 'Signal Generators:Sample Playback', + description: 'Read sampled sound (up to 16 channels) from a table, with optional sustain and release looping.', + syntax: 'ar1 [, ar2, ar3, ar4, ar5, ar6, ar7, ar8, ar9, ar10, ar11, ar12, ar13, ar14, \\\n ar15, ar16] = loscilx(xamp, kcps, ifn \\\n [, iwsize, ibas, istrt, imod, ibeg, iend])\n ar[] = loscilx(xamp, kcps, ifn \\\n [, iwsize, ibas, istrt, imod, ibeg, iend])', + example: '--8<-- "examples/loscilx.csd"', + rates: ['k-rate', 'i-rate'], + parameters: [ + { + name: 'ifn', + description: 'function table number, typically denoting an sampled sound segment with prescribed looping points loaded using [GEN01](../scoregens/gen01.md). The source file may have up to 16 channels.', + type: 'initialization' + }, + { + name: 'xamp', + description: 'the amplitude of the output signal.', + type: 'performance' + }, + { + name: 'kcps', + description: 'the factor to read the file. For example, a value of 1 has no pitch change, 1.5 is up a fifth and 2 an octave.', + type: 'performance' + }, + ], + seeAlso: ['Sample Playback'] +}, +{ + name: 'lphasor', + type: 'opcode', + category: 'Signal Generators:Sample Playback', + description: 'Generates a table index for sample playback (e.g. with [tablexkt](../opcodes/tablexkt.md)).', + syntax: 'ares = lphasor(xtrns [, ilps] [, ilpe] [, imode] [, istrt] [, istor])', + example: '--8<-- "examples/lphasor.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'ilps', + description: 'loop start.', + type: 'initialization' + }, + { + name: 'ilpe', + description: 'loop end (must be greater than _ilps_ to enable looping). The default value of _ilps_ and _ilpe_ is zero.', + type: 'initialization' + }, + { + name: 'ares', + description: 'a raw table index in samples (same unit for loop points). Can be used as index with the table opcodes.', + type: 'performance' + }, + { + name: 'xtrns', + description: 'transpose factor, expressed as a playback ratio. _ares_ is incremented by this value, and wraps around loop points. For example, 1.5 means a fifth above, 0.75 means fourth below. It is not allowed to be negative.', + type: 'performance' + }, + ], + seeAlso: ['Sample Playback'] +}, +{ + name: 'lposcil', + type: 'opcode', + category: 'Signal Generators:Sample Playback', + description: 'Read sampled sound (mono or stereo) from a table, with looping, and high precision.', + syntax: 'ares = lposcil(kamp, kfreqratio, kloop, kend, ifn [, iphs])', + example: '--8<-- "examples/lposcil.csd"', + rates: ['a-rate', 'k-rate', 'i-rate'], + parameters: [ + { + name: 'ifn', + description: 'function table number', + type: 'initialization' + }, + { + name: 'kamp', + description: 'amplitude', + type: 'performance' + }, + { + name: 'kfreqratio', + description: 'multiply factor of table frequency (for example: 1 = original frequency, 1.5 = a fifth up , .5 = an octave down)', + type: 'performance' + }, + { + name: 'kloop', + description: 'start loop point (in samples)', + type: 'performance' + }, + { + name: 'kend', + description: 'end loop point (in samples)', + type: 'performance' + }, + ], + seeAlso: ['Sample Playback'] +}, +{ + name: 'lposcil3', + type: 'opcode', + category: 'Signal Generators:Sample Playback', + description: 'Read sampled sound (mono or stereo) from a table, with looping, and high precision.', + syntax: 'ares = lposcil3(kamp, kfreqratio, kloop, kend, ifn [, iphs])', + example: '--8<-- "examples/lposcil3.csd"', + rates: ['a-rate', 'k-rate', 'i-rate'], + parameters: [ + { + name: 'ifn', + description: 'function table number', + type: 'initialization' + }, + { + name: 'kamp', + description: 'amplitude', + type: 'performance' + }, + { + name: 'kfreqratio', + description: 'multiply factor of table frequency (for example: 1 = original frequency, 1.5 = a fifth up , .5 = an octave down)', + type: 'performance' + }, + { + name: 'kloop', + description: 'start loop point (in samples)', + type: 'performance' + }, + { + name: 'kend', + description: 'end loop point (in samples)', + type: 'performance' + }, + ], + seeAlso: ['Sample Playback'] +}, +{ + name: 'lposcila', + type: 'opcode', + category: 'Signal Generators:Sample Playback', + description: 'Read sampled sound from a table with looping and high precision.', + syntax: 'ar = lposcila(aamp, kfreqratio, kloop, kend, ift [,iphs])', + example: '--8<-- "examples/lposcila.csd"', + rates: ['i-rate'], + parameters: [ + { + name: 'ift', + description: 'function table number', + type: 'initialization' + }, + { + name: 'iphs', + description: 'initial phase (in samples)', + type: 'initialization' + }, + { + name: 'ar', + description: 'output signal', + type: 'performance' + }, + { + name: 'aamp', + description: 'amplitude', + type: 'performance' + }, + { + name: 'kfreqratio', + description: 'multiply factor of table frequency (for example: 1 = original frequency, 1.5 = a fifth up , .5 = an octave down)', + type: 'performance' + }, + { + name: 'kloop', + description: 'start loop point (in samples)', + type: 'performance' + }, + { + name: 'kend', + description: 'end loop point (in samples)', + type: 'performance' + }, + ], + seeAlso: ['Sample Playback'] +}, +{ + name: 'lposcilsa', + type: 'opcode', + category: 'Signal Generators:Sample Playback', + description: 'Read stereo sampled sound from a table with looping and high precision.', + syntax: 'ar1, ar2 = lposcilsa(aamp, kfreqratio, kloop, kend, ift [,iphs])', + example: '--8<-- "examples/lposcilsa.csd"', + rates: ['i-rate'], + parameters: [ + { + name: 'ift', + description: 'function table number', + type: 'initialization' + }, + { + name: 'iphs', + description: 'initial phase (in samples)', + type: 'initialization' + }, + { + name: 'ar1', + description: 'output signal', + type: 'performance' + }, + { + name: 'ar2', + description: 'output signal', + type: 'performance' + }, + { + name: 'aamp', + description: 'amplitude', + type: 'performance' + }, + { + name: 'kfreqratio', + description: 'multiply factor of table frequency (for example: 1 = original frequency, 1.5 = a fifth up , .5 = an octave down)', + type: 'performance' + }, + { + name: 'kloop', + description: 'start loop point (in samples)', + type: 'performance' + }, + { + name: 'kend', + description: 'end loop point (in samples)', + type: 'performance' + }, + ], + seeAlso: ['Sample Playback'] +}, +{ + name: 'lposcilsa2', + type: 'opcode', + category: 'Signal Generators:Sample Playback', + description: 'Read stereo sampled sound from a table with looping and high precision.', + syntax: 'ar1, ar2 = lposcilsa2(aamp, kfreqratio, kloop, kend, ift [,iphs])', + example: '--8<-- "examples/lposcilsa2.csd"', + rates: ['i-rate'], + parameters: [ + { + name: 'ift', + description: 'function table number.', + type: 'initialization' + }, + { + name: 'iphs', + description: 'initial phase (in samples).', + type: 'initialization' + }, + { + name: 'ar1', + description: 'output signal.', + type: 'performance' + }, + { + name: 'ar2', + description: 'output signal.', + type: 'performance' + }, + { + name: 'aamp', + description: 'amplitude.', + type: 'performance' + }, + { + name: 'kfreqratio', + description: 'multiply factor of table frequency (for example: 1 = original frequency, 2 = an octave up). Only integers are allowed.', + type: 'performance' + }, + { + name: 'kloop', + description: 'start loop point (in samples).', + type: 'performance' + }, + { + name: 'kend', + description: 'end loop point (in samples).', + type: 'performance' + }, + ], + seeAlso: ['Sample Playback'] +}, +{ + name: 'sfilist', + type: 'opcode', + category: 'Signal Generators:Sample Playback', + description: 'Prints a list of all instruments of a previously loaded SoundFont2 (SF2) sample file.', + syntax: 'sfilist(ifilhandle [, Sprintprefix])', + example: '--8<-- "examples/sfilist.csd"', + parameters: [ + { + name: 'ifilhandle', + description: 'unique number generated by [sfload](../opcodes/sfload.md) opcode to be used as an identifier for a SF2 file. Several SF2 files can be loaded and activated at the same time.', + type: 'initialization' + }, + { + name: 'Sprintprefix', + description: 'A string prefix to prepend to each instrument row printed', + type: 'initialization' + }, + ], + seeAlso: ['Soundfonts', 'https://flossmanual.csound.com/midi/reading-midi-files', 'http://en.wikipedia.org/wiki/Soundfont'] +}, +{ + name: 'sfinstr', + type: 'opcode', + category: 'Signal Generators:Sample Playback', + description: 'Plays a SoundFont2 (SF2) sample instrument, generating a stereo sound.', + syntax: 'ar1, ar2 = sfinstr(ivel, inotenum, xamp, xfreq, instrnum, ifilhandle \\\n [, iflag] [, ioffset])', + example: '--8<-- "examples/sfinstr.csd"', + parameters: [ + { + name: 'ivel', + description: 'velocity value', + type: 'initialization' + }, + { + name: 'inotenum', + description: 'MIDI note number value', + type: 'initialization' + }, + { + name: 'instrnum', + description: 'number of an instrument of a SF2 file.', + type: 'initialization' + }, + { + name: 'ifilhandle', + description: 'unique number generated by _sfload_ opcode to be used as an identifier for a SF2 file. Several SF2 files can be loaded and activated at the same time.', + type: 'initialization' + }, + { + name: 'xamp', + description: 'amplitude correction factor', + type: 'performance' + }, + { + name: 'xfreq', + description: 'frequency value or frequency multiplier, depending by _iflag_. When _iflag_ = 0, _xfreq_ is a multiplier of a the default frequency, assigned by SF2 preset to the _inotenum_ value. When _iflag_ = 1, _xfreq_ is the absolute frequency of the output sound, in Hz. Default is 0.', + type: 'performance' + }, + ], + seeAlso: ['Soundfonts', 'https://flossmanual.csound.com/midi/reading-midi-files', 'http://en.wikipedia.org/wiki/Soundfont'] +}, +{ + name: 'sfinstr3', + type: 'opcode', + category: 'Signal Generators:Sample Playback', + description: 'Plays a SoundFont2 (SF2) sample instrument, generating a stereo sound with cubic interpolation.', + syntax: 'ar1, ar2 = sfinstr3(ivel, inotenum, xamp, xfreq, instrnum, ifilhandle \\\n [, iflag] [, ioffset])', + example: '--8<-- "examples/sfinstr3.csd"', + parameters: [ + { + name: 'ivel', + description: 'velocity value', + type: 'initialization' + }, + { + name: 'inotenum', + description: 'MIDI note number value', + type: 'initialization' + }, + { + name: 'instrnum', + description: 'number of an instrument of a SF2 file.', + type: 'initialization' + }, + { + name: 'ifilhandle', + description: 'unique number generated by _sfload_ opcode to be used as an identifier for a SF2 file. Several SF2 files can be loaded and activated at the same time.', + type: 'initialization' + }, + { + name: 'xamp', + description: 'amplitude correction factor', + type: 'performance' + }, + { + name: 'xfreq', + description: 'frequency value or frequency multiplier, depending by _iflag_. When _iflag_ = 0, _xfreq_ is a multiplier of a the default frequency, assigned by SF2 preset to the _inotenum_ value. When _iflag_ = 1, _xfreq_ is the absolute frequency of the output sound, in Hz. Default is 0.', + type: 'performance' + }, + ], + seeAlso: ['Soundfonts', 'https://flossmanual.csound.com/midi/reading-midi-files', 'http://en.wikipedia.org/wiki/Soundfont'] +}, +{ + name: 'sfinstr3m', + type: 'opcode', + category: 'Signal Generators:Sample Playback', + description: 'Plays a SoundFont2 (SF2) sample instrument, generating a mono sound with cubic interpolation.', + syntax: 'ares = sfinstr3m(ivel, inotenum, xamp, xfreq, instrnum, ifilhandle \\\n [, iflag] [, ioffset])', + example: '--8<-- "examples/sfinstr3m.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'ivel', + description: 'velocity value', + type: 'initialization' + }, + { + name: 'inotenum', + description: 'MIDI note number value', + type: 'initialization' + }, + { + name: 'instrnum', + description: 'number of an instrument of a SF2 file.', + type: 'initialization' + }, + { + name: 'ifilhandle', + description: 'unique number generated by _sfload_ opcode to be used as an identifier for a SF2 file. Several SF2 files can be loaded and activated at the same time.', + type: 'initialization' + }, + { + name: 'xamp', + description: 'amplitude correction factor', + type: 'performance' + }, + { + name: 'xfreq', + description: 'frequency value or frequency multiplier, depending by _iflag_. When _iflag_ = 0, _xfreq_ is a multiplier of a the default frequency, assigned by SF2 preset to the _inotenum_ value. When _iflag_ = 1, _xfreq_ is the absolute frequency of the output sound, in Hz. Default is 0.', + type: 'performance' + }, + ], + seeAlso: ['Soundfonts', 'https://flossmanual.csound.com/midi/reading-midi-files', 'http://en.wikipedia.org/wiki/Soundfont'] +}, +{ + name: 'sfinstrm', + type: 'opcode', + category: 'Signal Generators:Sample Playback', + description: 'Plays a SoundFont2 (SF2) sample instrument, generating a mono sound.', + syntax: 'ares = sfinstrm(ivel, inotenum, xamp, xfreq, instrnum, ifilhandle \\\n [, iflag] [, ioffset])', + rates: ['a-rate'], + parameters: [ + { + name: 'ivel', + description: 'velocity value', + type: 'initialization' + }, + { + name: 'inotenum', + description: 'MIDI note number value', + type: 'initialization' + }, + { + name: 'instrnum', + description: 'number of an instrument of a SF2 file.', + type: 'initialization' + }, + { + name: 'ifilhandle', + description: 'unique number generated by _sfload_ opcode to be used as an identifier for a SF2 file. Several SF2 files can be loaded and activated at the same time.', + type: 'initialization' + }, + { + name: 'xamp', + description: 'amplitude correction factor', + type: 'performance' + }, + { + name: 'xfreq', + description: 'frequency value or frequency multiplier, depending by _iflag_. When _iflag_ = 0, _xfreq_ is a multiplier of a the default frequency, assigned by SF2 preset to the _inotenum_ value. When _iflag_ = 1, _xfreq_ is the absolute frequency of the output sound, in Hz. Default is 0.', + type: 'performance' + }, + ], + seeAlso: ['Soundfonts', 'https://flossmanual.csound.com/midi/reading-midi-files', 'http://en.wikipedia.org/wiki/Soundfont'] +}, +{ + name: 'sfload', + type: 'opcode', + category: 'Signal Generators:Sample Playback', + description: 'Loads an entire SoundFont2 (SF2) sample file into memory.', + syntax: 'ir = sfload("filename")', + example: '--8<-- "examples/sfload.csd"', + parameters: [ + { + name: 'ir', + description: 'output to be used by other SF2 opcodes. For _sfload_, _ir_ is _ifilhandle_.', + type: 'initialization' + }, + ], + seeAlso: ['Soundfonts', 'https://flossmanual.csound.com/midi/reading-midi-files', 'http://en.wikipedia.org/wiki/Soundfont'] +}, +{ + name: 'sflooper', + type: 'opcode', + category: 'Signal Generators:Sample Playback', + description: 'Plays a SoundFont2 (SF2) sample preset, generating a stereo sound, with user-defined time-varying crossfade looping.', + syntax: 'ar1, ar2 = sflooper(ivel, inotenum, kamp, kpitch, ipreindex, kloopstart, \\\n kloopend, kcrossfade [, istart, imode, ifenv, iskip, iflag])', + example: '--8<-- "examples/sflooper.csd"', + rates: ['k-rate'], + parameters: [ + { + name: 'ivel', + description: 'velocity value', + type: 'initialization' + }, + { + name: 'inotenum', + description: 'MIDI note number value', + type: 'initialization' + }, + { + name: 'ipreindex', + description: 'preset index', + type: 'initialization' + }, + { + name: 'istart', + description: 'playback start pos in seconds', + type: 'initialization' + }, + { + name: 'imode', + description: 'loop modes: 0 forward, 1 backward, 2 back-and-forth [def: 0]', + type: 'initialization' + }, + { + name: 'ifenv', + description: 'if non-zero, crossfade envelope shape table number. The default, 0, sets the crossfade to linear.', + type: 'initialization' + }, + { + name: 'iskip', + description: 'if 1, the opcode initialisation is skipped, for tied notes, performance continues from the position in the loop where the previous note stopped. The default, 0, does not skip initialisation', + type: 'initialization' + }, + { + name: 'iflag', + description: 'flag regarding the behavior of _kpitch_ and _inotenum_', + type: 'initialization' + }, + { + name: 'kamp', + description: 'amplitude scaling', + type: 'performance' + }, + { + name: 'kpitch', + description: 'pitch control (transposition ratio, negative values are not allowed) or frequency multiplier, depending by iflag. When iflag = 0, kpitch is a multiplier of a the default frequency, assigned by SF2 preset to the inotenum value. When iflag = 1, kpitch is the absolute frequency of the output sound, in Hz. Default is 0. When iflag = 0, inotenum sets the frequency of the output according to the MIDI note number used, and kpitch is used as a multiplier. When iflag = 1, the frequency of the output, is set directly by kpitch. This allows the user to use any kind of micro-tuning based scales. However, this method is designed to work correctly only with presets tuned to the default equal temperament. Attempts to use this method with a preset already having non-standard tunings, or with drum-kit-based presets, could give unexpected results.', + type: 'performance' + }, + { + name: 'kloopstart', + description: 'loop start point (secs). Note that although k-rate, loop parameters such as this are only updated once per loop cycle. If loop start is set beyond the end of the sample, no looping will result.', + type: 'performance' + }, + { + name: 'kloopend', + description: 'loop end point (secs), updated once per loop cycle.', + type: 'performance' + }, + { + name: 'kcrossfade', + description: 'crossfade length (secs), updated once per loop cycle and limited to loop length.', + type: 'performance' + }, + ], + seeAlso: ['Soundfonts', 'https://flossmanual.csound.com/midi/reading-midi-files', 'http://en.wikipedia.org/wiki/Soundfont'] +}, +{ + name: 'sfpassign', + type: 'opcode', + category: 'Signal Generators:Sample Playback', + description: 'Assigns all presets of a SoundFont2 (SF2) sample file to a sequence of progressive index numbers.', + syntax: 'sfpassign(istartindex, ifilhandle[, imsgs])', + example: '--8<-- "examples/sfpassign.csd"', + parameters: [ + { + name: 'istartindex', + description: 'starting index preset by the user in bulk preset assignments.', + type: 'initialization' + }, + { + name: 'ifilhandle', + description: 'unique number generated by _sfload_ opcode to be used as an identifier for a SF2 file. Several SF2 files can be loaded and activated at the same time.', + type: 'initialization' + }, + { + name: 'imsgs', + description: 'if non-zero messages are suppressed.', + type: 'initialization' + }, + ], + seeAlso: ['Soundfonts', 'https://flossmanual.csound.com/midi/reading-midi-files', 'http://en.wikipedia.org/wiki/Soundfont'] +}, +{ + name: 'sfplay', + type: 'opcode', + category: 'Signal Generators:Sample Playback', + description: 'Plays a SoundFont2 (SF2) sample preset, generating a stereo sound.', + syntax: 'ar1, ar2 = sfplay(ivel, inotenum, xamp, xfreq, ipreindex [, iflag] \\\n [, ioffset] [, ienv])', + parameters: [ + { + name: 'ivel', + description: 'velocity value', + type: 'initialization' + }, + { + name: 'inotenum', + description: 'MIDI note number value', + type: 'initialization' + }, + { + name: 'ipreindex', + description: 'preset index', + type: 'initialization' + }, + { + name: 'xamp', + description: 'amplitude correction factor', + type: 'performance' + }, + { + name: 'xfreq', + description: 'frequency value or frequency multiplier, depending by _iflag_. When _iflag_ = 0, _xfreq_ is a multiplier of a the default frequency, assigned by SF2 preset to the _inotenum_ value. When _iflag_ = 1, _xfreq_ is the absolute frequency of the output sound, in Hz. Default is 0.', + type: 'performance' + }, + ], + seeAlso: ['Soundfonts', 'https://flossmanual.csound.com/midi/reading-midi-files', 'http://en.wikipedia.org/wiki/Soundfont'] +}, +{ + name: 'sfplay3', + type: 'opcode', + category: 'Signal Generators:Sample Playback', + description: 'Plays a SoundFont2 (SF2) sample preset, generating a stereo sound with cubic interpolation.', + syntax: 'ar1, ar2 = sfplay3(ivel, inotenum, xamp, xfreq, ipreindex [, iflag] \\\n [, ioffset] [, ienv])', + example: '--8<-- "examples/sfplay3.csd"', + parameters: [ + { + name: 'ivel', + description: 'velocity value', + type: 'initialization' + }, + { + name: 'inotenum', + description: 'MIDI note number value', + type: 'initialization' + }, + { + name: 'ipreindex', + description: 'preset index', + type: 'initialization' + }, + { + name: 'xamp', + description: 'amplitude correction factor', + type: 'performance' + }, + { + name: 'xfreq', + description: 'frequency value or frequency multiplier, depending by _iflag_. When _iflag_ = 0, _xfreq_ is a multiplier of a the default frequency, assigned by SF2 preset to the _inotenum_ value. When _iflag_ = 1, _xfreq_ is the absolute frequency of the output sound, in Hz. Default is 0.', + type: 'performance' + }, + ], + seeAlso: ['Soundfonts', 'https://flossmanual.csound.com/midi/reading-midi-files', 'http://en.wikipedia.org/wiki/Soundfont'] +}, +{ + name: 'sfplay3m', + type: 'opcode', + category: 'Signal Generators:Sample Playback', + description: 'Plays a SoundFont2 (SF2) sample preset, generating a mono sound with cubic interpolation.', + syntax: 'ares = sfplay3m(ivel, inotenum, xamp, xfreq, ipreindex [, iflag] \\\n [, ioffset] [, ienv])', + example: '--8<-- "examples/sfplay3m.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'ivel', + description: 'velocity value', + type: 'initialization' + }, + { + name: 'inotenum', + description: 'MIDI note number value', + type: 'initialization' + }, + { + name: 'ipreindex', + description: 'preset index', + type: 'initialization' + }, + { + name: 'xamp', + description: 'amplitude correction factor', + type: 'performance' + }, + { + name: 'xfreq', + description: 'frequency value or frequency multiplier, depending by _iflag_. When _iflag_ = 0, _xfreq_ is a multiplier of a the default frequency, assigned by SF2 preset to the _inotenum_ value. When _iflag_ = 1, _xfreq_ is the absolute frequency of the output sound, in Hz. Default is 0.', + type: 'performance' + }, + ], + seeAlso: ['Soundfonts', 'https://flossmanual.csound.com/midi/reading-midi-files', 'http://en.wikipedia.org/wiki/Soundfont'] +}, +{ + name: 'sfplaym', + type: 'opcode', + category: 'Signal Generators:Sample Playback', + description: 'Plays a SoundFont2 (SF2) sample preset, generating a mono sound.', + syntax: 'ares = sfplaym(ivel, inotenum, xamp, xfreq, ipreindex [, iflag] \\\n [, ioffset] [, ienv])', + example: '--8<-- "examples/sfplaym.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'ivel', + description: 'velocity value', + type: 'initialization' + }, + { + name: 'inotenum', + description: 'MIDI note number value', + type: 'initialization' + }, + { + name: 'ipreindex', + description: 'preset index', + type: 'initialization' + }, + { + name: 'xamp', + description: 'amplitude correction factor', + type: 'performance' + }, + { + name: 'xfreq', + description: 'frequency value or frequency multiplier, depending by _iflag_. When _iflag_ = 0, _xfreq_ is a multiplier of a the default frequency, assigned by SF2 preset to the _inotenum_ value. When _iflag_ = 1, _xfreq_ is the absolute frequency of the output sound, in Hz. Default is 0.', + type: 'performance' + }, + ], + seeAlso: ['Soundfonts', 'https://flossmanual.csound.com/midi/reading-midi-files', 'http://en.wikipedia.org/wiki/Soundfont'] +}, +{ + name: 'sfplist', + type: 'opcode', + category: 'Signal Generators:Sample Playback', + description: 'Prints a list of all presets of a previously loaded SoundFont2 (SF2) sample file.', + syntax: 'sfplist(ifilhandle)', + example: '--8<-- "examples/sfplist.csd"', + parameters: [ + { + name: 'ifilhandle', + description: 'unique number generated by _sfload_ opcode to be used as an identifier for a SF2 file. Several SF2 files can be loaded and activated at the same time.', + type: 'initialization' + }, + ], + seeAlso: ['Soundfonts', 'https://flossmanual.csound.com/midi/reading-midi-files', 'http://en.wikipedia.org/wiki/Soundfont'] +}, +{ + name: 'sfpreset', + type: 'opcode', + category: 'Signal Generators:Sample Playback', + description: 'Assigns an existing preset of a previously loaded SoundFont2 (SF2) sample file to an index number.', + syntax: 'ir = sfpreset(iprog, ibank, ifilhandle, ipreindex)', + example: '--8<-- "examples/sfpreset.csd"', + parameters: [ + { + name: 'ir', + description: 'output to be used by other SF2 opcodes. For _sfpreset_, _ir_ is _ipreindex_.', + type: 'initialization' + }, + { + name: 'iprog', + description: 'program number of a bank of presets in a SF2 file', + type: 'initialization' + }, + { + name: 'ibank', + description: 'number of a specific bank of a SF2 file', + type: 'initialization' + }, + { + name: 'ifilhandle', + description: 'unique number generated by _sfload_ opcode to be used as an identifier for a SF2 file. Several SF2 files can be loaded and activated at the same time.', + type: 'initialization' + }, + { + name: 'ipreindex', + description: 'preset index', + type: 'initialization' + }, + ], + seeAlso: ['Soundfonts', 'https://flossmanual.csound.com/midi/reading-midi-files', 'http://en.wikipedia.org/wiki/Soundfont'] +}, +{ + name: 'sndloop', + type: 'opcode', + category: 'Signal Generators:Sample Playback', + description: 'A sound looper with pitch control.', + syntax: 'asig, krec = sndloop(ain, kpitch, ktrig, idur, ifad)', + example: '--8<-- "examples/sndloop.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'idur', + description: 'loop duration in seconds', + type: 'initialization' + }, + { + name: 'ifad', + description: 'crossfade duration in seconds', + type: 'initialization' + }, + { + name: 'asig', + description: 'output sig', + type: 'performance' + }, + { + name: 'krec', + description: '\'rec on\' signal, 1 when recording, 0 otherwise', + type: 'performance' + }, + { + name: 'kpitch', + description: 'pitch control (transposition ratio); negative values play the loop back in reverse', + type: 'performance' + }, + { + name: 'ktrig', + description: 'trigger signal: when 0, processing is bypassed. When switched on (ktrig >= 1), the opcode starts recording until the loop memory is full. It then plays the looped sound until it is switched off again (ktrig = 0). Another recording can start again with ktrig >= 1.', + type: 'performance' + }, + ], + seeAlso: ['Sample Playback'] +}, +] diff --git a/src/lib/csound-reference/signal-generators-scanned-synthesis.ts b/src/lib/csound-reference/signal-generators-scanned-synthesis.ts new file mode 100644 index 0000000..e54bc67 --- /dev/null +++ b/src/lib/csound-reference/signal-generators-scanned-synthesis.ts @@ -0,0 +1,381 @@ +import type { CsoundReference } from './types' + +// Signal Generators:Scanned Synthesis +export const signalGeneratorsScannedSynthesis: CsoundReference[] = [ +{ + name: 'scanhammer', + type: 'opcode', + category: 'Signal Generators:Scanned Synthesis', + description: 'Copies from one table to another with a gain control.', + syntax: 'scanhammer(isrc, idst, ipos, imult)', + example: '--8<-- "examples/scanhammer.csd"', + parameters: [ + { + name: 'isrc', + description: 'source function table.', + type: 'initialization' + }, + { + name: 'idst', + description: 'destination function table.', + type: 'initialization' + }, + { + name: 'ipos', + description: 'starting position (in points).', + type: 'initialization' + }, + { + name: 'imult', + description: 'gain multiplier. A value of 0 will leave values unchanged.', + type: 'initialization' + }, + ], + seeAlso: ['Scanned Synthesis', 'Working with Scanned Synthesis', 'tutorials'] +}, +{ + name: 'scanmap', + type: 'opcode', + category: 'Signal Generators:Scanned Synthesis', + description: 'Allows the position and velocity of a node in a scanned process to be read.', + syntax: 'kpos, kvel = scanmap(iscan, kamp, kvamp [, iwhich])', + example: '--8<-- "examples/scanmap.csd"', + rates: ['k-rate'], + parameters: [ + { + name: 'iscan', + description: 'which scan process to read', + type: 'initialization' + }, + { + name: 'kamp', + description: 'amount to amplify the _kpos_ value.', + type: 'performance' + }, + { + name: 'kvamp', + description: 'amount to amplify the _kvel_ value.', + type: 'performance' + }, + ], + seeAlso: ['Scanned Synthesis', 'Working with Scanned Synthesis', 'tutorials'] +}, +{ + name: 'scans', + type: 'opcode', + category: 'Signal Generators:Scanned Synthesis', + description: 'Generate audio output using scanned synthesis.', + syntax: 'ares = scans(kamp, kfreq, ifn, id [, iorder])', + example: '--8<-- "examples/scans.csd"', + rates: ['a-rate', 'k-rate', 'i-rate'], + parameters: [ + { + name: 'ifn', + description: 'ftable containing the scanning trajectory. This is a series of numbers that contains addresses of masses. The order of these addresses is used as the scan path. It should not contain values greater than the number of masses, or negative numbers. See the [introduction to the scanned synthesis section](../siggen/scantop.md).', + type: 'initialization' + }, + { + name: 'id', + description: 'ID number of the [scanu](../opcodes/scanu.md) opcode\'s waveform to use', + type: 'initialization' + }, + { + name: 'kamp', + description: 'output amplitude. Note that the resulting amplitude is also dependent on instantaneous value in the wavetable. This number is effectively the scaling factor of the wavetable.', + type: 'performance' + }, + { + name: 'kfreq', + description: 'frequency of the scan rate', + type: 'performance' + }, + ], + seeAlso: ['Scanned Synthesis', 'Working with Scanned Synthesis', 'tutorials'] +}, +{ + name: 'scansmap', + type: 'opcode', + category: 'Signal Generators:Scanned Synthesis', + description: 'Allows the position and velocity of a node in a scanned process to be written.', + syntax: 'scansmap(kpos, kvel, iscan, kamp, kvamp [, iwhich])', + example: '--8<-- "examples/scansmap.csd"', + rates: ['k-rate'], + parameters: [ + { + name: 'iscan', + description: 'which scan process to write', + type: 'initialization' + }, + { + name: 'kpos', + description: 'the node\'s position.', + type: 'performance' + }, + { + name: 'kvel', + description: 'the node\'s velocity.', + type: 'performance' + }, + { + name: 'kamp', + description: 'amount to amplify the _kpos_ value.', + type: 'performance' + }, + { + name: 'kvamp', + description: 'amount to amplify the _kvel_ value.', + type: 'performance' + }, + ], + seeAlso: ['Scanned Synthesis', 'Working with Scanned Synthesis', 'tutorials'] +}, +{ + name: 'scantable', + type: 'opcode', + category: 'Signal Generators:Scanned Synthesis', + description: 'A simpler scanned synthesis implementation.', + syntax: 'aout = scantable(kamp, kpch, ipos, imass, istiff, idamp, ivel)', + example: '--8<-- "examples/scantable.csd"', + rates: ['k-rate'], + parameters: [ + { + name: 'ipos', + description: 'table containing position array.', + type: 'initialization' + }, + { + name: 'imass', + description: 'table containing the mass of the string.', + type: 'initialization' + }, + { + name: 'istiff', + description: 'table containing the stiffness of the string.', + type: 'initialization' + }, + { + name: 'idamp', + description: 'table containing the damping factors of the string.', + type: 'initialization' + }, + { + name: 'ivel', + description: 'table containing the velocities.', + type: 'initialization' + }, + { + name: 'kamp', + description: 'amplitude (gain) of the string.', + type: 'performance' + }, + { + name: 'kpch', + description: 'the string\'s scanned frequency.', + type: 'performance' + }, + ], + seeAlso: ['Scanned Synthesis', 'Working with Scanned Synthesis', 'tutorials'] +}, +{ + name: 'scanu', + type: 'opcode', + category: 'Signal Generators:Scanned Synthesis', + description: 'Compute the waveform and the wavetable for use in scanned synthesis.', + syntax: 'scanu(init, irate, ifndisplace, ifnmass, ifnmatrix, ifncentr, ifndamp, \\\n kmass, kmtrxstiff, kcentr, kdamp, ileft, iright, kpos, kdisplace, \\\n ain, idisp, id)', + example: '--8<-- "examples/scanu.csd"', + parameters: [ + { + name: 'init', + description: 'the initial position of the masses. If this is a negative number, then the absolute of _init_ signifies the table to use as a hammer shape. If _init_ > 0, the length of it should be the same as the intended mass number, otherwise it can be anything.', + type: 'initialization' + }, + { + name: 'irate', + description: 'the amount of time between successive updates of the mass state. Kind of like the sample period of the system. If the number is big, the string will update at a slow rate showing little timbral variability; otherwise it will change rapidly resulting in a more dynamic sound.', + type: 'initialization' + }, + { + name: 'ifndisplace', + description: 'the ftable that contains the initial velocity for each mass. It should have the same size as the intended mass number.', + type: 'initialization' + }, + { + name: 'ifnmass', + description: 'ftable that contains the mass of each mass. It should have the same size as the intended mass number.', + type: 'initialization' + }, + { + name: 'ifnmatrix', + description: 'ftable that contains the spring stiffness of each connection. It should have the same size as the square of the intended mass number. The data ordering is a row after row dump of the connection matrix of the system.', + type: 'initialization' + }, + { + name: 'ifncentr', + description: 'ftable that contains the centering force of each mass. It should have the same size as the intended mass number.', + type: 'initialization' + }, + { + name: 'ifndamp', + description: 'the ftable that contains the damping factor of each mass. It should have the same size as the intended mass number.', + type: 'initialization' + }, + { + name: 'ileft', + description: 'If _init_ < 0, the position of the left hammer (_ileft_ = 0 is hit at leftmost, _ileft_ = 1 is hit at rightmost). Ignored when _init_ > 0.', + type: 'initialization' + }, + { + name: 'iright', + description: 'If _init_ < 0, the position of the right hammer (_iright_ = 0 is hit at leftmost, _iright_ = 1 is hit at rightmost). Ignored when _init_ > 0.', + type: 'initialization' + }, + { + name: 'idisp', + description: 'If 0, no display of the masses is provided.', + type: 'initialization' + }, + { + name: 'id', + description: 'If positive, the ID of the opcode. This will be used to point the scanning opcode to the proper waveform maker. If this value is negative, the absolute of this value is the wavetable on which to write the waveshape. That wavetable can be used later from an other opcode to generate sound. The initial contents of this table will be destroyed.', + type: 'initialization' + }, + { + name: 'kmass', + description: 'scales the masses', + type: 'performance' + }, + { + name: 'kmtrxstiff', + description: 'scales the spring stiffness.', + type: 'performance' + }, + { + name: 'kcentr', + description: 'scales the centering force', + type: 'performance' + }, + { + name: 'kdamp', + description: 'scales the damping', + type: 'performance' + }, + { + name: 'kpos', + description: 'position of an active hammer along the string (_kpos_ = 0 is leftmost, _kpos_ = 1 is rightmost). The shape of the hammer is determined by _init_ and the power it pushes with is _kdisplace_.', + type: 'performance' + }, + { + name: 'kdisplace', + description: 'power that the active hammer uses.', + type: 'performance' + }, + { + name: 'ain', + description: 'audio input that adds to the velocity of the masses. Amplitude should not be too great.', + type: 'performance' + }, + ], + seeAlso: ['Scanned Synthesis', 'Working with Scanned Synthesis', 'tutorials'] +}, +{ + name: 'scanu2', + type: 'opcode', + category: 'Signal Generators:Scanned Synthesis', + description: 'Compute the waveform and the wavetable for use in scanned synthesis.', + syntax: 'scanu2(init, irate, ifndisplace,ifnmass, ifnmatrix, ifncentr, ifndamp, \\\n kmass, kmtrxstiff, kcentr, kdamp, ileft, iright, kpos, kdisplace, \\\n ain, idisp, id)', + example: '--8<-- "examples/scanu2.csd"', + parameters: [ + { + name: 'init', + description: 'the initial position of the masses. If this is a negative number, then the absolute of _init_ signifies the table to use as a hammer shape. If _init_ > 0, the length of it should be the same as the intended mass number, otherwise it can be anything. If _init_ is not an integer the initial state is white noise with the fractional part being a scaling..', + type: 'initialization' + }, + { + name: 'irate', + description: 'the amount of time between successive updates of the mass state. Kind of like the sample period of the system. If the number is big, the string will update at a slow rate showing little timbral variability; otherwise it will change rapidly resulting in a more dynamic sound.', + type: 'initialization' + }, + { + name: 'ifndisplace', + description: 'the ftable that contains the initial velocity for each mass. It should have the same size as the intended mass number.', + type: 'initialization' + }, + { + name: 'ifnmass', + description: 'ftable that contains the mass of each mass. It should have the same size as the intended mass number.', + type: 'initialization' + }, + { + name: 'ifnmatrix', + description: 'ftable that contains the spring stiffness of each connection. It should have the same size as the square of the intended mass number. The data ordering is a row after row dump of the connection matrix of the system.', + type: 'initialization' + }, + { + name: 'ifncentr', + description: 'ftable that contains the centering force of each mass. It should have the same size as the intended mass number.', + type: 'initialization' + }, + { + name: 'ifndamp', + description: 'the ftable that contains the damping factor of each mass. It should have the same size as the intended mass number.', + type: 'initialization' + }, + { + name: 'ileft', + description: 'If _init_ < 0, the position of the positive pluck in the range 0 to 1. Ignored when _init_ > 0.', + type: 'initialization' + }, + { + name: 'iright', + description: 'If _init_ < 0, the position of the negative pluck in the range 0 to 1. Ignored when _init_ > 0.', + type: 'initialization' + }, + { + name: 'idisp', + description: 'If 0, no display of the masses is provided.', + type: 'initialization' + }, + { + name: 'id', + description: 'If positive, the ID of the opcode. This will be used to point the scanning opcode to the proper waveform maker. If this value is negative, the absolute of this value is the wavetable on which to write the waveshape. That wavetable can be used later from an other opcode to generate sound. The initial contents of this table will be destroyed.', + type: 'initialization' + }, + { + name: 'kmass', + description: 'scales the masses', + type: 'performance' + }, + { + name: 'kmtrxstiff', + description: 'scales the spring stiffness. Note that larger numbers slow the evolution of the vibration, which is the reciprocal of the coresponding parameter in scanu.', + type: 'performance' + }, + { + name: 'kcentr', + description: 'scales the centering force', + type: 'performance' + }, + { + name: 'kdamp', + description: 'scales the damping', + type: 'performance' + }, + { + name: 'kpos', + description: 'position of an active hammer along the string (_kpos_ = 0 is leftmost, _kpos_ = 1 is rightmost). The shape of the hammer is determined by _init_ and the power it pushes with is _kdisplace_.', + type: 'performance' + }, + { + name: 'kdisplace', + description: 'power that the active hammer uses.', + type: 'performance' + }, + { + name: 'ain', + description: 'audio input that adds to the velocity of the masses. Amplitude should not be too great.', + type: 'performance' + }, + ], + seeAlso: ['Scanned Synthesis', 'Working with Scanned Synthesis', 'tutorials'] +}, +] diff --git a/src/lib/csound-reference/signal-generators-table-access.ts b/src/lib/csound-reference/signal-generators-table-access.ts new file mode 100644 index 0000000..7812ab3 --- /dev/null +++ b/src/lib/csound-reference/signal-generators-table-access.ts @@ -0,0 +1,69 @@ +import type { CsoundReference } from './types' + +// Signal Generators:Table Access +export const signalGeneratorsTableAccess: CsoundReference[] = [ +{ + name: 'oscil1', + type: 'opcode', + category: 'Signal Generators:Table Access', + description: 'Accesses table values by incremental sampling.', + syntax: 'kres = oscil1(idel, kamp, idur [, ifn])', + example: '--8<-- "examples/oscil1.csd"', + rates: ['k-rate', 'i-rate'], + parameters: [ + { + name: 'idel', + description: 'delay in seconds before _oscil1_ incremental sampling begins.', + type: 'initialization' + }, + { + name: 'idur', + description: 'duration in seconds to sample through the _oscil1_ table just once. A negative value will make the table be read from the end to the beginning.', + type: 'initialization' + }, + { + name: 'ifn', + description: '(optional) function table number. _tablei, oscil1i_ require the extended guard point. The number defaults to -1 which indicates a sinewave.', + type: 'initialization' + }, + { + name: 'kamp', + description: 'amplitude factor.', + type: 'performance' + }, + ], + seeAlso: ['Table Access'] +}, +{ + name: 'oscil1i', + type: 'opcode', + category: 'Signal Generators:Table Access', + description: 'Accesses table values by incremental sampling with linear interpolation.', + syntax: 'kres = oscil1i(idel, kamp, idur [, ifn])', + example: '--8<-- "examples/oscil1i.csd"', + rates: ['k-rate', 'i-rate'], + parameters: [ + { + name: 'idel', + description: 'delay in seconds before _oscil1i_ incremental sampling begins.', + type: 'initialization' + }, + { + name: 'idur', + description: 'duration in seconds to sample through the _oscil1i_ table just once. A negative value will make the table be read from the end to the beginning.', + type: 'initialization' + }, + { + name: 'ifn', + description: '(optional) function table number. _oscil1i_ requires the extended guard point. The default value is -1 indicating a sine wave.', + type: 'initialization' + }, + { + name: 'kamp', + description: 'amplitude factor', + type: 'performance' + }, + ], + seeAlso: ['Table Access'] +}, +] diff --git a/src/lib/csound-reference/signal-generators-wave-terrain-synthesis.ts b/src/lib/csound-reference/signal-generators-wave-terrain-synthesis.ts new file mode 100644 index 0000000..2d954bf --- /dev/null +++ b/src/lib/csound-reference/signal-generators-wave-terrain-synthesis.ts @@ -0,0 +1,67 @@ +import type { CsoundReference } from './types' + +// Signal Generators:Wave Terrain Synthesis +export const signalGeneratorsWaveTerrainSynthesis: CsoundReference[] = [ +{ + name: 'sterrain', + type: 'opcode', + category: 'Signal Generators:Wave Terrain Synthesis', + description: 'A wave-terrain synthesis opcode using curves computed with the superformula.', + syntax: 'aout = sterrain(kamp, kcps, kx, ky, krx, kry, krot, ktab0, ktab1, km1, km2, \\\n kn1, kn2, kn3, ka, kb, kperiod)', + example: '--8<-- "examples/sterrain.csd"', + rates: ['k-rate'], + parameters: [ + { + name: 'ktabx', + description: 'The two tables that define the terrain - they can be changed at krate.', + type: 'performance' + }, + { + name: 'ktaby', + description: 'The two tables that define the terrain - they can be changed at krate.', + type: 'performance' + }, + { + name: 'kn1', + description: '!=0 and continous.', + type: 'performance' + }, + { + name: 'ka', + description: '!=0 and continous.', + type: 'performance' + }, + { + name: 'kb', + description: '!=0 and continous.', + type: 'performance' + }, + { + name: 'kn2', + description: 'continous.', + type: 'performance' + }, + { + name: 'kn3', + description: 'continous.', + type: 'performance' + }, + { + name: 'km1', + description: 'positive integer > 0: note that the curves are not on all combinations of km1,km2 closed and have poles (closed in infinity) for example if kn1>0 and there exists an n,m in Z with 2*km1/km2 = 2m+1/n i.e curves with (3,2) (5,2) (7,2) etc and (5,4) (6,4) (7,4) (9,4) etc. have a pole which is noticeable when listening. If kn1 < 0 then the curve is reversed and the poles go towards zero in this case. If km1 and km2 are zero silence is produced (a plain circ - same effect occurs with the tuple 2,2,2,2,2,1,1).', + type: 'performance' + }, + { + name: 'km2', + description: 'positive integer > 0: note that the curves are not on all combinations of km1,km2 closed and have poles (closed in infinity) for example if kn1>0 and there exists an n,m in Z with 2*km1/km2 = 2m+1/n i.e curves with (3,2) (5,2) (7,2) etc and (5,4) (6,4) (7,4) (9,4) etc. have a pole which is noticeable when listening. If kn1 < 0 then the curve is reversed and the poles go towards zero in this case. If km1 and km2 are zero silence is produced (a plain circ - same effect occurs with the tuple 2,2,2,2,2,1,1).', + type: 'performance' + }, + { + name: 'kperiod', + description: 'some km1 and km2 ratios may cause pitch shifts. With the kperiod parameter this can be fixed. If the ratio is 1 then the kperiod value should also be set to km1 to get the incoming pitch out.', + type: 'performance' + }, + ], + seeAlso: ['Wave Terrain Synthesis'] +}, +] diff --git a/src/lib/csound-reference/signal-generators-waveguide-physical-modeling.ts b/src/lib/csound-reference/signal-generators-waveguide-physical-modeling.ts new file mode 100644 index 0000000..4002c61 --- /dev/null +++ b/src/lib/csound-reference/signal-generators-waveguide-physical-modeling.ts @@ -0,0 +1,106 @@ +import type { CsoundReference } from './types' + +// Signal Generators:Waveguide Physical Modeling +export const signalGeneratorsWaveguidePhysicalModeling: CsoundReference[] = [ +{ + name: 'pluck', + type: 'opcode', + category: 'Signal Generators:Waveguide Physical Modeling', + description: 'Produces a naturally decaying plucked string or drum sound.', + syntax: 'ares = pluck(kamp, kcps, icps, ifn, imeth [, iparm1] [, iparm2])', + example: '--8<-- "examples/pluck.csd"', + rates: ['a-rate', 'k-rate', 'i-rate'], + parameters: [ + { + name: 'icps', + description: 'intended pitch value in Hz, used to set up a buffer of 1 cycle of audio samples which will be smoothed over time by a chosen decay method. _icps_ normally anticipates the value of _kcps_, but may be set artificially high or low to influence the size of the sample buffer.', + type: 'initialization' + }, + { + name: 'ifn', + description: 'table number of a stored function used to initialize the cyclic decay buffer. If _ifn_ = 0, a random sequence will be used instead.', + type: 'initialization' + }, + { + name: 'imeth', + description: 'method of natural decay. There are six, some of which use parameters values that follow.', + type: 'initialization' + }, + { + name: 'kamp', + description: 'the output amplitude.', + type: 'performance' + }, + { + name: 'kcps', + description: 'the resampling frequency in cycles-per-second.', + type: 'performance' + }, + ], + seeAlso: ['Waveguide Physical Modeling'] +}, +{ + name: 'repluck', + type: 'opcode', + category: 'Signal Generators:Waveguide Physical Modeling', + description: 'Physical model of the plucked string.', + syntax: 'ares = repluck(iplk, kamp, icps, kpick, krefl, axcite)', + example: '--8<-- "examples/repluck.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'iplk', + description: 'The point of pluck is _iplk_, which is a fraction of the way up the string (0 to 1). A pluck point of zero means no initial pluck.', + type: 'initialization' + }, + { + name: 'icps', + description: 'The string plays at _icps_ pitch.', + type: 'initialization' + }, + { + name: 'kamp', + description: 'Amplitude of note.', + type: 'performance' + }, + { + name: 'kpick', + description: 'Proportion of the way along the string to sample the output.', + type: 'performance' + }, + { + name: 'krefl', + description: 'the coefficient of reflection, indicating the lossiness and the rate of decay. It must be strictly between 0 and 1 (it will complain about both 0 and 1).', + type: 'performance' + }, + ], + seeAlso: ['Waveguide Physical Modeling'] +}, +{ + name: 'streson', + type: 'opcode', + category: 'Signal Generators:Waveguide Physical Modeling', + description: 'A string resonator with variable fundamental frequency.', + syntax: 'ares = streson(asig, kfr, kfdbgain)', + example: '--8<-- "examples/streson.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'asig', + description: 'the input audio signal.', + type: 'performance' + }, + { + name: 'kfr', + description: 'the fundamental frequency of the string.', + type: 'performance' + }, + { + name: 'kfdbgain', + description: 'feedback gain, typically between 0 and 1, of the internal delay line. A value close to 1 creates a slower decay and a more pronounced resonance. Small values may leave the input signal unaffected. Depending on the filter frequency, typical values are > 0.9. Values down to -1 are also useful.', + type: 'performance' + }, + ], + seeAlso: ['Waveguides'] +}, +] diff --git a/src/lib/csound-reference/signal-i-o-file-i-o.ts b/src/lib/csound-reference/signal-i-o-file-i-o.ts new file mode 100644 index 0000000..97e9ba4 --- /dev/null +++ b/src/lib/csound-reference/signal-i-o-file-i-o.ts @@ -0,0 +1,603 @@ +import type { CsoundReference } from './types' + +// Signal I/O:File I/O +export const signalIOFileIO: CsoundReference[] = [ +{ + name: 'dumpk', + type: 'opcode', + category: 'Signal I/O:File I/O', + description: 'Periodically writes an orchestra control-signal value to a named external file in a specific format.', + syntax: 'dumpk(ksig, ifilname, iformat, iprd)', + example: '--8<-- "examples/dumpk.csd"', + parameters: [ + { + name: 'ifilname', + description: 'character string (in double quotes, spaces permitted) denoting the external file name. May either be a full path name with target directory specified or a simple filename to be created within the current directory', + type: 'initialization' + }, + { + name: 'iformat', + description: 'specifies the output data format:', + type: 'initialization' + }, + { + name: 'iprd', + description: 'the period of _ksig_ output in seconds, rounded to the nearest orchestra control period. A value of 0 implies one control period (the enforced minimum), which will create an output file sampled at the orchestra control rate.', + type: 'initialization' + }, + { + name: 'ksig', + description: 'a control-rate signal', + type: 'performance' + }, + ], + seeAlso: ['File Input and Output'] +}, +{ + name: 'dumpk2', + type: 'opcode', + category: 'Signal I/O:File I/O', + description: 'Periodically writes two orchestra control-signal values to a named external file in a specific format.', + syntax: 'dumpk2(ksig1, ksig2, ifilname, iformat, iprd)', + example: '--8<-- "examples/dumpk2.csd"', + parameters: [ + { + name: 'ifilname', + description: 'character string (in double quotes, spaces permitted) denoting the external file name. May either be a full path name with target directory specified or a simple filename to be created within the current directory', + type: 'initialization' + }, + { + name: 'iformat', + description: 'specifies the output data format:', + type: 'initialization' + }, + { + name: 'iprd', + description: 'the period of _ksig_ output in seconds, rounded to the nearest orchestra control period. A value of 0 implies one control period (the enforced minimum), which will create an output file sampled at the orchestra control rate.', + type: 'initialization' + }, + { + name: 'ksig1', + description: 'control-rate signals.', + type: 'performance' + }, + { + name: 'ksig2', + description: 'control-rate signals.', + type: 'performance' + }, + ], + seeAlso: ['File Input and Output'] +}, +{ + name: 'dumpk3', + type: 'opcode', + category: 'Signal I/O:File I/O', + description: 'Periodically writes three orchestra control-signal values to a named external file in a specific format.', + syntax: 'dumpk3(ksig1, ksig2, ksig3, ifilname, iformat, iprd)', + example: '--8<-- "examples/dumpk3.csd"', + parameters: [ + { + name: 'ifilname', + description: 'character string (in double quotes, spaces permitted) denoting the external file name. May either be a full path name with target directory specified or a simple filename to be created within the current directory', + type: 'initialization' + }, + { + name: 'iformat', + description: 'specifies the output data format:', + type: 'initialization' + }, + { + name: 'iprd', + description: 'the period of _ksig_ output in seconds, rounded to the nearest orchestra control period. A value of 0 implies one control period (the enforced minimum), which will create an output file sampled at the orchestra control rate.', + type: 'initialization' + }, + { + name: 'ksig1', + description: 'control-rate signals', + type: 'performance' + }, + { + name: 'ksig2', + description: 'control-rate signals', + type: 'performance' + }, + { + name: 'ksig3', + description: 'control-rate signals', + type: 'performance' + }, + ], + seeAlso: ['File Input and Output'] +}, +{ + name: 'dumpk4', + type: 'opcode', + category: 'Signal I/O:File I/O', + description: 'Periodically writes four orchestra control-signal values to a named external file in a specific format.', + syntax: 'dumpk4(ksig1, ksig2, ksig3, ksig4, ifilname, iformat, iprd)', + example: '--8<-- "examples/dumpk4.csd"', + parameters: [ + { + name: 'ifilname', + description: 'character string (in double quotes, spaces permitted) denoting the external file name. May either be a full path name with target directory specified or a simple filename to be created within the current directory', + type: 'initialization' + }, + { + name: 'iformat', + description: 'specifies the output data format:', + type: 'initialization' + }, + { + name: 'iprd', + description: 'the period of _ksig_ output in seconds, rounded to the nearest orchestra control period. A value of 0 implies one control period (the enforced minimum), which will create an output file sampled at the orchestra control rate.', + type: 'initialization' + }, + { + name: 'ksig1', + description: 'control-rate signals', + type: 'performance' + }, + { + name: 'ksig2', + description: 'control-rate signals', + type: 'performance' + }, + { + name: 'ksig3', + description: 'control-rate signals', + type: 'performance' + }, + { + name: 'ksig4', + description: 'control-rate signals', + type: 'performance' + }, + ], + seeAlso: ['File Input and Output'] +}, +{ + name: 'ficlose', + type: 'opcode', + category: 'Signal I/O:File I/O', + description: 'Closes a previously opened file.', + syntax: 'ficlose(ihandle)\n ficlose(Sfilename)', + example: '--8<-- "examples/ficlose.csd"', + parameters: [ + { + name: 'ihandle', + description: 'a number which identifies this file (generated by a previous [fiopen](../opcodes/fiopen.md)).', + type: 'initialization' + }, + { + name: 'Sfilename', + description: 'A string in double quotes or string variable with the filename. The full path must be given if the file directory is not in the system PATH and is not present in the current directory.', + type: 'initialization' + }, + ], + seeAlso: ['File Input and Output'] +}, +{ + name: 'fin', + type: 'opcode', + category: 'Signal I/O:File I/O', + description: 'Read signals from a file at a-rate.', + syntax: 'fin(ifilename, iskipframes, iformat, ain1 [, ain2] [, ain3] [,...])\n fin(ifilename, iskipframes, iformat, arr[])', + example: '--8<-- "examples/fin.csd"', + parameters: [ + { + name: 'ifilename', + description: 'input file name (can be a string or a handle number generated by [fiopen](../opcodes/fiopen.md)).', + type: 'initialization' + }, + { + name: 'iskipframes', + description: 'number of frames to skip at the start (every frame contains a sample of each channel)', + type: 'initialization' + }, + { + name: 'iformat', + description: 'a number specifying the input file format for headerless files.', + type: 'initialization' + }, + ], + seeAlso: ['File Input and Output'] +}, +{ + name: 'fini', + type: 'opcode', + category: 'Signal I/O:File I/O', + description: 'Read signals from a file at i-rate.', + syntax: 'fini(ifilename, iskipframes, iformat, in1 [, in2] [, in3] [, ...])', + example: '--8<-- "examples/fini.csd"', + parameters: [ + { + name: 'ifilename', + description: 'input file name (can be a string or a handle number generated by [fiopen](../opcodes/fiopen.md))', + type: 'initialization' + }, + { + name: 'iskipframes', + description: 'number of frames to skip at the start (every frame contains a sample of each channel)', + type: 'initialization' + }, + { + name: 'iformat', + description: 'a number specifying the input file format. If a header is found, this argument is ignored.', + type: 'initialization' + }, + ], + seeAlso: ['File Input and Output'] +}, +{ + name: 'fink', + type: 'opcode', + category: 'Signal I/O:File I/O', + description: 'Read signals from a file at k-rate.', + syntax: 'fink(ifilename, iskipframes, iformat, kin1 [, kin2] [, kin3] [,...])', + example: '--8<-- "examples/fink.csd"', + parameters: [ + { + name: 'ifilename', + description: 'input file name (can be a string or a handle number generated by [fiopen](../opcodes/fiopen.md))', + type: 'initialization' + }, + { + name: 'iskipframes', + description: 'number of frames to skip at the start (every frame contains a sample of each channel)', + type: 'initialization' + }, + { + name: 'iformat', + description: 'a number specifying the input file format. If a header is found, this argument is ignored.', + type: 'initialization' + }, + ], + seeAlso: ['File Input and Output'] +}, +{ + name: 'fiopen', + type: 'opcode', + category: 'Signal I/O:File I/O', + description: 'Opens a file in a specific mode.', + syntax: 'ihandle = fiopen(ifilename, imode)', + example: '--8<-- "examples/fiopen.csd"', + parameters: [ + { + name: 'ihandle', + description: 'a number which specifies this file.', + type: 'initialization' + }, + { + name: 'ifilename', + description: 'the target file\'s name (in double-quotes).', + type: 'initialization' + }, + { + name: 'imode', + description: 'choose the mode of opening the file. _imode_ can be a value chosen among the following:', + type: 'initialization' + }, + ], + seeAlso: ['File Input and Output'] +}, +{ + name: 'fout', + type: 'opcode', + category: 'Signal I/O:File I/O', + description: 'Outputs a-rate signals to a specified file of an arbitrary number of channels.', + syntax: 'fout(ifilename, iformat, aout1 [, aout2, aout3,...,aoutN])\n fout(ifilename, iformat, array[])', + example: '--8<-- "examples/fout.csd"', + parameters: [ + { + name: 'ifilename', + description: 'the output file\'s name (in double-quotes).', + type: 'initialization' + }, + { + name: 'iformat', + description: 'a flag to choose output file format (note: Csound versions older than 5.0 may only support formats 0, 1, and 2):', + type: 'initialization' + }, + ], + seeAlso: ['File Input and Output'] +}, +{ + name: 'fouti', + type: 'opcode', + category: 'Signal I/O:File I/O', + description: 'Outputs i-rate signals of an arbitrary number of channels to a specified file.', + syntax: 'fouti(ihandle, iformat, iflag, iout1 [, iout2, iout3,....,ioutN])', + example: '--8<-- "examples/fouti.csd"', + parameters: [ + { + name: 'ihandle', + description: 'a number which specifies this file.', + type: 'initialization' + }, + { + name: 'iformat', + description: 'a flag to choose output file format:', + type: 'initialization' + }, + { + name: 'iflag', + description: 'choose the mode of writing to the ASCII file (valid only in ASCII mode; in binary mode _iflag_ has no meaning, but it must be present anyway). _iflag_ can be a value chosen among the following:', + type: 'initialization' + }, + ], + seeAlso: ['File Input and Output'] +}, +{ + name: 'foutir', + type: 'opcode', + category: 'Signal I/O:File I/O', + description: 'Outputs i-rate signals from an arbitrary number of channels to a specified file.', + syntax: 'foutir(ihandle, iformat, iflag, iout1 [, iout2, iout3,....,ioutN])', + example: '--8<-- "examples/foutir.csd"', + parameters: [ + { + name: 'ihandle', + description: 'a number which specifies this file.', + type: 'initialization' + }, + { + name: 'iformat', + description: 'a flag to choose output file format:', + type: 'initialization' + }, + { + name: 'iflag', + description: 'choose the mode of writing to the ASCII file (valid only in ASCII mode; in binary mode _iflag_ has no meaning, but it must be present anyway). _iflag_ can be a value chosen among the following:', + type: 'initialization' + }, + ], + seeAlso: ['File Input and Output'] +}, +{ + name: 'foutk', + type: 'opcode', + category: 'Signal I/O:File I/O', + description: 'Outputs k-rate signals of an arbitrary number of channels to a specified file, in raw (headerless) format.', + syntax: 'foutk(ifilename, iformat, kout1 [, kout2, kout3,....,koutN])', + example: '--8<-- "examples/foutk.csd"', + parameters: [ + { + name: 'ifilename', + description: 'the output file\'s name (in double-quotes).', + type: 'initialization' + }, + { + name: 'iformat', + description: 'a flag to choose output file format (note: Csound versions older than 5.0 may only support formats 0 and 1):', + type: 'initialization' + }, + ], + seeAlso: ['File Input and Output'] +}, +{ + name: 'fprintks', + type: 'opcode', + category: 'Signal I/O:File I/O', + description: 'Similar to [printks](../opcodes/printks.md) but prints to a file.', + syntax: 'fprintks("filename", "string", [, kval1] [, kval2] [...])', + example: '--8<-- "examples/fprintks.csd"', + seeAlso: ['File Input and Output'] +}, +{ + name: 'fprints', + type: 'opcode', + category: 'Signal I/O:File I/O', + description: 'Similar to [prints](../opcodes/prints.md) but prints to a file.', + syntax: 'fprints("filename", "string" [, ival1] [, ival2] [...])', + example: '--8<-- "examples/fprints.csd"', + seeAlso: ['File Input and Output'] +}, +{ + name: 'readf', + type: 'opcode', + category: 'Signal I/O:File I/O', + description: 'Read a line of text from an external file once each k-cycle.', + syntax: 'Sres, kline = readf(ifilname)', + example: '--8<-- "examples/readf.csd"', + parameters: [ + { + name: 'ifilname', + description: 'an integer N denoting a file named "input.N" or a character string (in double quotes, spaces permitted) denoting the external file name. For a string, it may either be a full path name with directory specified or a simple filename. In the later case, the file is sought first in the current directory, then in SSDIR, and finally in SFDIR.', + type: 'initialization' + }, + { + name: 'Sres', + description: 'output of the line read from _ifilname_.', + type: 'performance' + }, + { + name: 'kline', + description: 'line number, or -1 when end of file has been reached.', + type: 'performance' + }, + ], + seeAlso: ['File Input and Output'] +}, +{ + name: 'readfi', + type: 'opcode', + category: 'Signal I/O:File I/O', + description: 'Read a line of text from an external file once on initialisation.', + syntax: 'Sres, iline = readfi(ifilname)', + example: '--8<-- "examples/readfi.csd"', + parameters: [ + { + name: 'ifilname', + description: 'an integer N denoting a file named "input.N" or a character string (in double quotes, spaces permitted) denoting the external file name. For a string, it may either be a full path name with directory specified or a simple filename. In the later case, the file is sought first in the current directory, then in SSDIR, and finally in SFDIR.', + type: 'initialization' + }, + { + name: 'iline', + description: 'line number, or -1 when end of file has been reached.', + type: 'initialization' + }, + { + name: 'Sres', + description: 'output of the line read from _ifilname_.', + type: 'initialization' + }, + ], + seeAlso: ['File Input and Output'] +}, +{ + name: 'readk', + type: 'opcode', + category: 'Signal I/O:File I/O', + description: 'Periodically reads an orchestra control-signal value from a named external file in a specific format.', + syntax: 'kres = readk(ifilname, iformat, iprd)', + example: '--8<-- "examples/readk.csd"', + rates: ['k-rate'], + parameters: [ + { + name: 'ifilname', + description: 'an integer N denoting a file named "readk.N" or a character string (in double quotes, spaces permitted) denoting the external file name. For a string, it may either be a full path name with directory specified or a simple filename. In the later case, the file is sought first in the current directory, then in SSDIR, and finally in SFDIR.', + type: 'initialization' + }, + { + name: 'iformat', + description: 'specifies the input data format:', + type: 'initialization' + }, + { + name: 'iprd', + description: 'the rate (period) in seconds, rounded to the nearest orchestra control period, at which the signal is read from the input file. A value of 0 implies one control period (the enforced minimum), which will read new values at the orchestra control rate. Longer periods will cause the same values to repeat for more than one control period.', + type: 'initialization' + }, + { + name: 'kres', + description: 'output of the signal read from _ifilname_.', + type: 'performance' + }, + ], + seeAlso: ['File Input and Output'] +}, +{ + name: 'readk2', + type: 'opcode', + category: 'Signal I/O:File I/O', + description: 'Periodically reads two orchestra control-signal values from an external file.', + syntax: 'kr1, kr2 = readk2(ifilname, iformat, iprd)', + example: '--8<-- "examples/readk2.csd"', + parameters: [ + { + name: 'ifilname', + description: 'an integer N denoting a file named "readk.N" or a character string (in double quotes, spaces permitted) denoting the external file name. For a string, it may either be a full path name with directory specified or a simple filename. In the later case, the file is sought first in the current directory, then in [SSDIR](../invoke/environment-variables.md), and finally in [SFDIR](../invoke/environment-variables.md).', + type: 'initialization' + }, + { + name: 'iformat', + description: 'specifies the input data format:', + type: 'initialization' + }, + { + name: 'iprd', + description: 'the rate (period) in seconds, rounded to the nearest orchestra control period, at which the signals are read from the input file. A value of 0 implies one control period (the enforced minimum), which will read new values at the orchestra control rate. Longer periods will cause the same values to repeat for more than one control period.', + type: 'initialization' + }, + { + name: 'kr1', + description: 'output of the signals read from _ifilname_.', + type: 'performance' + }, + { + name: 'kr2', + description: 'output of the signals read from _ifilname_.', + type: 'performance' + }, + ], + seeAlso: ['File Input and Output'] +}, +{ + name: 'readk3', + type: 'opcode', + category: 'Signal I/O:File I/O', + description: 'Periodically reads three orchestra control-signal values from an external file.', + syntax: 'kr1, kr2, kr3 = readk3(ifilname, iformat, iprd)', + example: '--8<-- "examples/readk3.csd"', + parameters: [ + { + name: 'ifilname', + description: 'an integer N denoting a file named "readk.N" or a character string (in double quotes, spaces permitted) denoting the external file name. For a string, it may either be a full path name with directory specified or a simple filename. In the later case, the file is sought first in the current directory, then in [SSDIR](../invoke/environment-variables.md), and finally in [SFDIR](../invoke/environment-variables.md).', + type: 'initialization' + }, + { + name: 'iformat', + description: 'specifies the input data format:', + type: 'initialization' + }, + { + name: 'iprd', + description: 'the rate (period) in seconds, rounded to the nearest orchestra control period, at which the signals are read from the input file. A value of 0 implies one control period (the enforced minimum), which will read new values at the orchestra control rate. Longer periods will cause the same values to repeat for more than one control period.', + type: 'initialization' + }, + { + name: 'kr1', + description: 'output of the signals read from _ifilname_.', + type: 'performance' + }, + { + name: 'kr2', + description: 'output of the signals read from _ifilname_.', + type: 'performance' + }, + { + name: 'kr3', + description: 'output of the signals read from _ifilname_.', + type: 'performance' + }, + ], + seeAlso: ['File Input and Output'] +}, +{ + name: 'readk4', + type: 'opcode', + category: 'Signal I/O:File I/O', + description: 'Periodically reads four orchestra control-signal values from an external file.', + syntax: 'kr1, kr2, kr3, kr4 = readk4(ifilname, iformat, iprd)', + example: '--8<-- "examples/readk4.csd"', + parameters: [ + { + name: 'ifilname', + description: 'an integer N denoting a file named "readk.N" or a character string (in double quotes, spaces permitted) denoting the external file name. For a string, it may either be a full path name with directory specified or a simple filename. In the later case, the file is sought first in the current directory, then in [SSDIR](../invoke/environment-variables.md), and finally in [SFDIR](../invoke/environment-variables.md).', + type: 'initialization' + }, + { + name: 'iformat', + description: 'specifies the input data format:', + type: 'initialization' + }, + { + name: 'iprd', + description: 'the rate (period) in seconds, rounded to the nearest orchestra control period, at which the signals are read from the input file. A value of 0 implies one control period (the enforced minimum), which will read new values at the orchestra control rate. Longer periods will cause the same values to repeat for more than one control period.', + type: 'initialization' + }, + { + name: 'kr1', + description: 'output of the signals read from _ifilname_.', + type: 'performance' + }, + { + name: 'kr2', + description: 'output of the signals read from _ifilname_.', + type: 'performance' + }, + { + name: 'kr3', + description: 'output of the signals read from _ifilname_.', + type: 'performance' + }, + { + name: 'kr4', + description: 'output of the signals read from _ifilname_.', + type: 'performance' + }, + ], + seeAlso: ['File Input and Output'] +}, +] diff --git a/src/lib/csound-reference/signal-i-o-printing-and-display.ts b/src/lib/csound-reference/signal-i-o-printing-and-display.ts new file mode 100644 index 0000000..73e0008 --- /dev/null +++ b/src/lib/csound-reference/signal-i-o-printing-and-display.ts @@ -0,0 +1,221 @@ +import type { CsoundReference } from './types' + +// Signal I/O:Printing and Display +export const signalIOPrintingAndDisplay: CsoundReference[] = [ +{ + name: 'dispfft', + type: 'opcode', + category: 'Signal I/O:Printing and Display', + description: 'Displays the Fourier Transform of an audio or control signal.', + syntax: 'dispfft(xsig, iprd, iwsiz [, iwtyp] [, idbout] [, iwtflg] [,imin] [,imax])', + example: '--8<-- "examples/dispfft.csd"', + parameters: [ + { + name: 'iprd', + description: 'the period of display in seconds.', + type: 'initialization' + }, + { + name: 'iwsiz', + description: 'size of the input window in samples. A window of _iwsiz_ points will produce a Fourier transform of _iwsiz_/2 points, spread linearly in frequency from 0 to sr/2. _iwsiz_ must be a power of 2, with a minimum of 16 and a maximum of 4096. The windows are permitted to overlap.', + type: 'initialization' + }, + { + name: 'dispfft', + description: 'displays the Fourier Transform of an audio or control signal (_asig_ or _ksig_) every _iprd_ seconds using the Fast Fourier Transform method.', + type: 'performance' + }, + ], + seeAlso: ['Printing and Display'] +}, +{ + name: 'display', + type: 'opcode', + category: 'Signal I/O:Printing and Display', + description: 'Displays the audio or control signals as an amplitude vs. time graph.', + syntax: 'display(xsig, iprd [, inprds] [, iwtflg])', + example: '--8<-- "examples/display.csd"', + parameters: [ + { + name: 'iprd', + description: 'the period of display in seconds.', + type: 'initialization' + }, + { + name: 'inprds_ is a scaling factor for the displayed waveform', + description: 'sized frames of samples are drawn in the window (the default and minimum value is 1.0). Higher _inprds_ values are slower to draw (more points to draw) but will show the waveform scrolling through the window, which is useful with low _iprd_ values.', + type: 'initialization' + }, + { + name: 'controlling how many _iprd', + description: 'sized frames of samples are drawn in the window (the default and minimum value is 1.0). Higher _inprds_ values are slower to draw (more points to draw) but will show the waveform scrolling through the window, which is useful with low _iprd_ values.', + type: 'initialization' + }, + { + name: 'display', + description: 'displays the audio or control signal _xsig_ every _iprd_ seconds, as an amplitude vs. time graph.', + type: 'performance' + }, + ], + seeAlso: ['Printing and Display'] +}, +{ + name: 'flashtxt', + type: 'opcode', + category: 'Signal I/O:Printing and Display', + description: 'Allows text to be displayed from instruments like sliders etc. (only on Unix and Windows at present)', + syntax: 'flashtxt( iwhich, String)', + example: '--8<-- "examples/flashtxt.csd"', + parameters: [ + { + name: 'iwhich', + description: 'the number of the window.', + type: 'initialization' + }, + { + name: 'String', + description: 'the string to be displayed.', + type: 'initialization' + }, + ], + seeAlso: ['Sensing and Control: TCL/TK widgets'] +}, +{ + name: 'print', + type: 'opcode', + category: 'Signal I/O:Printing and Display', + description: 'Displays the values of init (i-rate) variables.', + syntax: 'print(iarg [, iarg1] [, iarg2] [...])', + example: '--8<-- "examples/print.csd"', + parameters: [ + { + name: 'print', + description: 'print the current value of the i-time arguments (or expressions) _iarg_ at every i-pass through the instrument.', + type: 'performance' + }, + ], + seeAlso: ['Printing and Display'] +}, +{ + name: 'printf', + type: 'opcode', + category: 'Signal I/O:Printing and Display', + description: 'printf-style formatted output.', + syntax: 'printf_i(Sfmt, itrig, [iarg1[, iarg2[, ... ]]])\n printf(Sfmt, ktrig, [xarg1[, xarg2[, ... ]]])', + example: '--8<-- "examples/printf.csd"', + parameters: [ + { + name: 'Sfmt', + description: 'format string, has the same format as in printf() and other similar C functions, except length modifiers (l, ll, h, etc.) are not supported. The following conversion specifiers are allowed:', + type: 'initialization' + }, + { + name: 'itrig', + description: 'if greater than zero the opcode performs the printing; otherwise it is an null operation.', + type: 'initialization' + }, + { + name: 'ktrig', + description: 'if greater than zero and different from the value on the previous control cycle the opcode performs the requested printing. Initially this previous value is taken as zero.', + type: 'performance' + }, + ], + seeAlso: ['Printing and Display', 'http://www.cplusplus.com/reference/clibrary/cstdio/printf/'] +}, +{ + name: 'printk', + type: 'opcode', + category: 'Signal I/O:Printing and Display', + description: 'Prints one k-rate value at specified intervals.', + syntax: 'printk(itime, kval [, ispace] [, inamed])', + example: '--8<-- "examples/printk.csd"', + parameters: [ + { + name: 'itime', + description: 'time in seconds between printings.', + type: 'initialization' + }, + { + name: 'kval', + description: 'The k-rate values to be printed.', + type: 'performance' + }, + ], + seeAlso: ['Printing and Display'] +}, +{ + name: 'printk2', + type: 'opcode', + category: 'Signal I/O:Printing and Display', + description: 'Prints a new value every time a control variable changes.', + syntax: 'printk2(kvar [, inumspaces] [, inamed])', + example: '--8<-- "examples/printk2.csd"', + parameters: [ + { + name: 'kvar', + description: 'signal to be printed', + type: 'performance' + }, + ], + seeAlso: ['Printing and Display'] +}, +{ + name: 'printks', + type: 'opcode', + category: 'Signal I/O:Printing and Display', + description: 'Prints at k-rate using a printf() style syntax.', + syntax: 'printks("string", itime [, xval1] [, xval2] [...])', + example: '--8<-- "examples/printks.csd"', + parameters: [ + { + name: 'itime', + description: 'time in seconds between printings.', + type: 'initialization' + }, + ], + seeAlso: ['Printing and Display'] +}, +{ + name: 'printks2', + type: 'opcode', + category: 'Signal I/O:Printing and Display', + description: 'Prints a new value every time a control variable changes using a printf() style syntax.', + syntax: 'printks2("string", kval)', + example: '--8<-- "examples/printks2.csd"', + parameters: [ + { + name: 'kval', + description: 'signal to be printed. The style of printing is specified in _“string”_ with the standard C value specifier (%f, %d, etc.).', + type: 'performance' + }, + ], + seeAlso: ['Printing and Display'] +}, +{ + name: 'println', + type: 'opcode', + category: 'Signal I/O:Printing and Display', + description: 'Prints at k-rate using a printf() style syntax like [printks](../opcodes/printks.md), appends a new line.', + syntax: 'println("string", [, xval1] [, xval2] [...])', + example: '--8<-- "examples/println.csd"', + seeAlso: ['Printing and Display'] +}, +{ + name: 'prints', + type: 'opcode', + category: 'Signal I/O:Printing and Display', + description: 'Prints at init-time using a printf() style syntax.', + syntax: 'prints("string" [, xval1] [, xval2] [...])', + example: '--8<-- "examples/prints.csd"', + seeAlso: ['Printing and Display'] +}, +{ + name: 'printsk', + type: 'opcode', + category: 'Signal I/O:Printing and Display', + description: 'Prints at k-rate using a printf() style syntax.', + syntax: 'printsk("string", [, xval1] [, xval2] [...])', + example: '--8<-- "examples/printsk.csd"', + seeAlso: ['Printing and Display'] +}, +] diff --git a/src/lib/csound-reference/signal-i-o-signal-input.ts b/src/lib/csound-reference/signal-i-o-signal-input.ts new file mode 100644 index 0000000..8baf221 --- /dev/null +++ b/src/lib/csound-reference/signal-i-o-signal-input.ts @@ -0,0 +1,218 @@ +import type { CsoundReference } from './types' + +// Signal I/O:Signal Input +export const signalIOSignalInput: CsoundReference[] = [ +{ + name: 'diskin', + type: 'opcode', + category: 'Signal I/O:Signal Input', + description: 'Reads audio data from an external device or stream and can alter its pitch.', + syntax: 'ar1 [, ar2 [, ar3 [, ... arN]]] = diskin(ifilcod[, kpitch[, iskiptim \\\n [, iwraparound[, iformat[, iskipinit]]]]])', + example: '--8<-- "examples/diskin.csd"', + parameters: [ + { + name: 'ifilcod', + description: 'integer or character-string denoting the source soundfile name. An integer denotes the file soundin.filcod ; a character-string (in double quotes, spaces permitted) gives the filename itself, optionally a full pathname. If not a full path, the named file is sought first in the current directory, then in that given by the environment variable [SSDIR](../invoke/environment-variables.md) (if defined) then by [SFDIR](../invoke/environment-variables.md). See also [GEN01](../scoregens/gen01.md).', + type: 'initialization' + }, + { + name: 'iwraparound', + description: '1 = on, 0 = off (wraps around to end of file either direction, enabling looping)', + type: 'initialization' + }, + { + name: 'kpitch', + description: 'can be any real number. A negative number signifies backwards playback. The given number is a pitch ratio, where:', + type: 'performance' + }, + ], + seeAlso: ['Signal Input'] +}, +{ + name: 'diskin2', + type: 'opcode', + category: 'Signal I/O:Signal Input', + description: 'Reads audio data from a file, and can alter its pitch using one of several available interpolation types, as well as convert the sample rate to match the orchestra sr setting.', + syntax: 'a1[, a2[, ... aN]] = diskin2(ifilcod[, kpitch[, iskiptim \\\n [, iwrap[, iformat[, iwsize[, ibufsize[, iskipinit]]]]]]])\n ar1[] = diskin2(ifilcod[, kpitch[, iskiptim \\\n [, iwrap[, iformat[, iwsize[, ibufsize[, iskipinit]]]]]]])', + example: '--8<-- "examples/diskin2.csd"', + parameters: [ + { + name: 'ifilcod', + description: 'integer or character-string denoting the source soundfile name. An integer denotes the file soundin.ifilcod; a character-string (in double quotes, spaces permitted) gives the filename itself, optionally a full pathname. If not a full path, the named file is sought first in the current directory, then in those given by the environment variable [SSDIR](../invoke/environment-variables.md) (if defined) then by [SFDIR](../invoke/environment-variables.md). See also [GEN01](../scoregens/gen01.md). Note: files longer than 231-1 sample frames may not be played correctly on 32-bit platforms; this means a maximum length about 3 hours with a sample rate of 192000 Hz.', + type: 'initialization' + }, + { + name: 'kpitch', + description: 'transpose the pitch of input sound by this factor (e.g. 0.5 means one octave lower, 2 is one octave higher, and 1 is the original pitch, which is the default value). Fractional and negative values are allowed (the latter results in playing the file backwards, however, in this case the skip time parameter should be set to some positive value, e.g. the length of the file, or _iwrap_ should be non-zero, otherwise nothing would be played). If interpolation is enabled, and the sample rate of the file differs from the orchestra sample rate, the transpose ratio is automatically adjusted to make sure that _kpitch_=1 plays at the original pitch. Using a high _iwsize_ setting (40 or more) can significantly improve sound quality when transposing up, although at the expense of high CPU usage.', + type: 'performance' + }, + ], + seeAlso: ['Signal Input'] +}, +{ + name: 'in', + type: 'opcode', + category: 'Signal I/O:Signal Input', + description: 'Reads mono audio data from an external device or stream.', + syntax: 'ar1 = in()\n aarray = in()', + example: '--8<-- "examples/in.csd"', + seeAlso: ['Signal Input'] +}, +{ + name: 'in32', + type: 'opcode', + category: 'Signal I/O:Signal Input', + description: 'Reads a 32-channel audio signal from an external device or stream.', + syntax: 'ar1, ar2, ar3, ar4, ar5, ar6, ar7, ar8, ar9, ar10, ar11, ar12, ar13, ar14, \\\n ar15, ar16, ar17, ar18, ar19, ar20, ar21, ar22, ar23, ar24, ar25, ar26, \\\n ar27, ar28, ar29, ar30, ar31, ar32 = in32()', + seeAlso: ['Signal Input'] +}, +{ + name: 'inch', + type: 'opcode', + category: 'Signal I/O:Signal Input', + description: 'Reads from numbered channels in an external audio signal or stream.', + syntax: 'ain1[, ...] = inch(kchan1[,...])', + example: '--8<-- "examples/inch.csd"', + parameters: [ + { + name: 'inch_ can also be used to receive audio in realtime from the audio interface using', + description: 'iadc_.', + type: 'performance' + }, + ], + seeAlso: ['Signal Input'] +}, +{ + name: 'inh', + type: 'opcode', + category: 'Signal I/O:Signal Input', + description: 'Reads six-channel audio data from an external device or stream.', + syntax: 'ar1, ar2, ar3, ar4, ar5, ar6 = inh()', + seeAlso: ['Signal Input'] +}, +{ + name: 'ino', + type: 'opcode', + category: 'Signal I/O:Signal Input', + description: 'Reads eight-channel audio data from an external device or stream.', + syntax: 'ar1, ar2, ar3, ar4, ar5, ar6, ar7, ar8 = ino()', + seeAlso: ['Signal Input'] +}, +{ + name: 'inq', + type: 'opcode', + category: 'Signal I/O:Signal Input', + description: 'Reads quad audio data from an external device or stream.', + syntax: 'ar1, ar2, ar3, a4 = inq()', + example: '--8<-- "examples/inq.csd"', + seeAlso: ['Signal Input'] +}, +{ + name: 'inrg', + type: 'opcode', + category: 'Signal I/O:Signal Input', + description: 'Reads audio from a range of adjacent audio channels from the audio input device.', + syntax: 'inrg(kstart, ain1 [,ain2, ain3, ..., ainN])', + parameters: [ + { + name: 'kstart', + description: 'the number of the first channel of the input device to be accessed (channel numbers starts with 1, which is the first channel)', + type: 'performance' + }, + ], + seeAlso: ['Signal Input'] +}, +{ + name: 'ins', + type: 'opcode', + category: 'Signal I/O:Signal Input', + description: 'Reads stereo audio data from an external device or stream.', + syntax: 'ar1, ar2 = ins()', + example: '--8<-- "examples/ins.csd"', + seeAlso: ['Signal Input'] +}, +{ + name: 'invalue', + type: 'opcode', + category: 'Signal I/O:Signal Input', + description: 'Reads a k-rate or i-rate signal or string from a user-defined channel.', + syntax: 'ivalue = invalue("channel name")\n kvalue = invalue("channel name")\n Sname = invalue("channel name")', + example: '--8<-- "examples/invalue.csd"', + parameters: [ + { + name: 'ivalue', + description: 'The value that is read from the channel.', + type: 'performance' + }, + { + name: 'kvalue', + description: 'The value that is read from the channel.', + type: 'performance' + }, + { + name: 'Sname', + description: 'The string variable that is read from the channel.', + type: 'performance' + }, + ], + seeAlso: ['Signal Input'] +}, +{ + name: 'inx', + type: 'opcode', + category: 'Signal I/O:Signal Input', + description: 'Reads a 16-channel audio signal from an external device or stream.', + syntax: 'ar1, ar2, ar3, ar4, ar5, ar6, ar7, ar8, ar9, ar10, ar11, ar12, \\\n ar13, ar14, ar15, ar16 = inx()', + seeAlso: ['Signal Input'] +}, +{ + name: 'inz', + type: 'opcode', + category: 'Signal I/O:Signal Input', + description: 'Reads multi-channel audio samples into a ZAK array from an external device or stream.', + syntax: 'inz(ksig1)', + seeAlso: ['Signal Input'] +}, +{ + name: 'mp3in', + type: 'opcode', + category: 'Signal I/O:Signal Input', + description: 'Reads mono or stereo audio data from an external MP3 file.', + syntax: 'ar1, ar2 = mp3in(ifilcod[, iskptim, iformat, iskipinit, ibufsize])\n ar1 = mp3in(ifilcod[, iskptim, iformat, iskipinit, ibufsize])', + example: '--8<-- "examples/mp3in.csd"', + parameters: [ + { + name: 'ifilcod', + description: 'integer or character-string denoting the source soundfile name. An integer denotes the file soundin.filcod ; a character-string (in double quotes, spaces permitted) gives the filename itself, optionally a full pathname. If not a full path, the named file is sought first in the current directory, then in that given by the environment variable [SSDIR](../invoke/environment-variables.md) (if defined) then by [SFDIR](../invoke/environment-variables.md).', + type: 'initialization' + }, + ], + seeAlso: ['Signal Input'] +}, +{ + name: 'soundin', + type: 'opcode', + category: 'Signal I/O:Signal Input', + description: 'Reads audio data from an external device or stream.', + syntax: 'ar1[, ar2[, ar3[, ... a24]]] = soundin(ifilcod [, iskptim] [, iformat] \\\n [, iskipinit] [, ibufsize])', + example: '--8<-- "examples/soundin.csd"', + parameters: [ + { + name: 'ifilcod', + description: 'integer or character-string denoting the source soundfile name. An integer denotes the file soundin.filcod; a character-string (in double quotes, spaces permitted) gives the filename itself, optionally a full pathname. If not a full path, the named file is sought first in the current directory, then in that given by the environment variable [SSDIR](../invoke/environment-variables.md) (if defined) then by [SFDIR](../invoke/environment-variables.md). See also [GEN01](../scoregens/gen01.md).', + type: 'initialization' + }, + { + name: 'iskipinit', + description: 'switches off all initialisation if non zero (default=0). This was introduced in 4_23f13 and csound5.', + type: 'initialization' + }, + { + name: 'ibufsize', + description: 'buffer size in mono samples (not sample frames). Not available in Csound versions older than 5.00. The default buffer size is 2048.', + type: 'initialization' + }, + ], + seeAlso: ['Signal Input'] +}, +] diff --git a/src/lib/csound-reference/signal-i-o-signal-output.ts b/src/lib/csound-reference/signal-i-o-signal-output.ts new file mode 100644 index 0000000..b604209 --- /dev/null +++ b/src/lib/csound-reference/signal-i-o-signal-output.ts @@ -0,0 +1,277 @@ +import type { CsoundReference } from './types' + +// Signal I/O:Signal Output +export const signalIOSignalOutput: CsoundReference[] = [ +{ + name: 'mdelay', + type: 'opcode', + category: 'Signal I/O:Signal Output', + description: 'A MIDI delay opcode.', + syntax: 'mdelay(kstatus, kchan, kd1, kd2, kdelay)', + example: '--8<-- "examples/mdelay.csd"', + parameters: [ + { + name: 'kstatus', + description: 'status byte of MIDI message to be delayed', + type: 'performance' + }, + { + name: 'kchan', + description: 'MIDI channel (1-16)', + type: 'performance' + }, + { + name: 'kd1', + description: 'first MIDI data byte', + type: 'performance' + }, + { + name: 'kd2', + description: 'second MIDI data byte', + type: 'performance' + }, + { + name: 'kdelay', + description: 'delay time in seconds', + type: 'performance' + }, + ], + seeAlso: ['MIDI Message Output'] +}, +{ + name: 'monitor', + type: 'opcode', + category: 'Signal I/O:Signal Output', + description: 'Returns the audio spout frame (if active), otherwise it returns zero.', + syntax: 'aout1 [,aout2 ... aoutX] = monitor()\n aarra = monitor()', + example: '--8<-- "examples/monitor.csd"', + seeAlso: ['Signal Output'] +}, +{ + name: 'out', + type: 'opcode', + category: 'Signal I/O:Signal Output', + description: 'Writes audio data to an external device or stream, either from audio variables or from an audio array.', + syntax: 'out(asig1[, asig2,....])\n out(aarray)', + example: '--8<-- "examples/out.csd"', + seeAlso: ['Signal Output'] +}, +{ + name: 'out32', + type: 'opcode', + category: 'Signal I/O:Signal Output', + description: 'Writes 32-channel audio data to an external device or stream.', + syntax: 'out32(asig1, asig2, asig3, asig4, asig5, asig6, asig7, asig8, asig10, \\\n asig11, asig12, asig13, asig14, asig15, asig16, asig17, asig18, \\\n asig19, asig20, asig21, asig22, asig23, asig24, asig25, asig26, \\\n asig27, asig28, asig29, asig30, asig31, asig32)', + seeAlso: ['Signal Output'] +}, +{ + name: 'outall', + type: 'opcode', + category: 'Signal I/O:Signal Output', + description: 'Writes a single audio value to all available audio channels.', + syntax: 'outall(asig)', + example: '--8<-- "examples/outall.csd"', + rates: ['a-rate'], + seeAlso: ['Signal Output'] +}, +{ + name: 'outc', + type: 'opcode', + category: 'Signal I/O:Signal Output', + description: 'Writes audio data with an arbitrary number of channels to an external device or stream.', + syntax: 'outc(asig1 [, asig2] [...])', + example: '--8<-- "examples/outc.csd"', + seeAlso: ['Signal Output'] +}, +{ + name: 'outch', + type: 'opcode', + category: 'Signal I/O:Signal Output', + description: 'Writes multi-channel audio data, with user-controllable channels, to an external device or stream.', + syntax: 'outch(kchan1, asig1 [, kchan2] [, asig2] [...])', + example: '--8<-- "examples/outch.csd"', + seeAlso: ['Signal Output', 'http://www.csoundjournal.com/issue16/audiorouting.html'] +}, +{ + name: 'outh', + type: 'opcode', + category: 'Signal I/O:Signal Output', + description: 'Writes 6-channel audio data to an external device or stream.', + syntax: 'outh(asig1, asig2, asig3, asig4, asig5, asig6)', + seeAlso: ['Signal Output'] +}, +{ + name: 'outo', + type: 'opcode', + category: 'Signal I/O:Signal Output', + description: 'Writes 8-channel audio data to an external device or stream.', + syntax: 'outo(asig1, asig2, asig3, asig4, asig5, asig6, asig7, asig8)', + seeAlso: ['Signal Output'] +}, +{ + name: 'outq', + type: 'opcode', + category: 'Signal I/O:Signal Output', + description: 'Writes 4-channel audio data to an external device or stream.', + syntax: 'outq(asig1, asig2, asig3, asig4)', + example: '--8<-- "examples/outq.csd"', + seeAlso: ['Signal Output'] +}, +{ + name: 'outq1', + type: 'opcode', + category: 'Signal I/O:Signal Output', + description: 'Writes samples to quad channel 1 of an external device or stream.', + syntax: 'outq1(asig)', + example: '--8<-- "examples/outq1.csd"', + rates: ['a-rate'], + seeAlso: ['Signal Output'] +}, +{ + name: 'outq2', + type: 'opcode', + category: 'Signal I/O:Signal Output', + description: 'Writes samples to quad channel 2 of an external device or stream.', + syntax: 'outq2(asig)', + example: '--8<-- "examples/outq2.csd"', + rates: ['a-rate'], + seeAlso: ['Signal Output'] +}, +{ + name: 'outq3', + type: 'opcode', + category: 'Signal I/O:Signal Output', + description: 'Writes samples to quad channel 3 of an external device or stream.', + syntax: 'outq3(asig)', + example: '--8<-- "examples/outq3.csd"', + rates: ['a-rate'], + seeAlso: ['Signal Output'] +}, +{ + name: 'outq4', + type: 'opcode', + category: 'Signal I/O:Signal Output', + description: 'Writes samples to quad channel 4 of an external device or stream.', + syntax: 'outq4(asig)', + example: '--8<-- "examples/outq4.csd"', + rates: ['a-rate'], + seeAlso: ['Signal Output'] +}, +{ + name: 'outrg', + type: 'opcode', + category: 'Signal I/O:Signal Output', + description: 'Outputs audio to a range of adjacent audio channels on the audio output device.', + syntax: 'outrg(kstart, aout1 [,aout2, aout3, ..., aoutN])', + example: '--8<-- "examples/outrg.csd"', + parameters: [ + { + name: 'kstart', + description: 'the number of the first channel of the output device to be accessed (channel numbers starts with 1, which is the first channel)', + type: 'performance' + }, + ], + seeAlso: ['Signal Output'] +}, +{ + name: 'outs', + type: 'opcode', + category: 'Signal I/O:Signal Output', + description: 'Writes stereo audio data to an external device or stream.', + syntax: 'outs(asig1, asig2)', + example: '--8<-- "examples/outs.csd"', + seeAlso: ['Signal Output'] +}, +{ + name: 'outs1', + type: 'opcode', + category: 'Signal I/O:Signal Output', + description: 'Writes samples to stereo channel 1 of an external device or stream.', + syntax: 'outs1(asig)', + example: '--8<-- "examples/outs1.csd"', + rates: ['a-rate'], + seeAlso: ['Signal Output'] +}, +{ + name: 'outs2', + type: 'opcode', + category: 'Signal I/O:Signal Output', + description: 'Writes samples to stereo channel 2 of an external device or stream.', + syntax: 'outs2(asig)', + example: '--8<-- "examples/outs2.csd"', + rates: ['a-rate'], + seeAlso: ['Signal Output'] +}, +{ + name: 'outvalue', + type: 'opcode', + category: 'Signal I/O:Signal Output', + description: 'Sends an i-rate or k-rate signal or string to a user-defined channel.', + syntax: 'outvalue("channel name", ivalue)\n outvalue("channel name", kvalue)\n outvalue("channel name", "string")', + example: '--8<-- "examples/outvalue.csd"', + parameters: [ + { + name: 'ivalue', + description: 'The value that is sent to the channel.', + type: 'performance' + }, + { + name: 'kvalue', + description: 'The value that is sent to the channel.', + type: 'performance' + }, + { + name: 'string', + description: 'The string or string variable that is sent to the channel.', + type: 'performance' + }, + ], + seeAlso: ['Signal Output'] +}, +{ + name: 'outx', + type: 'opcode', + category: 'Signal I/O:Signal Output', + description: 'Writes 16-channel audio data to an external device or stream.', + syntax: 'outx(asig1, asig2, asig3, asig4, asig5, asig6, asig7, asig8, \\\n asig9, asig10, asig11, asig12, asig13, asig14, asig15, asig16)', + seeAlso: ['Signal Output'] +}, +{ + name: 'outz', + type: 'opcode', + category: 'Signal I/O:Signal Output', + description: 'Writes multi-channel audio data from a ZAK array to an external device or stream.', + syntax: 'outz(ksig1)', + seeAlso: ['Signal Output'] +}, +{ + name: 'soundout', + type: 'opcode', + category: 'Signal I/O:Signal Output', + description: 'Deprecated. Writes audio output to a disk file.', + syntax: 'soundout(asig1, ifilcod [, iformat])', + parameters: [ + { + name: 'ifilcod', + description: 'integer or character-string denoting the destination soundfile name. An integer denotes the file soundin.filcod; a character-string (in double quotes, spaces permitted) gives the filename itself, optionally a full pathname. If not a full path, the named file is sought first in the current directory, then in that given by the environment variable [SSDIR](../invoke/environment-variables.md) (if defined) then by [SFDIR](../invoke/environment-variables.md). See also [GEN01](../scoregens/gen01.md).', + type: 'initialization' + }, + ], + seeAlso: ['Signal Output'] +}, +{ + name: 'soundouts', + type: 'opcode', + category: 'Signal I/O:Signal Output', + description: 'Deprecated. Writes audio output to a disk file.', + syntax: 'soundouts(asigl, asigr, ifilcod [, iformat])', + parameters: [ + { + name: 'ifilcod', + description: 'integer or character-string denoting the destination soundfile name. An integer denotes the file soundout.ifilcod; a character-string (in double quotes, spaces permitted) gives the filename itself, optionally a full pathname. If not a full path, the named file is written relative to the directory given by the SFDIR environment variable if defined, or the current directory. See also [GEN01](../scoregens/gen01.md).', + type: 'initialization' + }, + ], + seeAlso: ['Signal Output'] +}, +] diff --git a/src/lib/csound-reference/signal-i-o-software-bus.ts b/src/lib/csound-reference/signal-i-o-software-bus.ts new file mode 100644 index 0000000..673d787 --- /dev/null +++ b/src/lib/csound-reference/signal-i-o-software-bus.ts @@ -0,0 +1,306 @@ +import type { CsoundReference } from './types' + +// Signal I/O:Software Bus +export const signalIOSoftwareBus: CsoundReference[] = [ +{ + name: 'chani', + type: 'opcode', + category: 'Signal I/O:Software Bus', + description: 'Reads data from a channel of the inward software bus.', + syntax: 'kval = chani(kchan)\n aval = chani(kchan)', + example: 'sr = 44100\nkr = 100\nksmps = 1\n\ninstr 1\n kc chani 1\n a1 oscil p4, p5, 100\n a2 lowpass2 a1, kc, 200\n out a2\nendin', + parameters: [ + { + name: 'kchan', + description: 'a positive integer that indicates which channel of the software bus to read', + type: 'performance' + }, + ], + seeAlso: ['Software Bus'] +}, +{ + name: 'chano', + type: 'opcode', + category: 'Signal I/O:Software Bus', + description: 'Send data to a channel of the outward software bus.', + syntax: 'chano(kval, kchan)\n chano(aval, kchan)', + example: 'sr = 44100\nkr = 100\nksmps = 1\n\ninstr 1\n a1 oscil p4, p5, 100\n chano 1, a1\nendin', + parameters: [ + { + name: 'xval', + description: 'value to transmit', + type: 'performance' + }, + { + name: 'kchan', + description: 'a positive integer that indicates which channel of the software bus to write', + type: 'performance' + }, + ], + seeAlso: ['Software Bus'] +}, +{ + name: 'chn', + type: 'opcode', + category: 'Signal I/O:Software Bus', + description: 'Declare a channel of the named software bus.', + syntax: 'chn_k(Sname, imode[, itype, idflt, imin, ima, ix, iy, iwidth, iheight, Sattributes])\n chn_a(Sname, imode)\n chn_S(Sname, imode)\n chn_S(Sname, Smode)\n chn_array(Sname, imode, Stype, iSizes[])', + example: 'sr = 44100\nkr = 100\nksmps = 1\n\nchn_k "cutoff", 1, 3, 1000, 500, 2000\n\ninstr 1\n kc chnget "cutoff"\n a1 oscil p4, p5, 100\n a2 lowpass2 a1, kc, 200\n out a2\nendin', + parameters: [ + { + name: 'imode', + description: 'sum of at least one of 1 for input and 2 for output.', + type: 'initialization' + }, + { + name: 'Smode', + description: 'The mode can also be set with a string: "r" for input, "w" for output or "rw" for input/output', + type: 'initialization' + }, + { + name: 'Stypes', + description: 'the array channel type ("k", "a", "S").', + type: 'initialization' + }, + { + name: 'ix', + description: 'suggested x position for controller.', + type: 'initialization' + }, + { + name: 'iy', + description: 'suggested y position for controller.', + type: 'initialization' + }, + { + name: 'iwidth', + description: 'suggested width position for controller.', + type: 'initialization' + }, + { + name: 'iheight', + description: 'suggested height position for controller.', + type: 'initialization' + }, + { + name: 'Sattributes', + description: 'attributes for controller.', + type: 'initialization' + }, + ], + seeAlso: ['Software Bus'] +}, +{ + name: 'chnclear', + type: 'opcode', + category: 'Signal I/O:Software Bus', + description: 'Clears a number of audio output channel of the named software bus.', + syntax: 'chnclear(Sname1[, Sname2,...])', + example: '--8<-- "examples/chnclear-modern.csd"', + seeAlso: ['Software Bus'] +}, +{ + name: 'chnexport', + type: 'opcode', + category: 'Signal I/O:Software Bus', + description: 'Export a global variable as a channel of the bus.', + syntax: 'gival = chnexport(Sname, imode[, itype, idflt, imin, imax])\n gkval = chnexport(Sname, imode[, itype, idflt, imin, imax])\n gaval = chnexport(Sname, imode)\n gSval = chnexport(Sname, imode)', + example: 'sr = 44100\nkr = 100\nksmps = 1\n\ngkc init 1000 ; set default value\ngkc chnexport "cutoff", 1, 3, i(gkc), 500, 2000\n\ninstr 1\n a1 oscil p4, p5, 100\n a2 lowpass2 a1, gkc, 200\n out a2\nendin', + parameters: [ + { + name: 'imode', + description: 'sum of at least one of 1 for input and 2 for output.', + type: 'initialization' + }, + ], + seeAlso: ['Software Bus'] +}, +{ + name: 'chnget', + type: 'opcode', + category: 'Signal I/O:Software Bus', + description: 'Reads data from a channel of the inward named software bus.', + syntax: 'ival = chnget(Sname)\n kval = chnget(Sname)\n aval = chnget(Sname)\n Sval = chnget(Sname)\n Sval = chngetks(Sname)\n ival[] = chngeti(Sname[])\n kval[] = chngetk(Sname[])\n aval[] = chngeta(Sname[])\n Sval[] = chngets(Sname[])', + example: 'sr = 44100\nkr = 100\nksmps = 1\n\ninstr 1\n kc chnget "cutoff"\n a1 oscil p4, p5, 100\n a2 lowpass2 a1, kc, 200\n out a2\nendin', + parameters: [ + { + name: 'Sname', + description: 'a string that identifies a channel of the named software bus to read.', + type: 'initialization' + }, + { + name: 'ival', + description: 'the control value read at i-time.', + type: 'initialization' + }, + { + name: 'Sval', + description: 'the string value read at i-time.', + type: 'initialization' + }, + { + name: 'kval', + description: 'the control value read at performance time.', + type: 'performance' + }, + { + name: 'aval', + description: 'the audio signal read at performance time.', + type: 'performance' + }, + { + name: 'Sval', + description: 'the string value read at k-rate. The chnget opcode works both at i-time and perf-time, whereas chngetks works only at perf-time. String variables are only updated if the channel has changed.', + type: 'performance' + }, + ], + seeAlso: ['Software Bus'] +}, +{ + name: 'chnmix', + type: 'opcode', + category: 'Signal I/O:Software Bus', + description: 'Writes audio data to the named software bus, mixing to the previous output.', + syntax: 'chnmix(aval, Sname)', + example: '--8<-- "examples/chnmix-modern.csd"', + parameters: [ + { + name: 'Sname', + description: 'a string that indicates which named channel of the software bus to write.', + type: 'initialization' + }, + { + name: 'aval', + description: 'the audio signal to write at performance time.', + type: 'performance' + }, + ], + seeAlso: ['Software Bus'] +}, +{ + name: 'chnparams', + type: 'opcode', + category: 'Signal I/O:Software Bus', + description: 'Query parameters of a channel (if it does not exist, all returned values are zero).', + syntax: 'itype, imode, ictltype, idflt, imin, imax = chnparams(Sname)', + parameters: [ + { + name: 'itype', + description: 'channel data type (1: control, 2: audio, 3: string)', + type: 'initialization' + }, + { + name: 'imode', + description: 'sum of 1 for input and 2 for output', + type: 'initialization' + }, + { + name: 'ictltype', + description: 'special parameter for control channel only; if not available, set to zero.', + type: 'initialization' + }, + { + name: 'idflt', + description: 'special parameter for control channel only; if not available, set to zero.', + type: 'initialization' + }, + { + name: 'imin', + description: 'special parameter for control channel only; if not available, set to zero.', + type: 'initialization' + }, + { + name: 'imax', + description: 'special parameter for control channel only; if not available, set to zero.', + type: 'initialization' + }, + { + name: 'Sname', + description: 'string identifying the channel.', + type: 'initialization' + }, + ], + seeAlso: ['Software Bus'] +}, +{ + name: 'chnset', + type: 'opcode', + category: 'Signal I/O:Software Bus', + description: 'Writes data to a channel of the named software bus.', + syntax: 'chnset(ival, Sname)\n chnset(kval, Sname)\n chnset(aval, Sname)\n chnset(Sval, Sname)\n chnsetks(Sval, Sname)\n chnseti(ival[], []Sname)\n chnsetk(kval[], []Sname)\n chnseta(aval[], []Sname)\n chnsets(Sval[], []Sname)', + example: 'sr = 44100\nkr = 100\nksmps = 1\n\ninstr 1\n a1 in\n kp,ka pitchamdf a1\n chnset kp, "pitch"\nendin', + parameters: [ + { + name: 'Sname', + description: 'a string that indicates which named channel of the software bus to write.', + type: 'initialization' + }, + { + name: 'ival', + description: 'the control value to write at i-time.', + type: 'initialization' + }, + { + name: 'Sval', + description: 'the string value to write at i-time.', + type: 'initialization' + }, + { + name: 'kval', + description: 'the control value to write at performance time.', + type: 'performance' + }, + { + name: 'aval', + description: 'the audio signal to write at performance time.', + type: 'performance' + }, + { + name: 'Sval', + description: 'the string value to write at perf-time. The opcode chnset with strings works at both i- and perf-time, whereas chnsetks works only a perf-time. Channel contents are only updated if the string variable is modified.', + type: 'performance' + }, + ], + seeAlso: ['Software Bus'] +}, +{ + name: 'oversample', + type: 'opcode', + category: 'Signal I/O:Software Bus', + description: 'Sets the local sampling rate value in a user-defined opcode block.', + syntax: 'oversample(ifactor [,icvt_in, icvt_out])', + parameters: [ + { + name: 'ifactor', + description: 'sets the oversampling factor. It needs to be a positive integer > 1. A factor of 1 is a non-op, zero or negative factors are illegal. The local sampling rate is set as ifactor * sr. The value of the sr variable is then changed locally. Local kr is also changed accordingly, local ksmps remains unchanged.', + type: 'initialization' + }, + { + name: 'icvt_in', + description: 'converter used for input: if Secret Rabbit Code is used, then 0 - best quality sync (default); 1 - medium quality sync; 2 - fast sync; 3 - zero-order hold; and 4 - linear.', + type: 'initialization' + }, + { + name: 'icvt_out', + description: 'converter used for output, defaults to the input converter, but can be different.', + type: 'initialization' + }, + ], + seeAlso: ['User Defined Opcodes (UDO)'] +}, +{ + name: 'setksmps', + type: 'opcode', + category: 'Signal I/O:Software Bus', + description: 'Sets the local ksmps value in an instrument or user-defined opcode block.', + syntax: 'setksmps(iksmps)', + parameters: [ + { + name: 'iksmps', + description: 'sets the local ksmps value.', + type: 'initialization' + }, + ], + seeAlso: ['User Defined Opcodes (UDO)'] +}, +] diff --git a/src/lib/csound-reference/signal-i-o-soundfile-queries.ts b/src/lib/csound-reference/signal-i-o-soundfile-queries.ts new file mode 100644 index 0000000..d6e1b74 --- /dev/null +++ b/src/lib/csound-reference/signal-i-o-soundfile-queries.ts @@ -0,0 +1,147 @@ +import type { CsoundReference } from './types' + +// Signal I/O:Soundfile Queries +export const signalIOSoundfileQueries: CsoundReference[] = [ +{ + name: 'filebit', + type: 'opcode', + category: 'Signal I/O:Soundfile Queries', + description: 'Returns the number of bits in each sample in a sound file.', + syntax: 'ir = filebit(ifilcod [, iallowraw])', + example: '--8<-- "examples/filebit.csd"', + parameters: [ + { + name: 'ifilcod', + description: 'sound file to be queried', + type: 'initialization' + }, + { + name: 'iallowraw', + description: '(Optional) Allow raw sound files (default=1)', + type: 'initialization' + }, + ], + seeAlso: ['Sound File Queries'] +}, +{ + name: 'filelen', + type: 'opcode', + category: 'Signal I/O:Soundfile Queries', + description: 'Returns the length of a sound file.', + syntax: 'ir = filelen(ifilcod, [iallowraw])', + example: '--8<-- "examples/filelen.csd"', + parameters: [ + { + name: 'ifilcod', + description: 'sound file to be queried', + type: 'initialization' + }, + { + name: 'iallowraw', + description: 'Allow raw sound files (default=1)', + type: 'initialization' + }, + ], + seeAlso: ['Sound File Queries'] +}, +{ + name: 'filenchnls', + type: 'opcode', + category: 'Signal I/O:Soundfile Queries', + description: 'Returns the number of channels in a sound file.', + syntax: 'ir = filenchnls(ifilcod [, iallowraw])', + example: '--8<-- "examples/filenchnls.csd"', + parameters: [ + { + name: 'ifilcod', + description: 'sound file to be queried', + type: 'initialization' + }, + { + name: 'iallowraw', + description: '(Optional) Allow raw sound files (default=1)', + type: 'initialization' + }, + ], + seeAlso: ['Sound File Queries'] +}, +{ + name: 'filepeak', + type: 'opcode', + category: 'Signal I/O:Soundfile Queries', + description: 'Returns the peak absolute value of a sound file.', + syntax: 'ir = filepeak(ifilcod [, ichnl])', + example: '--8<-- "examples/filepeak.csd"', + parameters: [ + { + name: 'ifilcod', + description: 'sound file to be queried', + type: 'initialization' + }, + ], + seeAlso: ['Sound File Queries'] +}, +{ + name: 'filesr', + type: 'opcode', + category: 'Signal I/O:Soundfile Queries', + description: 'Returns the sample rate of a sound file.', + syntax: 'ir = filesr(ifilcod [, iallowraw])', + example: '--8<-- "examples/filesr.csd"', + parameters: [ + { + name: 'ifilcod', + description: 'sound file to be queried', + type: 'initialization' + }, + { + name: 'iallowraw', + description: '(Optional) Allow raw sound files (default=1)', + type: 'initialization' + }, + ], + seeAlso: ['Sound File Queries'] +}, +{ + name: 'filevalid', + type: 'opcode', + category: 'Signal I/O:Soundfile Queries', + description: 'Checks that a file can be read at initialisation or performance time.', + syntax: 'ir = filevalid(ifilcod)\n kr = filevalid(ifilcod)', + example: '--8<-- "examples/filevalid.csd"', + parameters: [ + { + name: 'ifilcod', + description: 'sound file to be queried', + type: 'initialization' + }, + { + name: 'ir', + description: 'return code (1 if the sound file _ifilcod_ can be read).', + type: 'initialization' + }, + { + name: 'kr', + description: 'return code (1 if the sound file _ifilcod_ can be read).', + type: 'performance' + }, + ], + seeAlso: ['Sound File Queries'] +}, +{ + name: 'mp3len', + type: 'opcode', + category: 'Signal I/O:Soundfile Queries', + description: 'Returns the length of an MP3 sound file.', + syntax: 'ir = mp3len(ifilcod)', + example: '--8<-- "examples/mp3len.csd"', + parameters: [ + { + name: 'ifilcod', + description: 'sound file to be queried', + type: 'initialization' + }, + ], + seeAlso: ['Sound File Queries'] +}, +] diff --git a/src/lib/csound-reference/signal-modifiers-amplitude-modifiers.ts b/src/lib/csound-reference/signal-modifiers-amplitude-modifiers.ts new file mode 100644 index 0000000..5546638 --- /dev/null +++ b/src/lib/csound-reference/signal-modifiers-amplitude-modifiers.ts @@ -0,0 +1,207 @@ +import type { CsoundReference } from './types' + +// Signal Modifiers:Amplitude Modifiers +export const signalModifiersAmplitudeModifiers: CsoundReference[] = [ +{ + name: 'balance', + type: 'opcode', + category: 'Signal Modifiers:Amplitude Modifiers', + description: 'Adjust one audio signal according to the values of another.', + syntax: 'ares = balance(asig, acomp [, ihp] [, iskip])', + example: '--8<-- "examples/balance-modern.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'asig', + description: 'input audio signal', + type: 'performance' + }, + { + name: 'acomp', + description: 'the comparator signal', + type: 'performance' + }, + ], + seeAlso: ['Amplitude Modifiers and Dynamic processing'] +}, +{ + name: 'balance2', + type: 'opcode', + category: 'Signal Modifiers:Amplitude Modifiers', + description: 'Adjust one audio signal according to the values of another.', + syntax: 'ares = balance2(asig, acomp [, ihp] [, iskip])', + example: '--8<-- "examples/balance2-modern.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'asig', + description: 'input audio signal', + type: 'performance' + }, + { + name: 'acomp', + description: 'the comparator signal', + type: 'performance' + }, + ], + seeAlso: ['Amplitude Modifiers and Dynamic processing'] +}, +{ + name: 'clip', + type: 'opcode', + category: 'Signal Modifiers:Amplitude Modifiers', + description: 'Clips an a-rate signal to a predefined limit, in a “soft” manner, using one of three methods.', + syntax: 'ares = clip(asig, imeth, ilimit [, iarg])', + example: '--8<-- "examples/clip-modern.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'imeth', + description: 'selects the clipping method. The default is 0. The methods are:', + type: 'initialization' + }, + { + name: 'ilimit', + description: 'limiting value', + type: 'initialization' + }, + { + name: 'asig', + description: 'a-rate input signal', + type: 'performance' + }, + ], + seeAlso: ['Amplitude Modifiers and Dynamic processing', 'Waveshaping'] +}, +{ + name: 'compress', + type: 'opcode', + category: 'Signal Modifiers:Amplitude Modifiers', + description: 'Compress, limit, expand, duck or gate an audio signal.', + syntax: 'ar = compress(aasig, acsig, kthresh, kloknee, khiknee, kratio, katt, krel, ilook)', + example: '--8<-- "examples/compress-modern.csd"', + parameters: [ + { + name: 'ilook', + description: 'lookahead time in seconds, by which an internal envelope release can sense what is coming. This induces a delay between input and output, but a small amount of lookahead improves the performance of the envelope detector. Typical value is .05 seconds, sufficient to sense the peaks of the lowest frequency in _acsig_.', + type: 'initialization' + }, + { + name: 'kthresh', + description: 'sets the lowest decibel level that will be allowed through. This is a threshold of a separate noise gate, normally 0 or less, but if higher the threshold will begin removing low-level signal energy such as background noise.', + type: 'performance' + }, + { + name: 'kloknee', + description: 'decibel break-points denoting where compression or expansion will begin. These set the boundaries of a soft-knee curve joining the low-amplitude 1:1 line and the higher-amplitude compression ratio line. Typical values are 48 and 60 db. If the two breakpoints are equal, a hard-knee (angled) map will result.', + type: 'performance' + }, + { + name: 'khiknee', + description: 'decibel break-points denoting where compression or expansion will begin. These set the boundaries of a soft-knee curve joining the low-amplitude 1:1 line and the higher-amplitude compression ratio line. Typical values are 48 and 60 db. If the two breakpoints are equal, a hard-knee (angled) map will result.', + type: 'performance' + }, + { + name: 'kratio', + description: 'ratio of compression when the signal level is above the knee. The value 2 will advance the output just one decibel for every input gain of two; 3 will advance just one in three; 20 just one in twenty, etc. Inverse ratios will cause signal expansion: .5 gives two for one, .25 four for one, etc. The value 1 will result in no change.', + type: 'performance' + }, + ], + seeAlso: ['Amplitude Modifiers and Dynamic processing'] +}, +{ + name: 'compress2', + type: 'opcode', + category: 'Signal Modifiers:Amplitude Modifiers', + description: 'Compress, limit, expand, duck or gate an audio signal.', + syntax: 'ar = compress2(aasig, acsig, kthresh, kloknee, khiknee, kratio, katt, krel, ilook)', + example: '--8<-- "examples/compress2-modern.csd"', + parameters: [ + { + name: 'ilook', + description: 'lookahead time in seconds, by which an internal envelope release can sense what is coming. This induces a delay between input and output, but a small amount of lookahead improves the performance of the envelope detector. Typical value is .05 seconds, sufficient to sense the peaks of the lowest frequency in _acsig_.', + type: 'initialization' + }, + { + name: 'kthresh', + description: 'sets the lowest decibel level that will be allowed through. This is a threshold of a separate noise gate, normally set at -90 dB or less, but if higher the threshold will begin removing low-level signal energy such as background noise.', + type: 'performance' + }, + { + name: 'kloknee', + description: 'decibel break-points denoting where compression or expansion will begin. These set the boundaries of a soft-knee curve joining the low-amplitude 1:1 line and the higher-amplitude compression ratio line. Typical values are -52 and -30 dB. If the two breakpoints are equal, a hard-knee (angled) map will result.', + type: 'performance' + }, + { + name: 'khiknee', + description: 'decibel break-points denoting where compression or expansion will begin. These set the boundaries of a soft-knee curve joining the low-amplitude 1:1 line and the higher-amplitude compression ratio line. Typical values are -52 and -30 dB. If the two breakpoints are equal, a hard-knee (angled) map will result.', + type: 'performance' + }, + { + name: 'kratio', + description: 'ratio of compression when the signal level is above the knee. The value 2 will advance the output just one decibel for every input gain of two; 3 will advance just one in three; 20 just one in twenty, etc. Inverse ratios will cause signal expansion: .5 gives two for one, .25 four for one, etc. The value 1 will result in no change.', + type: 'performance' + }, + ], + seeAlso: ['Amplitude Modifiers and Dynamic processing'] +}, +{ + name: 'dam', + type: 'opcode', + category: 'Signal Modifiers:Amplitude Modifiers', + description: 'A dynamic compressor/expander.', + syntax: 'ares = dam(asig, kthreshold, icomp1, icomp2, irtime, iftime)', + example: '--8<-- "examples/dam.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'icomp1', + description: 'compression ratio for upper zone.', + type: 'initialization' + }, + { + name: 'icomp2', + description: 'compression ratio for lower zone', + type: 'initialization' + }, + { + name: 'irtime', + description: 'gain rise time in seconds. Time over which the gain factor is allowed to raise of one unit.', + type: 'initialization' + }, + { + name: 'iftime', + description: 'gain fall time in seconds. Time over which the gain factor is allowed to decrease of one unit.', + type: 'initialization' + }, + { + name: 'asig', + description: 'input signal to be modified', + type: 'performance' + }, + { + name: 'kthreshold', + description: 'level of input signal which acts as the threshold. Can be changed at k-time (e.g. for ducking)', + type: 'performance' + }, + ], + seeAlso: ['Amplitude Modifiers and Dynamic processing'] +}, +{ + name: 'gain', + type: 'opcode', + category: 'Signal Modifiers:Amplitude Modifiers', + description: 'Adjusts the amplitude audio signal according to a root-mean-square value.', + syntax: 'ares = gain(asig, krms [, ihp] [, iskip])', + example: '--8<-- "examples/gain.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'asig', + description: 'input audio signal', + type: 'performance' + }, + ], + seeAlso: ['Amplitude Modifiers and Dynamic processing'] +}, +] diff --git a/src/lib/csound-reference/signal-modifiers-comparators-and-accumulators.ts b/src/lib/csound-reference/signal-modifiers-comparators-and-accumulators.ts new file mode 100644 index 0000000..e8b4d01 --- /dev/null +++ b/src/lib/csound-reference/signal-modifiers-comparators-and-accumulators.ts @@ -0,0 +1,188 @@ +import type { CsoundReference } from './types' + +// Signal Modifiers:Comparators and Accumulators +export const signalModifiersComparatorsAndAccumulators: CsoundReference[] = [ +{ + name: 'cmp', + type: 'opcode', + category: 'Signal Modifiers:Comparators and Accumulators', + description: 'Compares audio signals or arrays.', + syntax: 'aout = cmp(a1, S_operator, a2)\n aout = cmp(a1, S_operator, kb)\n kOut[] = cmp(kA[], S_operator, kb)\n kOut[] = cmp(kA[], S_operator, kB[])\n kOut[] = cmp(k1, S_operator1, kIn[], S_operator2, k2)', + example: '--8<-- "examples/cmp.csd"', + parameters: [ + { + name: 'operator', + description: 'Math operator, one of ">", ">=", "<", "<=", "=="', + type: 'initialization' + }, + { + name: 'a1', + description: 'Input signals', + type: 'performance' + }, + { + name: 'a2', + description: 'Input signals', + type: 'performance' + }, + { + name: 'kb', + description: 'Scalar term', + type: 'performance' + }, + { + name: 'ib', + description: 'Scalar term', + type: 'performance' + }, + ], + seeAlso: ['Arithmetic and Logic Operations', 'Comparators and Accumulators', 'Array opcodes'] +}, +{ + name: 'max', + type: 'opcode', + category: 'Signal Modifiers:Comparators and Accumulators', + description: 'Produces a signal that is the maximum of any number of input signals.', + syntax: 'amax = max(ain1, ain2 [, ain3] [, ain4] [...])\n kmax = max(kin1, kin2 [, kin3] [, kin4] [...])\n imax = max(iin1, iin2 [, iin3] [, iin4] [...])', + example: '--8<-- "examples/max.csd"', + seeAlso: ['Comparators and Accumulators'] +}, +{ + name: 'max_k', + type: 'opcode', + category: 'Signal Modifiers:Comparators and Accumulators', + description: 'Local maximum (or minimum) value of an incoming asig signal, checked in the time interval between ktrig has become true twice.', + syntax: 'knumkout = max_k(asig, ktrig, itype)', + example: '--8<-- "examples/max_k.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'itype', + description: 'itype determinates the behaviour of max_k (see below)', + type: 'initialization' + }, + { + name: 'asig', + description: 'incoming (input) signal', + type: 'performance' + }, + { + name: 'ktrig', + description: 'trigger signal', + type: 'performance' + }, + ], + seeAlso: ['Comparators and Accumulators'] +}, +{ + name: 'maxabs', + type: 'opcode', + category: 'Signal Modifiers:Comparators and Accumulators', + description: 'Produces a signal that is the maximum of the absolute values of any number of input signals.', + syntax: 'amax = maxabs(ain1, ain2 [, ain3] [, ain4] [...])\n kmax = maxabs(kin1, kin2 [, kin3] [, kin4] [...])', + example: '--8<-- "examples/maxabs.csd"', + seeAlso: ['Comparators and Accumulators'] +}, +{ + name: 'maxabsaccum', + type: 'opcode', + category: 'Signal Modifiers:Comparators and Accumulators', + description: 'Accumulates the maximum of the absolute values of audio signals.', + syntax: 'maxabsaccum(aAccumulator, aInput)', + example: '--8<-- "examples/maxabsaccum.csd"', + parameters: [ + { + name: 'aAccumulator', + description: 'audio variable to store the maximum value', + type: 'performance' + }, + { + name: 'aInput', + description: 'signal that aAccumulator is compared to', + type: 'performance' + }, + ], + seeAlso: ['Comparators and Accumulators'] +}, +{ + name: 'maxaccum', + type: 'opcode', + category: 'Signal Modifiers:Comparators and Accumulators', + description: 'Accumulates the maximum value of audio signals.', + syntax: 'maxaccum(aAccumulator, aInput)', + example: '--8<-- "examples/maxaccum.csd"', + parameters: [ + { + name: 'aAccumulator', + description: 'audio variable to store the maximum value', + type: 'performance' + }, + { + name: 'aInput', + description: 'signal that aAccumulator is compared to', + type: 'performance' + }, + ], + seeAlso: ['Comparators and Accumulators'] +}, +{ + name: 'min', + type: 'opcode', + category: 'Signal Modifiers:Comparators and Accumulators', + description: 'Produces a signal that is the minimum of any number of input signals.', + syntax: 'amin = min(ain1, ain2 [, ain3] [, ain4] [...])\n kmin = min(kin1, kin2 [, kin3] [, kin4] [...])\n imin = min(iin1, iin2 [, iin3] [, iin4] [...])', + example: '--8<-- "examples/min.csd"', + seeAlso: ['Comparators and Accumulators'] +}, +{ + name: 'minabs', + type: 'opcode', + category: 'Signal Modifiers:Comparators and Accumulators', + description: 'Produces a signal that is the minimum of the absolute values of any number of input signals.', + syntax: 'amin = minabs(ain1, ain2 [, ain3] [, ain4] [...])\n kmin = minabs(kin1, kin2 [, kin3] [, kin4] [...])', + example: '--8<-- "examples/minabs.csd"', + seeAlso: ['Comparators and Accumulators'] +}, +{ + name: 'minabsaccum', + type: 'opcode', + category: 'Signal Modifiers:Comparators and Accumulators', + description: 'Accumulates the minimum of the absolute values of audio signals.', + syntax: 'minabsaccum(aAccumulator, aInput)', + example: '--8<-- "examples/minabsaccum.csd"', + parameters: [ + { + name: 'aAccumulator', + description: 'audio variable to store the minimum value', + type: 'performance' + }, + { + name: 'aInput', + description: 'signal that aAccumulator is compared to', + type: 'performance' + }, + ], + seeAlso: ['Comparators and Accumulators'] +}, +{ + name: 'minaccum', + type: 'opcode', + category: 'Signal Modifiers:Comparators and Accumulators', + description: 'Accumulates the minimum value of audio signals.', + syntax: 'minaccum(aAccumulator, aInput)', + example: '--8<-- "examples/minaccum.csd"', + parameters: [ + { + name: 'aAccumulator', + description: 'audio variable to store the minimum value', + type: 'performance' + }, + { + name: 'aInput', + description: 'signal that aAccumulator is compared to', + type: 'performance' + }, + ], + seeAlso: ['Comparators and Accumulators'] +}, +] diff --git a/src/lib/csound-reference/signal-modifiers-convolution-and-morphing.ts b/src/lib/csound-reference/signal-modifiers-convolution-and-morphing.ts new file mode 100644 index 0000000..c9b83f6 --- /dev/null +++ b/src/lib/csound-reference/signal-modifiers-convolution-and-morphing.ts @@ -0,0 +1,211 @@ +import type { CsoundReference } from './types' + +// Signal Modifiers:Convolution and Morphing +export const signalModifiersConvolutionAndMorphing: CsoundReference[] = [ +{ + name: 'convle', + type: 'opcode', + category: 'Signal Modifiers:Convolution and Morphing', + description: 'Same as the [convolve](../opcodes/convolve.md) opcode.', +}, +{ + name: 'convolve', + type: 'opcode', + category: 'Signal Modifiers:Convolution and Morphing', + description: 'Convolves a signal and an impulse response.', + syntax: 'ar1 [, ar2] [, ar3] [, ar4] = convolve(ain, ifilcod [, ichannel])', + example: 'csound -Ucvanal l1_44.wav l1_44.cv', + parameters: [ + { + name: 'ifilcod', + description: 'integer or character-string denoting an impulse response data file. An integer denotes the suffix of a file _convolve.m_; a character string (in double quotes) gives a filename, optionally a full pathname. If not a fullpath, the file is sought first in the current directory, then in the one given by the environment variable SADIR (if defined). The data file contains the Fourier transform of an impulse response. Memory usage depends on the size of the data file, which is read and held entirely in memory during computation, but which is shared by multiple calls.', + type: 'initialization' + }, + { + name: 'ain', + description: 'input audio signal.', + type: 'performance' + }, + ], + seeAlso: ['Convolution and Morphing'] +}, +{ + name: 'cross2', + type: 'opcode', + category: 'Signal Modifiers:Convolution and Morphing', + description: 'Cross synthesis using FFT\'s.', + syntax: 'ares = cross2(ain1, ain2, isize, ioverlap, iwin, kbias)', + example: '--8<-- "examples/cross2.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'isize', + description: 'This is the size of the FFT to be performed. The larger the size the better the frequency response but a sloppy time response.', + type: 'initialization' + }, + { + name: 'ioverlap', + description: 'This is the overlap factor of the FFT\'s, must be a power of two. The best settings are 2 and 4. A big overlap takes a long time to compile.', + type: 'initialization' + }, + { + name: 'iwin', + description: 'This is the function table that contains the window to be used in the analysis. One can use the [GEN20](../scoregens/gen20.md) routine to create this window.', + type: 'initialization' + }, + { + name: 'ain1', + description: 'The stimulus sound. Must have high frequencies for best results.', + type: 'performance' + }, + { + name: 'ain2', + description: 'The modulating sound. Must have a moving frequency response (like speech) for best results.', + type: 'performance' + }, + { + name: 'kbias', + description: 'The amount of cross synthesis. 1 is the normal, 0 is no cross synthesis.', + type: 'performance' + }, + ], + seeAlso: ['Convolution and Morphing'] +}, +{ + name: 'dconv', + type: 'opcode', + category: 'Signal Modifiers:Convolution and Morphing', + description: 'A direct convolution opcode.', + syntax: 'ares = dconv(asig, isize, ifn)', + example: '--8<-- "examples/dconv.csd"', + rates: ['a-rate', 'i-rate'], + parameters: [ + { + name: 'isize', + description: 'the size of the convolution buffer to use. If the buffer size is smaller than the size of _ifn_, then only the first _isize_ values will be used from the table.', + type: 'initialization' + }, + { + name: 'ifn', + description: 'table number of a stored function containing the impulse response for convolution.', + type: 'initialization' + }, + ], + seeAlso: ['Convolution and Morphing'] +}, +{ + name: 'ftconv', + type: 'opcode', + category: 'Signal Modifiers:Convolution and Morphing', + description: 'Low latency multichannel convolution, using a function table as impulse response source.', + syntax: 'a1[, a2[, a3[, ... a8]]] = ftconv(ain, ift, iplen[, iskipsamples \\\n [, iirlen[, iskipinit]]])', + example: '--8<-- "examples/ftconv.csd"', + parameters: [ + { + name: 'ift', + description: 'source ftable number. The table is expected to contain interleaved multichannel audio data, with the number of channels equal to the number of output variables (a1, a2, etc.). An interleaved table can be created from a set of mono tables with [GEN52](../scoregens/gen52.md).', + type: 'initialization' + }, + { + name: 'iplen', + description: 'length of impulse response partitions, in sample frames; must be an integer power of two. Lower settings allow for shorter output delay, but will increase CPU usage.', + type: 'initialization' + }, + { + name: 'ain', + description: 'input signal.', + type: 'performance' + }, + ], + seeAlso: ['Convolution and Morphing'] +}, +{ + name: 'ftmorf', + type: 'opcode', + category: 'Signal Modifiers:Convolution and Morphing', + description: 'Uses an index into a table of ftable numbers to morph between adjacent tables in the list. This morphed function is written into the table referenced by _iresfn_ on every k-cycle.', + syntax: 'ftmorf(kftndx, iftfn, iresfn)', + example: '--8<-- "examples/ftmorf.csd"', + parameters: [ + { + name: 'iftfn', + description: 'The table containing the numbers of any existing tables which are used for the morphing.', + type: 'initialization' + }, + { + name: 'iresfn', + description: 'Table number of the morphed function', + type: 'initialization' + }, + { + name: 'kftndx', + description: 'the index into the _iftfn_ table.', + type: 'performance' + }, + ], + seeAlso: ['Convolution and Morphing', 'Read/Write Operations'] +}, +{ + name: 'liveconv', + type: 'opcode', + category: 'Signal Modifiers:Convolution and Morphing', + description: 'Partitioned convolution with dynamically reloadable impulse response.', + syntax: 'ares = liveconv(ain, ift, iplen, kupdate, kclear)', + example: '--8<-- "examples/liveconv.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'ift', + description: 'table number for storing the impulse response (IR) for convolution. The table may be filled with new data at any time while the convolution is running.', + type: 'initialization' + }, + { + name: 'iplen', + description: 'length of impulse response partition in samples; must be an integer power of two. Lower settings allow for shorter output delay, but will increase CPU usage.', + type: 'initialization' + }, + { + name: 'ain', + description: 'input signal.', + type: 'performance' + }, + { + name: 'ares', + description: 'output signal.', + type: 'performance' + }, + { + name: 'kupdate', + description: 'flag indicating whether the IR table should be updated. If kupdate=1 the IR table ift is loaded partition by partition, starting with the next partition. If kupdate=-1 the IR table ift is unloaded (cleared to zero) partition by partition, starting with the next partition. Other values have no effect.', + type: 'performance' + }, + { + name: 'kclear', + description: 'flag for clearing all internal buffers. If kclear has any value != zero, the internal buffers are cleared immediately. This operation is not free of artifacts.', + type: 'performance' + }, + ], + seeAlso: ['Convolution and Morphing'] +}, +{ + name: 'pconvolve', + type: 'opcode', + category: 'Signal Modifiers:Convolution and Morphing', + description: 'Convolution based on a uniformly partitioned overlap-save algorithm.', + syntax: 'ar1 [, ar2 [, ar3 [, ar4]]] = pconvolve(ain, ifilcod [, ipartitionsize [, ichannel]])', + example: '--8<-- "examples/pconvolve.csd"', + parameters: [ + { + name: 'ifilcod', + description: 'integer or character-string denoting an impulse response soundfile. Multichannel files are supported, the file must have the same sample-rate as the orc. [Note: _cvanal_ files cannot be used!] Keep in mind that longer files require more calculation time [and probably larger partition sizes and more latency]. At current processor speeds, files longer than a few seconds may not render in real-time.', + type: 'initialization' + }, + { + name: 'ain', + description: 'input audio signal.', + type: 'performance' + }, + ], + seeAlso: ['Convolution and Morphing'] +}, +] diff --git a/src/lib/csound-reference/signal-modifiers-delay.ts b/src/lib/csound-reference/signal-modifiers-delay.ts new file mode 100644 index 0000000..845e359 --- /dev/null +++ b/src/lib/csound-reference/signal-modifiers-delay.ts @@ -0,0 +1,235 @@ +import type { CsoundReference } from './types' + +// Signal Modifiers:Delay +export const signalModifiersDelay: CsoundReference[] = [ +{ + name: 'delay', + type: 'opcode', + category: 'Signal Modifiers:Delay', + description: 'Delays an input signal by some time interval.', + syntax: 'ares = delay(asig, idlt [, iskip])', + example: '--8<-- "examples/delay.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'idlt', + description: 'requested delay time in seconds. This can be as large as available memory will permit. The space required for n seconds of delay is 4n * _sr_ bytes. It is allocated at the time the instrument is first initialized, and returned to the pool at the end of a score section.', + type: 'initialization' + }, + { + name: 'asig', + description: 'audio signal', + type: 'performance' + }, + ], + seeAlso: ['Delay'] +}, +{ + name: 'delay1', + type: 'opcode', + category: 'Signal Modifiers:Delay', + description: 'Delays an input signal by one sample.', + syntax: 'ares = delay1(asig [, iskip])', + example: '--8<-- "examples/delay1.csd"', + rates: ['a-rate'], + seeAlso: ['Delay'] +}, +{ + name: 'delayk', + type: 'opcode', + category: 'Signal Modifiers:Delay', + description: 'Delays an input signal by some time interval.', + syntax: 'kr = delayk(ksig, idel[, imode])\n kr = vdel_k(ksig, kdel, imdel[, imode])', + example: '--8<-- "examples/delayk.csd"', + parameters: [ + { + name: 'idel', + description: 'delay time (in seconds) for delayk. It is rounded to the nearest integer multiple of a k-cycle (i.e. 1/kr).', + type: 'initialization' + }, + { + name: 'imode', + description: 'sum of 1 for skipping initialization (e.g. in tied notes) and 2 for holding the first input value during the initial delay, instead of outputting zero. This is mainly of use when delaying envelopes that do not start at zero.', + type: 'initialization' + }, + { + name: 'imdel', + description: 'maximum delay time for vdel_k, in seconds.', + type: 'initialization' + }, + { + name: 'kr', + description: 'the output signal. Note: neither of the opcodes interpolate the output.', + type: 'performance' + }, + { + name: 'ksig', + description: 'the input signal.', + type: 'performance' + }, + { + name: 'kdel', + description: 'delay time (in seconds) for vdel_k. It is rounded to the nearest integer multiple of a k-cycle (i.e. 1/kr).', + type: 'performance' + }, + ], + seeAlso: ['Delay'] +}, +{ + name: 'delayr', + type: 'opcode', + category: 'Signal Modifiers:Delay', + description: 'Reads from an automatically established digital delay line.', + syntax: 'ares = delayr(idlt [, iskip])', + example: '--8<-- "examples/delayr.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'idlt', + description: 'requested delay time in seconds. This can be as large as available memory will permit. The space required for n seconds of delay is 4n * _sr_ bytes. It is allocated at the time the instrument is first initialized, and returned to the pool at the end of a score section.', + type: 'initialization' + }, + ], + seeAlso: ['Delay'] +}, +{ + name: 'delayw', + type: 'opcode', + category: 'Signal Modifiers:Delay', + description: 'Writes the audio signal to a digital delay line.', + syntax: 'delayw(asig)', + example: '--8<-- "examples/delayw.csd"', + rates: ['a-rate'], + seeAlso: ['Delay'] +}, +{ + name: 'deltap', + type: 'opcode', + category: 'Signal Modifiers:Delay', + description: 'Taps a delay line at variable offset times.', + syntax: 'ares = deltap(kdlt)', + example: 'asource buzz 1, 440, 20, 1\n atime linseg 1, p3/2,.01, p3/2,1 ; trace a distance in secs\n ampfac = 1/atime/atime ; and calc an amp factor\n adump delayr 1 ; set maximum distance\n amove deltapi atime ; move sound source past\n delayw asource ; the listener\n out amove * ampfac', + rates: ['a-rate'], + parameters: [ + { + name: 'kdlt', + description: 'specifies the tapped delay time in seconds. Each can range from 1 control period to the full delay time of the read/write pair; however, since there is no internal check for adherence to this range, the user is wholly responsible. Each argument can be a constant, a variable, or a time-varying signal.', + type: 'performance' + }, + ], + seeAlso: ['Delay'] +}, +{ + name: 'deltap3', + type: 'opcode', + category: 'Signal Modifiers:Delay', + description: 'Taps a delay line at variable offset times, uses cubic interpolation.', + syntax: 'ares = deltap3(xdlt)', + example: 'asource buzz 1, 440, 20, 1\natime linseg 1, p3/2,.01, p3/2,1 ; trace a distance in secs\nampfac = 1/atime/atime ; and calc an amp factor\nadump delayr 1 ; set maximum distance\namove deltapi atime ; move sound source past\n delayw asource ; the listener\n out amove * ampfac', + rates: ['a-rate'], + parameters: [ + { + name: 'xdlt', + description: 'specifies the tapped delay time in seconds. Each can range from 1 control period to the full delay time of the read/write pair; however, since there is no internal check for adherence to this range, the user is wholly responsible. Each argument can be a constant, a variable, or a time-varying signal; the _xdlt_ argument in _deltap3_ implies that an audio-varying delay is permitted there.', + type: 'performance' + }, + ], + seeAlso: ['Delay'] +}, +{ + name: 'deltapi', + type: 'opcode', + category: 'Signal Modifiers:Delay', + description: 'Taps a delay line at variable offset times, uses interpolation.', + syntax: 'ares = deltapi(xdlt)', + example: 'asource buzz 1, 440, 20, 1\natime linseg 1, p3/2,.01, p3/2,1 ; trace a distance in secs\nampfac = 1/atime/atime ; and calc an amp factor\nadump delayr 1 ; set maximum distance\namove deltapi atime ; move sound source past\n delayw asource ; the listener\n out amove * ampfac', + rates: ['a-rate'], + parameters: [ + { + name: 'xdlt', + description: 'specifies the tapped delay time in seconds. Each can range from 1 control period to the full delay time of the read/write pair; however, since there is no internal check for adherence to this range, the user is wholly responsible. Each argument can be a constant, a variable, or a time-varying signal; the _xdlt_ argument in _deltapi_ implies that an audio-varying delay is permitted there.', + type: 'performance' + }, + ], + seeAlso: ['Delay'] +}, +{ + name: 'deltapn', + type: 'opcode', + category: 'Signal Modifiers:Delay', + description: 'Taps a delay line at variable offset times.', + syntax: 'ares = deltapn(xnumsamps)', + example: '--8<-- "examples/deltapn.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'xnumsamps', + description: 'specifies the tapped delay time in number of samples. Each can range from 1 control period to the full delay time of the read/write pair; however, since there is no internal check for adherence to this range, the user is wholly responsible. Each argument can be a constant, a variable, or a time-varying signal.', + type: 'performance' + }, + ], + seeAlso: ['Delay'] +}, +{ + name: 'deltapx', + type: 'opcode', + category: 'Signal Modifiers:Delay', + description: 'Read from or write to a delay line with interpolation.', + syntax: 'aout = deltapx(adel, iwsize)', + example: '--8<-- "examples/deltapx.csd"', + parameters: [ + { + name: 'iwsize', + description: 'interpolation window size in samples. Allowed values are integer multiplies of 4 in the range 4 to 1024. _iwsize_ = 4 uses cubic interpolation. Increasing _iwsize_ improves sound quality at the expense of CPU usage, and minimum delay time.', + type: 'initialization' + }, + { + name: 'aout', + description: 'Output signal.', + type: 'performance' + }, + { + name: 'adel', + description: 'Delay time in seconds.', + type: 'performance' + }, + ], + seeAlso: ['Delay'] +}, +{ + name: 'deltapxw', + type: 'opcode', + category: 'Signal Modifiers:Delay', + description: 'Mixes the input signal to a delay line.', + syntax: 'deltapxw(ain, adel, iwsize)', + example: '--8<-- "examples/deltapxw.csd"', + parameters: [ + { + name: 'iwsize', + description: 'interpolation window size in samples. Allowed values are integer multiplies of 4 in the range 4 to 1024. _iwsize_ = 4 uses cubic interpolation. Increasing _iwsize_ improves sound quality at the expense of CPU usage, and minimum delay time.', + type: 'initialization' + }, + { + name: 'ain', + description: 'Input signal.', + type: 'performance' + }, + { + name: 'adel', + description: 'Delay time in seconds.', + type: 'performance' + }, + ], + seeAlso: ['Delay'] +}, +{ + name: 'multitap', + type: 'opcode', + category: 'Signal Modifiers:Delay', + description: 'Multitap delay line implementation.', + syntax: 'ares = multitap(asig [, itime1, igain1] [, itime2, igain2] [...])', + example: '--8<-- "examples/multitap.csd"', + rates: ['a-rate'], + seeAlso: ['Delay'] +}, +] diff --git a/src/lib/csound-reference/signal-modifiers-panning-and-spatialization.ts b/src/lib/csound-reference/signal-modifiers-panning-and-spatialization.ts new file mode 100644 index 0000000..e072515 --- /dev/null +++ b/src/lib/csound-reference/signal-modifiers-panning-and-spatialization.ts @@ -0,0 +1,865 @@ +import type { CsoundReference } from './types' + +// Signal Modifiers:Panning and Spatialization +export const signalModifiersPanningAndSpatialization: CsoundReference[] = [ +{ + name: 'bformdec1', + type: 'opcode', + category: 'Signal Modifiers:Panning and Spatialization', + description: 'Decodes an ambisonic B format signal into loudspeaker specific signals.', + syntax: 'ao1, ao2 = bformdec1(isetup, aw, ax, ay, az [, ar, as, at, au, av \\\n [, abk, al, am, an, ao, ap, aq]])\n ao1, ao2, ao3, ao4 = bformdec1(isetup, aw, ax, ay, az [, ar, as, at, au, av \\\n [, abk, al, am, an, ao, ap, aq]])\n ao1, ao2, ao3, ao4, ao5 = bformdec1(isetup, aw, ax, ay, az [, ar, as, at, au, av \\\n [, abk, al, am, an, ao, ap, aq]])\n ao1, ao2, ao3, ao4, ao5, ao6, ao7, ao8 = bformdec1(isetup, aw, ax, ay, az \\\n [, ar, as, at, au, av [, abk, al, am, an, ao, ap, aq]])\n aout[] = bformdec1(isetup, abform[])', + example: '--8<-- "examples/bformenc1-modern.csd"', + parameters: [ + { + name: 'isetup', + description: 'loudspeaker setup. There are five supported setups:', + type: 'initialization' + }, + ], + seeAlso: ['Panning and Spatialization: Ambisonics'] +}, +{ + name: 'bformdec2', + type: 'opcode', + category: 'Signal Modifiers:Panning and Spatialization', + description: 'Decodes an Ambisonics B format signal into loudspeaker specific signals, with dual--band decoding and near--field compensation.', + syntax: 'aout[] = bformdec2(isetup, abform[], [idecoder, idistance, ifreq, imix, \\\n ifilel, ifiler])', + parameters: [ + { + name: 'isetup', + description: 'loudspeaker setup. There are currently 8 supported setups, the first five are backwards compatible with [bformdec1](../opcodes/bformdec1.md):', + type: 'initialization' + }, + { + name: 'idecoder', + description: 'optional (default 0), select the type of decoder', + type: 'initialization' + }, + { + name: 'idistance', + description: 'optional (default 1 meter), select the distance (in meters) to the loudspeaker (radius if regular configuration)', + type: 'initialization' + }, + { + name: 'ifreq', + description: 'optional (default 400 Hz), frequency cut (Hz) of the band splitting filter (only has an effect if _idecoder_=0)*', + type: 'initialization' + }, + { + name: 'imix', + description: 'optional (default 0), type of mix of the velocity and energy decoders\' outputs', + type: 'initialization' + }, + { + name: 'ifilel', + description: 'left HRTF spectral data file', + type: 'initialization' + }, + { + name: 'ifiler', + description: 'right HRTF spectral data file', + type: 'initialization' + }, + { + name: 'abform', + description: 'input signal array in the B format', + type: 'performance' + }, + ], + seeAlso: ['Panning and Spatialization: Ambisonics'] +}, +{ + name: 'bformenc1', + type: 'opcode', + category: 'Signal Modifiers:Panning and Spatialization', + description: 'Codes a signal into the ambisonic B format.', + syntax: 'aw, ax, ay, az = bformenc1(asig, kalpha, kbeta)\n aw, ax, ay, az, ar, as, at, au, av = bformenc1(asig, kalpha, kbeta)\n aw, ax, ay, az, ar, as, at, au, av, ak, al, am, an, ao, ap, aq = bformenc1(\\\n asig, kalpha, kbeta)\n aarray[] = bformenc1(asig, kalpha, kbeta)', + example: '--8<-- "examples/bformenc1-modern.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'aarray', + description: 'output array to hold cells of the B format.', + type: 'performance' + }, + { + name: 'asig', + description: 'input signal.', + type: 'performance' + }, + { + name: 'kalpha', + description: 'azimuth angle in degrees (anticlockwise).', + type: 'performance' + }, + { + name: 'kbeta', + description: 'altitude angle in degrees.', + type: 'performance' + }, + ], + seeAlso: ['Panning and Spatialization: Ambisonics'] +}, +{ + name: 'hrtfearly', + type: 'opcode', + category: 'Signal Modifiers:Panning and Spatialization', + description: 'Generates 3D binaural audio with high-fidelity early reflections in a parametric room using a Phase Truncation algorithm.', + syntax: 'aleft, aright, irt60low, irt60high, imfp = hrtfearly(asrc, ksrcx, ksrcy, ksrcz, \\\n klstnrx, klstnry, klstnrz, ifilel, ifiler, idefroom [,ifade, isr, iorder, \\\n ithreed, kheadrot, iroomx, iroomy, iroomz, iwallhigh, iwalllow, \\\n iwallgain1, iwallgain2, iwallgain3, ifloorhigh, ifloorlow, ifloorgain1, \\\n ifloorgain2, ifloorgain3, iceilinghigh, iceilinglow, iceilinggain1, \\\n iceilinggain2, iceilinggain3])', + example: '--8<-- "examples/hrtfearly.csd"', + parameters: [ + { + name: 'ifilel', + description: 'left HRTF spectral data file.', + type: 'initialization' + }, + { + name: 'ifiler', + description: 'right HRTF spectral data file.', + type: 'initialization' + }, + { + name: 'idefroom', + description: 'default room, medium (1: 10*10*3), small (2: 3*4*3) or large (3: 20*25*7). Wall details (high coef, low coef, gain1, gain2, gain3): .3, .1, .75, .95, .9. Floor: .6, .1, .95, .6, .35. Ceiling: .2, .1, 1, 1, 1. If 0 is entered, optional room parameters will be read.', + type: 'initialization' + }, + { + name: 'ifade', + description: 'optional, number of processing buffers for phase change crossfade (default 8). Legal range is 1-24. See [hrtfmove](../opcodes/hrtfmove.md).', + type: 'initialization' + }, + { + name: 'isr', + description: 'optional, default 44.1kHz, legal values: 44100, 48000 and 96000.', + type: 'initialization' + }, + { + name: 'iorder', + description: 'optional, order of images processed: higher order: more reflections. Defaults to 1, legal range: 0-4.', + type: 'initialization' + }, + { + name: 'ithreed', + description: 'optional, process image sources in three dimensions (1) or two (0: default).', + type: 'initialization' + }, + { + name: 'iroomx', + description: 'optional, x room size in metres, will be read if no valid default room is entered (all below parameters behave similarly). Minimum room size is 2\\*2\\*2.', + type: 'initialization' + }, + { + name: 'iroomy', + description: 'optional, y room size.', + type: 'initialization' + }, + { + name: 'iroomz', + description: 'optional, z room size.', + type: 'initialization' + }, + { + name: 'iwallhigh', + description: 'optional, high frequency wall absorption coefficient (all 4 walls are assumed identical). Absorption coefficients will affect reverb time output.', + type: 'initialization' + }, + { + name: 'iwalllow', + description: 'optional, low frequency wall absorption coefficient.', + type: 'initialization' + }, + { + name: 'iwallgain1', + description: 'optional, gain on filter centred at 250 Hz (all filters have a Q implying 4 octaves).', + type: 'initialization' + }, + { + name: 'iwallgain2', + description: 'optional, as above, centred on 1000 Hz.', + type: 'initialization' + }, + { + name: 'iwallgain3', + description: 'optional, as above, centred on 4000 Hz.', + type: 'initialization' + }, + { + name: 'ifloorhigh', + description: 'as above for floor.', + type: 'initialization' + }, + { + name: 'ifloorlow', + description: 'as above for floor.', + type: 'initialization' + }, + { + name: 'ifloorgain1', + description: 'as above for floor.', + type: 'initialization' + }, + { + name: 'ifloorgain2', + description: 'as above for floor.', + type: 'initialization' + }, + { + name: 'ifloorgain3', + description: 'as above for floor.', + type: 'initialization' + }, + { + name: 'iceilinghigh', + description: 'as above for ceiling.', + type: 'initialization' + }, + { + name: 'iceilinglow', + description: 'as above for ceiling.', + type: 'initialization' + }, + { + name: 'iceilinggain1', + description: 'as above for ceiling.', + type: 'initialization' + }, + { + name: 'iceilinggain2', + description: 'as above for ceiling.', + type: 'initialization' + }, + { + name: 'iceilinggain3', + description: 'as above for ceiling.', + type: 'initialization' + }, + { + name: 'kheadrot', + description: 'optional, angular value for head rotation.', + type: 'performance' + }, + { + name: 'asrc', + description: 'Input/source signal.', + type: 'performance' + }, + ], + seeAlso: ['Panning and Spatialization: Binaural spatialization'] +}, +{ + name: 'hrtfer', + type: 'opcode', + category: 'Signal Modifiers:Panning and Spatialization', + description: 'Creates 3D audio for two speakers. Output is binaural (headphone) 3D audio.', + syntax: 'aleft, aright = hrtfer(asig, kaz, kelev, "HRTFcompact")', + example: '--8<-- "examples/hrtfer.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'kAz', + description: 'azimuth value in degrees. Positive values represent position on the right, negative values are positions on the left.', + type: 'initialization' + }, + { + name: 'kElev', + description: 'elevation value in degrees. Positive values represent position above horizontal, negative values are positions under horizontal.', + type: 'initialization' + }, + ], + seeAlso: ['Panning and Spatialization: Binaural spatialization'] +}, +{ + name: 'hrtfmove', + type: 'opcode', + category: 'Signal Modifiers:Panning and Spatialization', + description: 'Generates dynamic 3d binaural audio for headphones using magnitude interpolation and phase truncation.', + syntax: 'aleft, aright = hrtfmove(asrc, kAz, kElev, ifilel, ifiler [, imode, ifade, isr])', + example: '--8<-- "examples/hrtfmove.csd"', + parameters: [ + { + name: 'ifilel', + description: 'left HRTF spectral data file', + type: 'initialization' + }, + { + name: 'ifiler', + description: 'right HRTF spectral data file', + type: 'initialization' + }, + { + name: 'imode', + description: 'optional, default 0 for phase truncation, 1 for minimum phase', + type: 'initialization' + }, + { + name: 'ifade', + description: 'optional, number of processing buffers for phase change crossfade (default 8). Legal range is 1-24. A low value is recommended for complex sources (4 or less: a higher value may make the crossfade audible), a higher value (8 or more: a lower value may make the inconsistency when the filter changes phase values audible) for narrowband sources. Does not effect minimum phase processing.', + type: 'initialization' + }, + { + name: 'isr', + description: 'optional, default 44.1kHz, legal values: 44100, 48000 and 96000.', + type: 'initialization' + }, + { + name: 'kAz', + description: 'azimuth value in degrees. Positive values represent position on the right, negative values are positions on the left.', + type: 'performance' + }, + { + name: 'kElev', + description: 'elevation value in degrees. Positive values represent position above horizontal, negative values are positions below horizontal (min -40).', + type: 'performance' + }, + ], + seeAlso: ['Panning and Spatialization: Binaural spatialization', 'http://www.csoundjournal.com/issue9/newHRTFOpcodes.html'] +}, +{ + name: 'hrtfmove2', + type: 'opcode', + category: 'Signal Modifiers:Panning and Spatialization', + description: 'Generates dynamic 3d binaural audio for headphones using a Woodworth based spherical head model with improved low frequency phase accuracy.', + syntax: 'aleft, aright = hrtfmove2(asrc, kAz, kElev, ifilel, ifiler [,ioverlap, iradius, isr])', + example: '--8<-- "examples/hrtfmove2.csd"', + parameters: [ + { + name: 'ifilel', + description: 'left HRTF spectral data file', + type: 'initialization' + }, + { + name: 'ifiler', + description: 'right HRTF spectral data file', + type: 'initialization' + }, + { + name: 'ioverlap', + description: 'optional, number of overlaps for STFT processing (default 4). See STFT section of manual.', + type: 'initialization' + }, + { + name: 'iradius', + description: 'optional, head radius used for phase spectra calculation in centimeters (default 9.0)', + type: 'initialization' + }, + { + name: 'isr', + description: 'optional, default 44.1kHz, legal values: 44100, 48000 and 96000.', + type: 'initialization' + }, + { + name: 'asrc', + description: 'Input/source signal.', + type: 'performance' + }, + { + name: 'kAz', + description: 'azimuth value in degrees. Positive values represent position on the right, negative values are positions on the left.', + type: 'performance' + }, + { + name: 'kElev', + description: 'elevation value in degrees. Positive values represent position above horizontal, negative values are positions below horizontal (min -40).', + type: 'performance' + }, + ], + seeAlso: ['Panning and Spatialization: Binaural spatialization', 'http://www.csoundjournal.com/issue9/newHRTFOpcodes.html'] +}, +{ + name: 'hrtfreverb', + type: 'opcode', + category: 'Signal Modifiers:Panning and Spatialization', + description: 'A binaural, dynamic FDN based diffuse-field reverberator. The opcode works independently as an efficient, flexible reverberator.', + syntax: 'aleft, aright, idel = hrtfreverb(asrc, ilowrt60, ihighrt60, ifilel, ifiler \\\n [,isr, imfp, iorder])', + example: '--8<-- "examples/hrtfearly.csd"', + parameters: [ + { + name: 'ilowrt60', + description: 'low frequency reverb time.', + type: 'initialization' + }, + { + name: 'ihighrt60', + description: 'high frequency reverb time.', + type: 'initialization' + }, + { + name: 'ifilel', + description: 'left HRTF spectral data file.', + type: 'initialization' + }, + { + name: 'ifiler', + description: 'right HRTF spectral data file.', + type: 'initialization' + }, + { + name: 'isr', + description: 'optional, default 44.1kHz, legal values: 44100, 48000 and 96000.', + type: 'initialization' + }, + { + name: 'imfp', + description: 'optional, mean free path, defaults to that of a medium room. If used with [hrtfearly](../opcodes/hrtfearly.md), the mean free path of the room can be used to calculate the appropriate delay for the later reverb. Legal range: the mean free path of the smallest room allowed by hrtfearly (0.003876) 1.', + type: 'initialization' + }, + { + name: 'iorder', + description: 'optional, order of early reflection processing. If used with [hrtfearly](../opcodes/hrtfearly.md), the order of early reflections can be used to calculate the appropriate delay on the later reverb.', + type: 'initialization' + }, + { + name: 'asrc', + description: 'Input/source signal.', + type: 'performance' + }, + ], + seeAlso: ['Panning and Spatialization: Binaural spatialization'] +}, +{ + name: 'hrtfstat', + type: 'opcode', + category: 'Signal Modifiers:Panning and Spatialization', + description: 'Generates static 3d binaural audio for headphones using a Woodworth based spherical head model with improved low frequency phase accuracy.', + syntax: 'aleft, aright = hrtfstat(asrc, iAz, iElev, ifilel, ifiler [,iradius, isr])', + example: '--8<-- "examples/hrtfstat.csd"', + parameters: [ + { + name: 'iAz', + description: 'azimuth value in degrees. Positive values represent position on the right, negative values are positions on the left.', + type: 'initialization' + }, + { + name: 'iElev', + description: 'elevation value in degrees. Positive values represent position above horizontal, negative values are positions below horizontal (min -40).', + type: 'initialization' + }, + { + name: 'ifilel', + description: 'left HRTF spectral data file', + type: 'initialization' + }, + { + name: 'ifiler', + description: 'right HRTF spectral data file', + type: 'initialization' + }, + { + name: 'iradius', + description: 'optional, head radius used for phase spectra calculation in centimeters (default 9.0)', + type: 'initialization' + }, + { + name: 'isr', + description: 'optional (default 44.1kHz). Legal values are 44100, 48000 and 96000.', + type: 'initialization' + }, + ], + seeAlso: ['Panning and Spatialization: Binaural spatialization', 'http://www.csoundjournal.com/issue9/newHRTFOpcodes.html'] +}, +{ + name: 'locsend', + type: 'opcode', + category: 'Signal Modifiers:Panning and Spatialization', + description: 'Distributes the audio signals of a previous [locsig](../opcodes/locsig.md) opcode.', + syntax: 'a1, a2 = locsend()\n a1, a2, a3, a4 = locsend()', + example: 'asig some audio signal\n kdegree line 0, p3, 360\n kdistance line 1, p3, 10\n a1, a2, a3, a4 locsig asig, kdegree, kdistance, .1\n ar1, ar2, ar3, ar4 locsend\n ga1 = ga1+ar1\n ga2 = ga2+ar2\n ga3 = ga3+ar3\n ga4 = ga4+ar4\n outq a1, a2, a3, a4\nendin\n\ninstr 99 ; reverb instrument\n a1 reverb2 ga1, 2.5, .5\n a2 reverb2 ga2, 2.5, .5\n a3 reverb2 ga3, 2.5, .5\n a4 reverb2 ga4, 2.5, .5\n outq a1, a2, a3, a4\n ga1=0\n ga2=0\n ga3=0\n ga4=0', + seeAlso: ['Panning and Spatialization: Amplitude spatialization'] +}, +{ + name: 'locsig', + type: 'opcode', + category: 'Signal Modifiers:Panning and Spatialization', + description: 'Takes an input signal and distributes between 2 or 4 channels.', + syntax: 'a1, a2 = locsig(asig, kdegree, kdistance, kreverbsend)\n a1, a2, a3, a4 = locsig(asig, kdegree, kdistance, kreverbsend)', + example: '--8<-- "examples/locsig_quad.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'kdegree', + description: 'value between 0 and 360 for placement of the signal in a 2 or 4 channel space configured as: a1=0, a2=90, a3=180, a4=270 (kdegree=45 would balanced the signal equally between a1 and a2). _locsig_ maps _kdegree_ to sin and cos functions to derive the signal balances (e.g.: asig=1, kdegree=45, a1=a2=.707).', + type: 'performance' + }, + { + name: 'kdistance', + description: 'value >= 1 used to attenuate the signal and to calculate reverb level to simulate distance cues. As _kdistance_ gets larger the sound should get softer and somewhat more reverberant (assuming the use of _locsend_ in this case).', + type: 'performance' + }, + { + name: 'kreverbsend', + description: 'the percentage of the direct signal that will be factored along with the distance and degree values to derive signal amounts that can be sent to a reverb unit such as _reverb_, or _reverb2_.', + type: 'performance' + }, + ], + seeAlso: ['Panning and Spatialization: Amplitude spatialization'] +}, +{ + name: 'ms2st', + type: 'opcode', + category: 'Signal Modifiers:Panning and Spatialization', + description: 'Mid-Side to stereo Conversion with a width control.', + syntax: 'aleft,aright = ms2st(am, as, kwidth)', + example: '--8<-- "examples/ms2st.csd"', + parameters: [ + { + name: 'aleft', + description: 'left channel output.', + type: 'performance' + }, + { + name: 'aright', + description: 'right channel output.', + type: 'performance' + }, + { + name: 'am', + description: 'mid signal input.', + type: 'performance' + }, + { + name: 'as', + description: 'side signal input.', + type: 'performance' + }, + { + name: 'kwidth', + description: 'stereo width (0 to 1). At 0, no side signal is output, and at 1 no mid signal is present. A value of 0.5 restores a stereo to MS conversion (st2ms) exactly.', + type: 'performance' + }, + ], + seeAlso: ['Panning and Spatialization: Amplitude spatialization'] +}, +{ + name: 'pan', + type: 'opcode', + category: 'Signal Modifiers:Panning and Spatialization', + description: 'Distribute an audio signal amongst four channels with localization control.', + syntax: 'a1, a2, a3, a4 = pan(asig, kx, ky, ifn [, imode] [, ioffset])', + example: '--8<-- "examples/pan.csd"', + rates: ['a-rate', 'i-rate'], + parameters: [ + { + name: 'ifn', + description: 'function table number of a stored pattern describing the amplitude growth in a speaker channel as sound moves towards it from an adjacent speaker. Requires extended guard-point.', + type: 'initialization' + }, + ], + seeAlso: ['Panning and Spatialization: Amplitude spatialization'] +}, +{ + name: 'pan2', + type: 'opcode', + category: 'Signal Modifiers:Panning and Spatialization', + description: 'Distribute an audio signal across two channels with a choice of methods.', + syntax: 'a1, a2 = pan2(asig, xp [, imode])\n aouts[] = pan2(asig, xp [, imode])', + example: '--8<-- "examples/pan2.csd"', + rates: ['a-rate'], + seeAlso: ['Panning and Spatialization: Amplitude spatialization'] +}, +{ + name: 'space', + type: 'opcode', + category: 'Signal Modifiers:Panning and Spatialization', + description: 'Distributes an input signal among 4 channels using cartesian coordinates.', + syntax: 'a1, a2, a3, a4 = space(asig, ifn, ktime, kreverbsend, kx, ky)', + example: '--8<-- "examples/space_quad.csd"', + rates: ['a-rate', 'i-rate'], + parameters: [ + { + name: 'ifn', + description: 'number of the stored function created using [Gen28](../scoregens/gen28.md). This function generator reads a text file which contains sets of three values representing the xy coordinates and a time-tag for when the signal should be placed at that location. The file should look like:', + type: 'initialization' + }, + { + name: 'asig', + description: 'input audio signal.', + type: 'performance' + }, + { + name: 'ktime', + description: 'index into the table containing the xy coordinates. If used like:', + type: 'performance' + }, + { + name: 'kreverbsend', + description: 'the percentage of the direct signal that will be factored along with the distance as derived from the xy coordinates to calculate signal amounts that can be sent to reverb units such as _reverb_, or _reverb2_.', + type: 'performance' + }, + { + name: 'kx', + description: 'when _ifn_ is 0, _space_ and _spdist_ will use these values as the xy coordinates to localize the signal.', + type: 'performance' + }, + { + name: 'ky', + description: 'when _ifn_ is 0, _space_ and _spdist_ will use these values as the xy coordinates to localize the signal.', + type: 'performance' + }, + ], + seeAlso: ['Panning and Spatialization: Amplitude spatialization'] +}, +{ + name: 'spat3d', + type: 'opcode', + category: 'Signal Modifiers:Panning and Spatialization', + description: 'Positions the input sound in a 3D space and allows moving the sound at k-rate.', + syntax: 'aW, aX, aY, aZ = spat3d(ain, kX, kY, kZ, idist, ift, imode, imdel, iovr [, istor])', + example: '--8<-- "examples/spat3d_stereo.csd"', + parameters: [ + { + name: 'idist', + description: 'For modes 0 to 3, _idist_ is the unit circle distance in meters. For mode 4, _idist_ is the distance between microphones.', + type: 'initialization' + }, + { + name: 'ift', + description: 'Function table storing room parameters (for free field spatialization, set it to zero or negative). Table size is 54. The values in the table are:', + type: 'initialization' + }, + { + name: 'imode', + description: 'Output mode', + type: 'initialization' + }, + { + name: 'imdel', + description: 'Maximum delay time for spat3d in seconds. This has to be longer than the delay time of the latest reflection (depends on room dimensions, sound source distance, and recursion depth; using this formula gives a safe (although somewhat overestimated) value:', + type: 'initialization' + }, + { + name: 'iovr', + description: 'Oversample ratio for spat3d (1 to 8). Setting it higher improves quality at the expense of memory and CPU usage. The recommended value is 2.', + type: 'initialization' + }, + { + name: 'aW', + description: 'Output signals', + type: 'performance' + }, + { + name: 'aX', + description: 'Output signals', + type: 'performance' + }, + { + name: 'aY', + description: 'Output signals', + type: 'performance' + }, + { + name: 'aZ', + description: 'Output signals', + type: 'performance' + }, + { + name: 'ain', + description: 'Input signal', + type: 'performance' + }, + { + name: 'kX', + description: 'Sound source coordinates (in meters)', + type: 'performance' + }, + { + name: 'kY', + description: 'Sound source coordinates (in meters)', + type: 'performance' + }, + { + name: 'kZ', + description: 'Sound source coordinates (in meters)', + type: 'performance' + }, + ], + seeAlso: ['Panning and Spatialization: Simulation of room acoustics'] +}, +{ + name: 'spat3di', + type: 'opcode', + category: 'Signal Modifiers:Panning and Spatialization', + description: 'Positions the input sound in a 3D space with the sound source position set at i-time.', + syntax: 'aW, aX, aY, aZ = spat3di(ain, iX, iY, iZ, idist, ift, imode [, istor])', + parameters: [ + { + name: 'iX', + description: 'Sound source X coordinate in meters (positive: right, negative: left)', + type: 'initialization' + }, + { + name: 'iY', + description: 'Sound source Y coordinate in meters (positive: front, negative: back)', + type: 'initialization' + }, + { + name: 'iZ', + description: 'Sound source Z coordinate in meters (positive: up, negative: down)', + type: 'initialization' + }, + { + name: 'idist', + description: 'For modes 0 to 3, _idist_ is the unit circle distance in meters. For mode 4, _idist_ is the distance between microphones.', + type: 'initialization' + }, + { + name: 'ift', + description: 'Function table storing room parameters (for free field spatialization, set it to zero or negative). Table size is 54. The values in the table are:', + type: 'initialization' + }, + { + name: 'imode', + description: 'Output mode', + type: 'initialization' + }, + { + name: 'ain', + description: 'Input signal', + type: 'performance' + }, + { + name: 'aW', + description: 'Output signals', + type: 'performance' + }, + { + name: 'aX', + description: 'Output signals', + type: 'performance' + }, + { + name: 'aY', + description: 'Output signals', + type: 'performance' + }, + { + name: 'aZ', + description: 'Output signals', + type: 'performance' + }, + ], + seeAlso: ['Panning and Spatialization: Simulation of room acoustics'] +}, +{ + name: 'spat3dt', + type: 'opcode', + category: 'Signal Modifiers:Panning and Spatialization', + description: 'Can be used to render an impulse response for a 3D space at i-time.', + syntax: 'spat3dt(ioutft, iX, iY, iZ, idist, ift, imode, irlen [, iftnocl])', + example: '--8<-- "examples/spat3dt.csd"', + parameters: [ + { + name: 'ioutft', + description: 'Output ftable number for spat3dt. W, X, Y, and Z outputs are written interleaved to this table. If the table is too short, output will be truncated.', + type: 'initialization' + }, + { + name: 'iX', + description: 'Sound source X coordinate in meters (positive: right, negative: left)', + type: 'initialization' + }, + { + name: 'iY', + description: 'Sound source Y coordinate in meters (positive: front, negative: back)', + type: 'initialization' + }, + { + name: 'iZ', + description: 'Sound source Z coordinate in meters (positive: up, negative: down)', + type: 'initialization' + }, + { + name: 'idist', + description: 'For modes 0 to 3, _idist_ is the unit circle distance in meters. For mode 4, _idist_ is the distance between microphones.', + type: 'initialization' + }, + { + name: 'ift', + description: 'Function table storing room parameters (for free field spatialization, set it to zero or negative). Table size is 54. The values in the table are:', + type: 'initialization' + }, + { + name: 'imode', + description: 'Output mode', + type: 'initialization' + }, + { + name: 'irlen', + description: 'Impulse response length of echoes (in seconds). Depending on filter parameters, values around 0.005-0.01 are suitable for most uses (higher values result in more accurate output, but slower rendering)', + type: 'initialization' + }, + ], + seeAlso: ['Panning and Spatialization: Simulation of room acoustics'] +}, +{ + name: 'spdist', + type: 'opcode', + category: 'Signal Modifiers:Panning and Spatialization', + description: 'Calculates distance values from xy coordinates.', + syntax: 'k1 = spdist(ifn, ktime, kx, ky)', + example: '--8<-- "examples/spdist.csd"', + rates: ['i-rate'], + parameters: [ + { + name: 'ifn', + description: 'number of the stored function created using [Gen28](../scoregens/gen28.md). This function generator reads a text file which contains sets of three values representing the xy coordinates and a time-tag for when the signal should be placed at that location. The file should look like:', + type: 'initialization' + }, + { + name: 'ktime', + description: 'index into the table containing the xy coordinates. If used like:', + type: 'performance' + }, + { + name: 'kx', + description: 'when _ifn_ is 0, _space_ and _spdist_ will use these values as the XY coordinates to localize the signal.', + type: 'performance' + }, + { + name: 'ky', + description: 'when _ifn_ is 0, _space_ and _spdist_ will use these values as the XY coordinates to localize the signal.', + type: 'performance' + }, + ], + seeAlso: ['Panning and Spatialization: Amplitude spatialization'] +}, +{ + name: 'spsend', + type: 'opcode', + category: 'Signal Modifiers:Panning and Spatialization', + description: 'Generates output signals based on a previously defined [space](../opcodes/space.md) opcode.', + syntax: 'a1, a2, a3, a4 = spsend()', + example: '--8<-- "examples/spsend.csd"', + seeAlso: ['Panning and Spatialization: Amplitude spatialization'] +}, +{ + name: 'st2ms', + type: 'opcode', + category: 'Signal Modifiers:Panning and Spatialization', + description: 'Stereo to Mid-Side Conversion.', + syntax: 'am,as = st2ms(aleft,aright)', + example: '--8<-- "examples/st2ms.csd"', + parameters: [ + { + name: 'am', + description: 'mid signal output.', + type: 'performance' + }, + { + name: 'as', + description: 'side signal output.', + type: 'performance' + }, + { + name: 'aleft', + description: 'left channel input.', + type: 'performance' + }, + { + name: 'aright', + description: 'right channel input.', + type: 'performance' + }, + ], + seeAlso: ['Panning and Spatialization: Amplitude spatialization'] +}, +] diff --git a/src/lib/csound-reference/signal-modifiers-reverberation.ts b/src/lib/csound-reference/signal-modifiers-reverberation.ts new file mode 100644 index 0000000..dbb65d1 --- /dev/null +++ b/src/lib/csound-reference/signal-modifiers-reverberation.ts @@ -0,0 +1,360 @@ +import type { CsoundReference } from './types' + +// Signal Modifiers:Reverberation +export const signalModifiersReverberation: CsoundReference[] = [ +{ + name: 'alpass', + type: 'opcode', + category: 'Signal Modifiers:Reverberation', + description: 'Reverberates an input signal with a flat frequency response.', + syntax: 'ares = alpass(asig, xrvt, ilpt [, iskip] [, insmps])', + example: '--8<-- "examples/alpass-modern.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'ilpt', + description: 'loop time in seconds, which determines the “echo density” of the reverberation. This in turn characterizes the “color” of the filter whose frequency response curve will contain _ilpt_ * _sr_/2 peaks spaced evenly between 0 and _sr_/2 (the Nyquist frequency). Loop time can be as large as available memory will permit. The space required for an _n_ second loop is 4_n_*_sr_ bytes. The delay space is allocated and returned as in [delay](../opcodes/delay.md).', + type: 'initialization' + }, + { + name: 'xrvt', + description: 'the reverberation time (defined as the time in seconds for a signal to decay to 1/1000, or 60dB down from its original amplitude).', + type: 'performance' + }, + ], + seeAlso: ['Reverberation'] +}, +{ + name: 'babo', + type: 'opcode', + category: 'Signal Modifiers:Reverberation', + description: 'A physical model reverberator.', + syntax: 'a1, a2 = babo(asig, ksrcx, ksrcy, ksrcz, irx, iry, irz [, idiff] [, ifno])\n a1, a2 = babo2(asig, ksrcx, ksrcy, ksrcz, irx, iry, irz [, idiff] [, ifno])', + example: '--8<-- "examples/babo.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'irx', + description: 'the coordinates of the geometry of the resonator (length of the edges in meters)', + type: 'initialization' + }, + { + name: 'iry', + description: 'the coordinates of the geometry of the resonator (length of the edges in meters)', + type: 'initialization' + }, + { + name: 'irz', + description: 'the coordinates of the geometry of the resonator (length of the edges in meters)', + type: 'initialization' + }, + { + name: 'idiff', + description: 'is the coefficient of diffusion at the walls, which regulates the amount of diffusion (0-1, where 0 = no diffusion, 1 = maximum diffusion - default: 1)', + type: 'initialization' + }, + { + name: 'ifno', + description: 'expert values function: a function number that holds all the additional parameters of the resonator. This is typically a GEN2--type function used in non-rescaling mode. They are as follows:', + type: 'initialization' + }, + { + name: 'decay', + description: 'main decay of the resonator (default: 0.99) * _hydecay_ -- high frequency decay of the resonator (default: 0.1) * _rcvx, rcvy, rcvz_ -- the coordinates of the position of the receiver (the listener) (in meters; 0,0,0 is the resonator center) * _rdistance_ -- the distance in meters between the two pickups (your ears, for example - default: 0.3) * _direct_ -- the attenuation of the direct signal (0-1, default: 0.5). This is a non-op in babo, but has been introduced in babo2. * _early_diff_ -- the attenuation coefficient of the early reflections (0-1, default: 0.8)', + type: 'initialization' + }, + { + name: 'asig', + description: 'the input signal', + type: 'performance' + }, + { + name: 'ksrcx', + description: 'the virtual coordinates of the source of sound (the input signal). These are allowed to move at k-rate and provide all the necessary variations in terms of response of the resonator.', + type: 'performance' + }, + { + name: 'ksrcy', + description: 'the virtual coordinates of the source of sound (the input signal). These are allowed to move at k-rate and provide all the necessary variations in terms of response of the resonator.', + type: 'performance' + }, + { + name: 'ksrcz', + description: 'the virtual coordinates of the source of sound (the input signal). These are allowed to move at k-rate and provide all the necessary variations in terms of response of the resonator.', + type: 'performance' + }, + ], + seeAlso: ['Reverberation'] +}, +{ + name: 'comb', + type: 'opcode', + category: 'Signal Modifiers:Reverberation', + description: 'Reverberates an input signal with a “colored” frequency response.', + syntax: 'ares = comb(asig, krvt, ilpt [, iskip] [, insmps])', + example: '--8<-- "examples/comb-modern.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'ilpt', + description: 'loop time in seconds, which determines the “echo density” of the reverberation. This in turn characterizes the “color” of the _comb_ filter whose frequency response curve will contain _ilpt_ * _sr_/2 peaks spaced evenly between 0 and _sr_/2 (the Nyquist frequency). Loop time can be as large as available memory will permit. The space required for an _n_ second loop is _n_*_sr_ floating or double numbers (usually 4 or 8 bytes). Delay space is allocated and returned as in [delay](../opcodes/delay.md).', + type: 'initialization' + }, + { + name: 'krvt', + description: 'the reverberation time (defined as the time in seconds for a signal to decay to 1/1000, or 60dB down from its original amplitude).', + type: 'performance' + }, + ], + seeAlso: ['Reverberation'] +}, +{ + name: 'combinv', + type: 'opcode', + category: 'Signal Modifiers:Reverberation', + description: 'Reverberates an input signal with a “colored” frequency response. with a FIR filter.', + syntax: 'ares = combinv(asig, krvt, ilpt [, iskip] [, insmps])', + example: '--8<-- "examples/combinv-modern.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'ilpt', + description: 'loop time in seconds, which determines the “echo density” of the reverberation. This in turn characterizes the “color” of the _combinv_ filter whose frequency response curve will contain _ilpt_ * _sr_/2 peaks spaced evenly between 0 and _sr_/2 (the Nyquist frequency). Loop time can be as large as available memory will permit. The space required for an _n_ second loop is _n_*_sr_ floating or double numbers (usually 4 or 8 bytes). Delay space is allocated and returned as in [delay](../opcodes/delay.md).', + type: 'initialization' + }, + { + name: 'krvt', + description: 'the reverberation time (defined as the time in seconds for a signal to decay to 1/1000, or 60dB down from its original amplitude).', + type: 'performance' + }, + ], + seeAlso: ['Reverberation'] +}, +{ + name: 'freeverb', + type: 'opcode', + category: 'Signal Modifiers:Reverberation', + description: 'Opcode version of Jezar\'s Freeverb.', + syntax: 'aoutL, aoutR = freeverb(ainL, ainR, kRoomSize, kHFDamp[, iSRate[, iSkip]])', + example: '--8<-- "examples/freeverb.csd"', + parameters: [ + { + name: 'ainL', + description: 'input signals; usually both are the same, but different inputs can be used for special effect', + type: 'performance' + }, + { + name: 'ainR', + description: 'input signals; usually both are the same, but different inputs can be used for special effect', + type: 'performance' + }, + { + name: 'aoutL', + description: 'output signals for left and right channel', + type: 'performance' + }, + { + name: 'aoutR', + description: 'output signals for left and right channel', + type: 'performance' + }, + ], + seeAlso: ['Reverberation'] +}, +{ + name: 'nestedap', + type: 'opcode', + category: 'Signal Modifiers:Reverberation', + description: 'Three different nested all-pass filters, useful for implementing reverbs.', + syntax: 'ares = nestedap(asig, imode, imaxdel, idel1, igain1 [, idel2] [, igain2] \\\n [, idel3] [, igain3] [, istor])', + example: '--8<-- "examples/nestedap.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'imode', + description: 'operating mode of the filter:', + type: 'initialization' + }, + { + name: 'idel1', + description: 'delay times of the filter stages. Delay times are in seconds and must be greater than zero. _idel1_ must be greater than the sum of _idel2_ and _idel3_.', + type: 'initialization' + }, + { + name: 'idel2', + description: 'delay times of the filter stages. Delay times are in seconds and must be greater than zero. _idel1_ must be greater than the sum of _idel2_ and _idel3_.', + type: 'initialization' + }, + { + name: 'idel3', + description: 'delay times of the filter stages. Delay times are in seconds and must be greater than zero. _idel1_ must be greater than the sum of _idel2_ and _idel3_.', + type: 'initialization' + }, + { + name: 'igain1', + description: 'gain of the filter stages.', + type: 'initialization' + }, + { + name: 'igain2', + description: 'gain of the filter stages.', + type: 'initialization' + }, + { + name: 'igain3', + description: 'gain of the filter stages.', + type: 'initialization' + }, + { + name: 'imaxdel', + description: 'will be necessary if k-rate delays are implemented. Not currently used.', + type: 'initialization' + }, + { + name: 'istor', + description: 'Skip initialization if non-zero (default: 0).', + type: 'initialization' + }, + { + name: 'asig', + description: 'input signal', + type: 'performance' + }, + ], + seeAlso: ['Reverberation'] +}, +{ + name: 'nreverb', + type: 'opcode', + category: 'Signal Modifiers:Reverberation', + description: 'A reverberator consisting of 6 parallel comb-lowpass filters.', + syntax: 'ares = nreverb(asig, ktime, khdif [, iskip] [,inumCombs] [, ifnCombs] \\\n [, inumAlpas] [, ifnAlpas])', + example: '--8<-- "examples/nreverb.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'ifnCombs', + description: 'function table with _inumCombs_ comb filter time values, followed the same number of gain values. The ftable should not be rescaled (use negative fgen number). Positive time values are in seconds. The time values are converted internally into number of samples, then set to the next greater prime number. If the time is negative, it is interpreted directly as time in sample frames, and no processing is done (except negation). New in Csound version 4.09.', + type: 'initialization' + }, + ], + seeAlso: ['Reverberation'] +}, +{ + name: 'platerev', + type: 'opcode', + category: 'Signal Modifiers:Reverberation', + description: 'Models the reverberation of a rectangular metal plate with settable physical characteristics when excited by audio signal(s).', + syntax: 'a1[, a2, ...] = platerev(itabexcite. itabouts, kbndry, iaspect, istiff, idecay, \\\n iloss, aexcite1[, aexcite2, ...])', + example: '--8<-- "examples/plate.csd"', + parameters: [ + { + name: 'itabexcite', + description: 'number of a table that contains triplets for each excitation signal, (frequency, radius, initial phase in radians). The radius should be less than 1. These control where the excitation happens. The values in the table for frequency and radius may be changed in performance, with the proviso about clicking if the changes are too large.', + type: 'initialization' + }, + { + name: 'itabouts', + description: 'number of a table that contains triplets for each output signal, (frequency, radius, initial phase in radians). See itabexcite description.', + type: 'initialization' + }, + { + name: 'kbndry', + description: 'boundary condition of the plate; 0 = free, 1 = clamped, 2 = pivoting. Other values are undefined. Thus parameter may be changed at k-rate but that might give rise to clicks.', + type: 'initialization' + }, + { + name: 'iaspect', + description: 'plate aspect ratio which should be less than or equal to 1.', + type: 'initialization' + }, + { + name: 'istiff', + description: 'plate stiffness parameter (set around 1 or less for plate reverb).', + type: 'initialization' + }, + { + name: 'idecay', + description: 'time taken for 30 dB decay', + type: 'initialization' + }, + { + name: 'iloss', + description: 'loss parameter for high-frequency damping (value about 0.001 suggested).', + type: 'initialization' + }, + { + name: 'aexciten', + description: 'excitation signal to be inserted into the plate.', + type: 'performance' + }, + ], + seeAlso: ['Reverberation'] +}, +{ + name: 'reverb', + type: 'opcode', + category: 'Signal Modifiers:Reverberation', + description: 'Reverberates an input signal with a “natural room” frequency response.', + syntax: 'ares = reverb(asig, krvt [, iskip])', + example: '--8<-- "examples/reverb.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'krvt', + description: 'the reverberation time (defined as the time in seconds for a signal to decay to 1/1000, or 60dB down from its original amplitude).', + type: 'performance' + }, + ], + seeAlso: ['Reverberation'] +}, +{ + name: 'reverb2', + type: 'opcode', + category: 'Signal Modifiers:Reverberation', + description: 'Same as the [nreverb](../opcodes/nreverb.md) opcode.', + syntax: 'ares = reverb2(asig, ktime, khdif [, iskip] [,inumCombs] [, ifnCombs] \\\n [, inumAlpas] [, ifnAlpas])', + rates: ['a-rate'], +}, +{ + name: 'reverbsc', + type: 'opcode', + category: 'Signal Modifiers:Reverberation', + description: '8 delay line stereo FDN reverb.', + syntax: 'aoutL, aoutR = reverbsc(ainL, ainR, kfblvl, kfco[, israte[, ipitchm[, iskip]]])', + example: '--8<-- "examples/reverbsc.csd"', + parameters: [ + { + name: 'aoutL', + description: 'output signals for left and right channel', + type: 'performance' + }, + { + name: 'aoutR', + description: 'output signals for left and right channel', + type: 'performance' + }, + { + name: 'ainL', + description: 'left and right channel input. Note that having an input signal on either the left or right channel only will still result in having reverb output on both channels, making this unit more suitable for reverberating stereo input than the [freeverb](../opcodes/freeverb.md) opcode.', + type: 'performance' + }, + { + name: 'ainR', + description: 'left and right channel input. Note that having an input signal on either the left or right channel only will still result in having reverb output on both channels, making this unit more suitable for reverberating stereo input than the [freeverb](../opcodes/freeverb.md) opcode.', + type: 'performance' + }, + { + name: 'kfblvl', + description: 'feedback level, in the range 0 to 1. 0.6 gives a good small "live" room sound, 0.8 a small hall, and 0.9 a large hall. A setting of exactly 1 means infinite length, while higher values will make the opcode unstable.', + type: 'performance' + }, + { + name: 'kfco', + description: 'cutoff frequency of simple first order lowpass filters in the feedback loop of delay lines, in Hz. Should be in the range 0 to israte/2 (not sr/2). A lower value means faster decay in the high frequency range.', + type: 'performance' + }, + ], + seeAlso: ['Reverberation'] +}, +] diff --git a/src/lib/csound-reference/signal-modifiers-sample-level-operators.ts b/src/lib/csound-reference/signal-modifiers-sample-level-operators.ts new file mode 100644 index 0000000..1f48333 --- /dev/null +++ b/src/lib/csound-reference/signal-modifiers-sample-level-operators.ts @@ -0,0 +1,171 @@ +import type { CsoundReference } from './types' + +// Signal Modifiers:Sample Level Operators +export const signalModifiersSampleLevelOperators: CsoundReference[] = [ +{ + name: 'denorm', + type: 'opcode', + category: 'Signal Modifiers:Sample Level Operators', + description: 'Mixes low level (~1e-20 for floats, and ~1e-56 for doubles) noise to a list of a-rate signals.', + syntax: 'denorm(a1[, a2[, a3[, ... ]]])', + example: '--8<-- "examples/denorm.csd"', + seeAlso: ['Sample Level Operators'] +}, +{ + name: 'diff', + type: 'opcode', + category: 'Signal Modifiers:Sample Level Operators', + description: 'Modify a signal by differentiation.', + syntax: 'ares = diff(asig [, iskip])\n kres = diff(ksig [, iskip])', + example: '--8<-- "examples/diff.csd"', + rates: ['a-rate', 'k-rate'], + seeAlso: ['Sample Level Operators'] +}, +{ + name: 'downsamp', + type: 'opcode', + category: 'Signal Modifiers:Sample Level Operators', + description: 'Modify a signal by down-sampling.', + syntax: 'kres = downsamp(asig [, iwlen])', + example: '--8<-- "examples/downsamp.csd"', + rates: ['a-rate', 'k-rate'], + seeAlso: ['Sample Level Operators'] +}, +{ + name: 'fold', + type: 'opcode', + category: 'Signal Modifiers:Sample Level Operators', + description: 'Adds artificial foldover to an audio signal.', + syntax: 'ares = fold(asig, kincr)', + example: '--8<-- "examples/fold.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'asig', + description: 'input signal', + type: 'performance' + }, + { + name: 'kincr', + description: 'amount of foldover expressed in multiple of sampling rate. Must be >= 1', + type: 'performance' + }, + ], + seeAlso: ['Sample Level Operators'] +}, +{ + name: 'integ', + type: 'opcode', + category: 'Signal Modifiers:Sample Level Operators', + description: 'Modify a signal by integration.', + syntax: 'ares = integ(asig [, iskip])\n kres = integ(ksig [, iskip])', + example: '--8<-- "examples/integ.csd"', + rates: ['a-rate', 'k-rate'], + seeAlso: ['Sample Level Operators'] +}, +{ + name: 'interp', + type: 'opcode', + category: 'Signal Modifiers:Sample Level Operators', + description: 'Converts a control signal to an audio signal using linear interpolation.', + syntax: 'ares = interp(ksig [, iskip] [, imode] [, ivalue])', + example: '--8<-- "examples/interp.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'ksig', + description: 'input k-rate signal.', + type: 'performance' + }, + ], + seeAlso: ['Sample Level Operators', 'Csound Journal, issue10 - An Overview of Csound Variable Types'] +}, +{ + name: 'ntrpol', + type: 'opcode', + category: 'Signal Modifiers:Sample Level Operators', + description: 'Calculates the weighted mean value (i.e. linear interpolation) of two input signals.', + syntax: 'ares = ntrpol(asig1, asig2, kpoint [, imin] [, imax])\n ires = ntrpol(isig1, isig2, ipoint [, imin] [, imax])\n kres = ntrpol(ksig1, ksig2, kpoint [, imin] [, imax])', + example: '--8<-- "examples/ntrpol.csd"', + rates: ['a-rate', 'k-rate', 'i-rate'], + parameters: [ + { + name: 'imin', + description: 'minimum xpoint value (optional, default 0)', + type: 'initialization' + }, + { + name: 'imax', + description: 'maximum xpoint value (optional, default 1)', + type: 'initialization' + }, + { + name: 'xsig1', + description: 'input signals', + type: 'performance' + }, + { + name: 'xsig2', + description: 'input signals', + type: 'performance' + }, + { + name: 'xpoint', + description: 'interpolation point between the two values', + type: 'performance' + }, + ], + seeAlso: ['Sample Level Operators'] +}, +{ + name: 'opa', + type: 'opcode', + category: 'Signal Modifiers:Sample Level Operators', + description: 'Converts a k-sig or k-array parameter to an a-sig output.', + example: '--8<-- "examples/opa.csd"', + seeAlso: ['Sample Level Operators', 'Csound Journal, issue 10'] +}, +{ + name: 'opi', + type: 'opcode', + category: 'Signal Modifiers:Sample Level Operators', + description: 'Returns an init-type equivalent of a k-rate argument or array element or directly returns an i-rate argument.', + seeAlso: ['Sample Level Operators', 'Csound Journal, issue 10'] +}, +{ + name: 'opk', + type: 'opcode', + category: 'Signal Modifiers:Sample Level Operators', + description: 'Converts a i-rate parameter to an k-rate value or an a-rate value to a k-rate value by down-sampling.', + seeAlso: ['Sample Level Operators', 'Csound Journal, issue 10'] +}, +{ + name: 'ops', + type: 'opcode', + category: 'Signal Modifiers:Sample Level Operators', + description: 'Returns a string containg the numeric value of its argument.', + seeAlso: ['Sample Level Operators'] +}, +{ + name: 'samphold', + type: 'opcode', + category: 'Signal Modifiers:Sample Level Operators', + description: 'Performs a sample-and-hold operation on its input.', + syntax: 'ares = samphold(asig, agate [, ival] [, ivstor])\n kres = samphold(ksig, kgate [, ival] [, ivstor])', + example: 'asrc buzz 10000, 440, 20, 1 ; band-limited pulse train\nadif diff asrc ; emphasize the highs\nanew balance adif, asrc ; but retain the power\nagate reson asrc, 0, 440 ; use a lowpass of the original\nasamp samphold anew, agate ; to gate the new audiosig\naout tone asamp, 100 ; smooth out the rough edges', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'kgate', + description: 'controls whether to hold the signal.', + type: 'performance' + }, + { + name: 'xgate', + description: 'controls whether to hold the signal.', + type: 'performance' + }, + ], + seeAlso: ['Sample Level Operators'] +}, +] diff --git a/src/lib/csound-reference/signal-modifiers-signal-limiters.ts b/src/lib/csound-reference/signal-modifiers-signal-limiters.ts new file mode 100644 index 0000000..1903600 --- /dev/null +++ b/src/lib/csound-reference/signal-modifiers-signal-limiters.ts @@ -0,0 +1,89 @@ +import type { CsoundReference } from './types' + +// Signal Modifiers:Signal Limiters +export const signalModifiersSignalLimiters: CsoundReference[] = [ +{ + name: 'limit', + type: 'opcode', + category: 'Signal Modifiers:Signal Limiters', + description: 'Sets the lower and upper limits of the value it processes.', + syntax: 'ares = limit(asig, klow, khigh)\n ires = limit(isig, ilow, ihigh)\n kres = limit(ksig, klow, khigh)\n ires[] = limit(isig[], ilow, ihigh)\n kres[] = limit(ksig[], klow, khigh)\n )', + example: '--8<-- "examples/limit.csd"', + rates: ['a-rate', 'k-rate', 'i-rate'], + parameters: [ + { + name: 'isig', + description: 'input signal', + type: 'initialization' + }, + { + name: 'ilow', + description: 'low threshold', + type: 'initialization' + }, + { + name: 'ihigh', + description: 'high threshold', + type: 'initialization' + }, + { + name: 'xsig', + description: 'input signal', + type: 'performance' + }, + { + name: 'klow', + description: 'low threshold', + type: 'performance' + }, + { + name: 'khigh', + description: 'high threshold', + type: 'performance' + }, + ], + seeAlso: ['Signal Limiters', 'Array opcodes'] +}, +{ + name: 'mirror', + type: 'opcode', + category: 'Signal Modifiers:Signal Limiters', + description: 'Reflects the signal that exceeds the low and high thresholds.', + syntax: 'ares = mirror(asig, klow, khigh)\n ires = mirror(isig, ilow, ihigh)\n kres = mirror(ksig, klow, khigh)', + example: '--8<-- "examples/mirror.csd"', + rates: ['a-rate', 'k-rate', 'i-rate'], + parameters: [ + { + name: 'isig', + description: 'input signal', + type: 'initialization' + }, + { + name: 'ilow', + description: 'low threshold', + type: 'initialization' + }, + { + name: 'ihigh', + description: 'high threshold', + type: 'initialization' + }, + { + name: 'xsig', + description: 'input signal', + type: 'performance' + }, + { + name: 'klow', + description: 'low threshold', + type: 'performance' + }, + { + name: 'khigh', + description: 'high threshold', + type: 'performance' + }, + ], + seeAlso: ['Signal Limiters'] +}, +] diff --git a/src/lib/csound-reference/signal-modifiers-special-effects.ts b/src/lib/csound-reference/signal-modifiers-special-effects.ts new file mode 100644 index 0000000..d3ca960 --- /dev/null +++ b/src/lib/csound-reference/signal-modifiers-special-effects.ts @@ -0,0 +1,275 @@ +import type { CsoundReference } from './types' + +// Signal Modifiers:Special Effects +export const signalModifiersSpecialEffects: CsoundReference[] = [ +{ + name: 'distort', + type: 'opcode', + category: 'Signal Modifiers:Special Effects', + description: 'Distort an audio signal via waveshaping and optional clipping.', + syntax: 'ar = distort(asig, kdist, ifn[, ihp, istor])', + example: '--8<-- "examples/distort.csd"', + rates: ['a-rate', 'i-rate'], + parameters: [ + { + name: 'ifn', + description: 'table number of a waveshaping function with extended guard point. The function can be of any shape, but it should pass through 0 with positive slope at the table mid-point. The table size need not be large, since it is read with interpolation.', + type: 'initialization' + }, + { + name: 'ihp', + description: '(optional) half-power point (in cps) of an internal low-pass filter. The default value is 10.', + type: 'initialization' + }, + { + name: 'istor', + description: '(optional) initial disposition of internal data space (see reson). The default value is 0.', + type: 'initialization' + }, + { + name: 'asig', + description: 'Audio signal to be processed', + type: 'performance' + }, + { + name: 'kdist', + description: 'Amount of distortion (usually between 0 and 1)', + type: 'performance' + }, + ], + seeAlso: ['Special Effects', 'Waveshaping'] +}, +{ + name: 'distort1', + type: 'opcode', + category: 'Signal Modifiers:Special Effects', + description: 'Modified hyperbolic tangent distortion.', + syntax: 'ares = distort1(asig, kpregain, kpostgain, kshape1, kshape2[, imode])', + example: '--8<-- "examples/distort1.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'asig', + description: 'is the input signal.', + type: 'performance' + }, + { + name: 'kpregain', + description: 'determines the amount of gain applied to the signal before waveshaping. A value of 1 gives slight distortion.', + type: 'performance' + }, + { + name: 'kpostgain', + description: 'determines the amount of gain applied to the signal after waveshaping.', + type: 'performance' + }, + { + name: 'kshape1', + description: 'determines the shape of the positive part of the curve. A value of 0 gives a flat clip, small positive values give sloped shaping.', + type: 'performance' + }, + { + name: 'kshape2', + description: 'determines the shape of the negative part of the curve.', + type: 'performance' + }, + ], + seeAlso: ['Special Effects', 'Waveshaping'] +}, +{ + name: 'doppler', + type: 'opcode', + category: 'Signal Modifiers:Special Effects', + description: 'A fast and robust method for approximating sound propagation, achieving convincing Doppler shifts without having to solve equations.', + syntax: 'ashifted = doppler(asource, ksourceposition, kmicposition [, isoundspeed, \\\n ifiltercutoff])', + example: '--8<-- "examples/doppler.csd"', + parameters: [ + { + name: 'asource', + description: 'Input signal at the sound source.', + type: 'performance' + }, + { + name: 'ksourceposition', + description: 'Position of the source sound in meters. The distance between source and mic should not be changed faster than about 3/4 the speed of sound.', + type: 'performance' + }, + { + name: 'kmicposition', + description: 'Position of the recording microphone in meters. The distance between source and mic should not be changed faster than about 3/4 the speed of sound.', + type: 'performance' + }, + ], + seeAlso: ['Special Effects'] +}, +{ + name: 'flanger', + type: 'opcode', + category: 'Signal Modifiers:Special Effects', + description: 'A user controlled flanger.', + syntax: 'ares = flanger(asig, adel, kfeedback [, imaxd])', + example: '--8<-- "examples/flanger.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'asig', + description: 'input signal', + type: 'performance' + }, + { + name: 'adel', + description: 'delay in seconds', + type: 'performance' + }, + { + name: 'kfeedback', + description: 'feedback amount (in normal tasks this should not exceed 1, even if bigger values are allowed)', + type: 'performance' + }, + ], + seeAlso: ['Special Effects', 'http://en.wikipedia.org/wiki/Flanger'] +}, +{ + name: 'harmon', + type: 'opcode', + category: 'Signal Modifiers:Special Effects', + description: 'Analyze an audio input and generate harmonizing voices in synchrony.', + syntax: 'ares = harmon(asig, kestfrq, kmaxvar, kgenfreq1, kgenfreq2, imode, iminfrq, iprd)', + example: '--8<-- "examples/harmon.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'imode', + description: 'interpreting mode for the generating frequency inputs _kgenfreq1_, _kgenfreq2_. 0: input values are ratios with respect to the audio signal analyzed frequency. 1: input values are the actual requested frequencies in Hz.', + type: 'initialization' + }, + { + name: 'iminfrq', + description: 'the lowest expected frequency (in Hz) of the audio input. This parameter determines how much of the input is saved for the running analysis, and sets a lower bound on the internal pitch tracker.', + type: 'initialization' + }, + { + name: 'iprd', + description: 'period of analysis (in seconds). Since the internal pitch analysis can be time-consuming, the input is typically analyzed only each 20 to 50 milliseconds.', + type: 'initialization' + }, + { + name: 'kestfrq', + description: 'estimated frequency of the input.', + type: 'performance' + }, + { + name: 'kmaxvar', + description: 'the maximum variance (expects a value betwee 0 and 1).', + type: 'performance' + }, + { + name: 'kgenfreq1', + description: 'the first generated frequency.', + type: 'performance' + }, + { + name: 'kgenfreq2', + description: 'the second generated frequency.', + type: 'performance' + }, + ], + seeAlso: ['Special Effects'] +}, +{ + name: 'harmon2', + type: 'opcode', + category: 'Signal Modifiers:Special Effects', + description: 'Analyze an audio input and generate harmonizing voices in synchrony with formants preserved.', + syntax: 'ares = harmon2(asig, koct, kfrq1, kfrq2, icpsmode, ilowest[, ipolarity])\n ares = harmon3(asig, koct, kfrq1, kfrq2, kfrq3, icpsmode, ilowest[, ipolarity])\n ares = harmon4(asig, koct, kfrq1, kfrq2, kfrq3, kfrq4, icpsmode, ilowest \\\n [, ipolarity])', + example: 'a1,a2 ins ; get mic input\nw1 spectrum a1, .02, 7, 24, 12, 1, 3 ; and examine it\nkoct,kamp specptrk w1, 1, 6.5, 9.5, 7.5, 10, 7, .7, 0, 3, 1\na3 delay a1, .065 ; allow for ptrk delay\na4 harmon2 a3, koct, 1.25, 0.75, 0, 6.9 ; output a fixed 6-4 harmony\n outs a3, a4 ; as well as the original', + rates: ['a-rate'], + parameters: [ + { + name: 'icpsmode', + description: 'interpreting mode for the generating frequency inputs _kfrq1_, _kfrq2_, _kfrq3_ and _kfrq4_: 0: input values are ratios w.r.t. the cps equivalent of _koct_.1: input values are the actual requested frequencies in cps.', + type: 'initialization' + }, + { + name: 'ilowest', + description: 'lowest value of the _koct_ input for which harmonizing voices will be generated.', + type: 'initialization' + }, + { + name: 'ipolarity', + description: 'polarity of _asig_ input, 1 = positive glottal pulses, 0 = negative. Default is 1.', + type: 'initialization' + }, + ], + seeAlso: ['Special Effects'] +}, +{ + name: 'phaser1', + type: 'opcode', + category: 'Signal Modifiers:Special Effects', + description: 'First-order allpass filters arranged in a series.', + syntax: 'ares = phaser1(asig, kfreq, kord, kfeedback [, iskip])', + example: '--8<-- "examples/phaser1.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'kfreq', + description: 'frequency (in Hz) of the filter(s). This is the frequency at which each filter in the series shifts its input by 90 degrees.', + type: 'performance' + }, + { + name: 'kord', + description: 'the number of allpass stages in series. These are first-order filters and can range from 1 to 4999.', + type: 'performance' + }, + { + name: 'kfeedback', + description: 'amount of the output which is fed back into the input of the allpass chain. With larger amounts of feedback, more prominent notches appear in the spectrum of the output. _kfeedback_ must be between -1 and +1. for stability.', + type: 'performance' + }, + ], + seeAlso: ['Special Effects'] +}, +{ + name: 'phaser2', + type: 'opcode', + category: 'Signal Modifiers:Special Effects', + description: 'Second-order allpass filters arranged in a series.', + syntax: 'ares = phaser2(asig, kfreq, kq, kord, kmode, ksep, kfeedback)', + example: '--8<-- "examples/phaser2.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'kfreq', + description: 'frequency (in Hz) of the filter(s). This is the center frequency of the notch of the first allpass filter in the series. This frequency is used as the base frequency from which the frequencies of the other notches are derived.', + type: 'performance' + }, + { + name: 'kq', + description: 'Q of each notch. Higher Q values result in narrow notches. A Q between 0.5 and 1 results in the strongest "phasing" effect, but higher Q values can be used for special effects.', + type: 'performance' + }, + { + name: 'kord', + description: 'the number of allpass stages in series. These are second-order filters, and iord can range from 1 to 2499. With higher orders, the computation time increases.', + type: 'performance' + }, + { + name: 'kfeedback', + description: 'amount of the output which is fed back into the input of the allpass chain. With larger amounts of feedback, more prominent notches appear in the spectrum of the output. _kfeedback_ must be between -1 and +1. for stability.', + type: 'performance' + }, + { + name: 'kmode', + description: 'used in calculation of notch frequencies.', + type: 'performance' + }, + { + name: 'ksep', + description: 'scaling factor used, in conjunction with _imode_, to determine the frequencies of the additional notches in the output spectrum.', + type: 'performance' + }, + ], + seeAlso: ['Special Effects'] +}, +] diff --git a/src/lib/csound-reference/signal-modifiers-specialized-filters.ts b/src/lib/csound-reference/signal-modifiers-specialized-filters.ts new file mode 100644 index 0000000..fd2b019 --- /dev/null +++ b/src/lib/csound-reference/signal-modifiers-specialized-filters.ts @@ -0,0 +1,476 @@ +import type { CsoundReference } from './types' + +// Signal Modifiers:Specialized Filters +export const signalModifiersSpecializedFilters: CsoundReference[] = [ +{ + name: 'dcblock', + type: 'opcode', + category: 'Signal Modifiers:Specialized Filters', + description: 'Implements the DC blocking filter.', + syntax: 'ares = dcblock(ain [, igain])', + example: '--8<-- "examples/dcblock.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'igain', + description: 'the gain of the filter, which defaults to 0.99', + type: 'initialization' + }, + { + name: 'ain', + description: 'audio signal input', + type: 'performance' + }, + ], + seeAlso: ['Specialized Filters: High pass filters'] +}, +{ + name: 'dcblock2', + type: 'opcode', + category: 'Signal Modifiers:Specialized Filters', + description: 'Implements a DC blocking filter with improved DC attenuation.', + syntax: 'ares = dcblock2(ain [, iorder] [, iskip])', + example: '--8<-- "examples/dcblock2.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'iorder', + description: 'filter order, minimum 4th order, defaults to 128.', + type: 'initialization' + }, + { + name: 'iskip', + description: 'set to 1 to skip initialization (defaults to 0).', + type: 'initialization' + }, + { + name: 'ares', + description: 'filered audio signal', + type: 'performance' + }, + { + name: 'ain', + description: 'input audio signal', + type: 'performance' + }, + ], + seeAlso: ['Specialized Filters: High pass filters'] +}, +{ + name: 'eqfil', + type: 'opcode', + category: 'Signal Modifiers:Specialized Filters', + description: 'Equalizer filter.', + syntax: 'asig = eqfil(ain, kcf, kbw, kgain[, istor])', + example: '--8<-- "examples/eqfil.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'istor', + description: 'initial disposition of internal data space. Since filtering incorporates a feedback loop of previous output, the initial status of the storage space used is significant. A zero value will clear the space; a non-zero value will allow previous information to remain. The default value is 0.', + type: 'initialization' + }, + { + name: 'asig', + description: 'filtered output signal.', + type: 'performance' + }, + { + name: 'ain', + description: 'input signal.', + type: 'performance' + }, + { + name: 'kcf', + description: 'filter centre frequency.', + type: 'performance' + }, + { + name: 'kbw', + description: 'peak/notch bandwidth (Hz).', + type: 'performance' + }, + { + name: 'kgain', + description: 'peak/notch gain.', + type: 'performance' + }, + ], + seeAlso: ['Specialized Filters: Parametric EQ'] +}, +{ + name: 'exciter', + type: 'opcode', + category: 'Signal Modifiers:Specialized Filters', + description: 'A non-linear filter system to excite the signal.', + syntax: 'ares = exciter(asig, kfreq, kceil, kharmonics, kblend)', + example: '--8<-- "examples/exciter.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'asig', + description: 'input signal', + type: 'initialization' + }, + { + name: 'kfreq', + description: 'the lower end of the harmonics created.', + type: 'initialization' + }, + { + name: 'kceil', + description: 'the upper end of the harmonics created.', + type: 'initialization' + }, + { + name: 'kharmonics', + description: 'amount of harmonics in the range 0.1 - 10.', + type: 'initialization' + }, + { + name: 'kblend', + description: 'blend between 2nd and 3rd order harmonics in the range -10 - +10.', + type: 'initialization' + }, + { + name: 'asig', + description: 'input signal', + type: 'performance' + }, + { + name: 'kfreq', + description: 'the lower end of the harmonics created.', + type: 'performance' + }, + { + name: 'kceil', + description: 'the upper end of the harmonics created.', + type: 'performance' + }, + { + name: 'kharmonics', + description: 'amount of harmonics in the range 0.1 - 10.', + type: 'performance' + }, + { + name: 'kblend', + description: 'blend between 2nd and 3rd order harmonics in the range -10 - +10.', + type: 'performance' + }, + ], + seeAlso: ['Special Effects'] +}, +{ + name: 'filter2', + type: 'opcode', + category: 'Signal Modifiers:Specialized Filters', + description: 'General purpose custom filter.', + syntax: 'ares = filter2(asig, ibcoefs, iacoefs, ib0, ib1, ..., ibM, ia1, ia2, ..., iaN)\n kres = filter2(ksig, ibcoefs, iacoefs, ib0, ib1, ..., ibM, ia1, ia2, ..., iaN)', + example: 'k1 filter2 ksig, 2, 0, 0.5, 0.5 ;; k-rate FIR filter', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'ibcoefs', + description: 'number of feedforward coefficients including b0.', + type: 'initialization' + }, + { + name: 'iacoefs', + description: 'number of feedback coefficients', + type: 'initialization' + }, + ], + seeAlso: ['Specialized Filters: Other filters'] +}, +{ + name: 'fmanal', + type: 'opcode', + category: 'Signal Modifiers:Specialized Filters', + description: 'AM/FM analysis from quadrature signal.', + syntax: 'am, af = fmanal(are, aim)', + example: '--8<-- "examples/fmanal.csd"', + parameters: [ + { + name: 'are', + description: 'real (cosine-phase) input signal', + type: 'performance' + }, + { + name: 'aim', + description: 'imaginary (sine-phase) input signal', + type: 'performance' + }, + { + name: 'am', + description: 'amplitude modulation envelope', + type: 'performance' + }, + { + name: 'af', + description: 'frequency modulation envelope', + type: 'performance' + }, + ], + seeAlso: ['Specialized Filters: Other filters'] +}, +{ + name: 'fofilter', + type: 'opcode', + category: 'Signal Modifiers:Specialized Filters', + description: 'Formant filter.', + syntax: 'asig = fofilter(ain, xcf, xris, xdec[, istor])', + example: '--8<-- "examples/fofilter.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'istor', + description: 'initial disposition of internal data space. Since filtering incorporates a feedback loop of previous output, the initial status of the storage space used is significant. A zero value will clear the space; a non-zero value will allow previous information to remain. The default value is 0.', + type: 'initialization' + }, + { + name: 'asig', + description: 'input signal.', + type: 'performance' + }, + { + name: 'xcf', + description: 'filter centre frequency', + type: 'performance' + }, + { + name: 'xris', + description: 'impulse response attack time (secs).', + type: 'performance' + }, + { + name: 'xdec', + description: 'impulse response decay time (secs).', + type: 'performance' + }, + ], + seeAlso: ['Specialized Filters: Other filters'] +}, +{ + name: 'gtf', + type: 'opcode', + category: 'Signal Modifiers:Specialized Filters', + description: 'Apply a gammatone filter of various orders to an audio signal.', + syntax: 'aout = gtf(ain, kfreq, idecay[, iorder, iphase])', + example: '--8<-- "examples/gtf.csd"', + parameters: [ + { + name: 'idecay', + description: 'rate of decay', + type: 'initialization' + }, + { + name: 'iorder', + description: '(optional) Order of filter in rangs 1 to 10 defaulting to 4.', + type: 'initialization' + }, + { + name: 'iphase', + description: '(optional) Phase output, defaulting to zero.', + type: 'initialization' + }, + { + name: 'asig', + description: 'audio signal to be filtered.', + type: 'performance' + }, + { + name: 'kfreq', + description: 'central frequency of filter in Hertz.', + type: 'performance' + }, + ], + seeAlso: ['Specialized Filters: Other filters'] +}, +{ + name: 'hilbert', + type: 'opcode', + category: 'Signal Modifiers:Specialized Filters', + description: 'A Hilbert transformer.', + syntax: 'c:a, s:a = hilbert(sig:a)\n csig:Complex[] = hilbert(sig:a)', + example: '--8<-- "examples/hilbert.csd"', + parameters: [ + { + name: 'sig', + description: 'input signal', + type: 'performance' + }, + { + name: 'c', + description: 'cosine output of _sig_', + type: 'performance' + }, + { + name: 's', + description: 'sine output of _sig_', + type: 'performance' + }, + { + name: 'csig', + description: 'Complex array containing the analytic signal.', + type: 'performance' + }, + ], + seeAlso: ['Specialized Filters: Other filters'] +}, +{ + name: 'hilbert2', + type: 'opcode', + category: 'Signal Modifiers:Specialized Filters', + description: 'A DFT-based implementation of a Hilbert transformer.', + syntax: 'c:a, s:a = hilbert2(sig:a, fftsize:a, hopsize:i)\n csig:Complex[] = hilbert2(sig:a, fftsize:a, hopsize:i)', + example: '--8<-- "examples/hilbert2.csd"', + parameters: [ + { + name: 'sig', + description: 'input signal', + type: 'performance' + }, + { + name: 'c', + description: 'cosine output of _sig_', + type: 'performance' + }, + { + name: 's', + description: 'sine output of _sig_', + type: 'performance' + }, + { + name: 'csig', + description: 'Complex array containing the analytic signal.', + type: 'performance' + }, + ], + seeAlso: ['Specialized Filters: Other filters'] +}, +{ + name: 'mvmfilter', + type: 'opcode', + category: 'Signal Modifiers:Specialized Filters', + description: 'A filter with pronounced resonance and controllable decay time.', + syntax: 'aout = mvmfilter(ain, xfreq, xTau [, iskip])', + example: '--8<-- "examples/mvmfilter.csd"', + parameters: [ + { + name: 'aout', + description: 'filtered signal', + type: 'performance' + }, + { + name: 'ain', + description: 'signal to filter', + type: 'performance' + }, + { + name: 'xfreq', + description: 'resonant frequency of the filter', + type: 'performance' + }, + { + name: 'xTau', + description: 'Decay time of the filter in seconds', + type: 'performance' + }, + ], + seeAlso: ['Specialized Filters: Other filters', '"Very High Q Parametrically WellBehaved Two Pole Filters"'] +}, +{ + name: 'nlfilt', + type: 'opcode', + category: 'Signal Modifiers:Specialized Filters', + description: 'A filter with a non-linear effect.', + syntax: 'ares = nlfilt(ain, ka, kb, kd, kC, kL)', + example: '--8<-- "examples/nlfilt.csd"', + rates: ['a-rate'], + seeAlso: ['Specialized Filters: Other filters'] +}, +{ + name: 'nlfilt2', + type: 'opcode', + category: 'Signal Modifiers:Specialized Filters', + description: 'A filter with a non-linear effect and blowup protection.', + syntax: 'ares = nlfilt2(ain, ka, kb, kd, kC, kL)', + example: '--8<-- "examples/nlfilt2.csd"', + rates: ['a-rate'], + seeAlso: ['Specialized Filters: Other filters'] +}, +{ + name: 'pareq', + type: 'opcode', + category: 'Signal Modifiers:Specialized Filters', + description: 'Implementation of Zoelzer\'s parametric equalizer filters, with some modifications by the author.', + syntax: 'ares = pareq(asig, kc, kv, kq [, imode] [, iskip])', + example: '--8<-- "examples/pareq.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'kc', + description: 'center frequency in peaking mode, corner frequency in shelving mode.', + type: 'performance' + }, + { + name: 'kv', + description: 'amount of boost or cut. A value less than 1 is a cut. A value greater than 1 is a boost. A value of 1 is a flat response.', + type: 'performance' + }, + { + name: 'kq', + description: 'Q of the filter (sqrt(.5) is no resonance)', + type: 'performance' + }, + { + name: 'asig', + description: 'the incoming signal', + type: 'performance' + }, + ], + seeAlso: ['Specialized Filters: Parametric EQ'] +}, +{ + name: 'rbjeq', + type: 'opcode', + category: 'Signal Modifiers:Specialized Filters', + description: 'Parametric equalizer and filter opcode with 7 filter types, based on algorithm by Robert Bristow-Johnson.', + syntax: 'ar = rbjeq(asig, kfco, klvl, kQ, kS[, imode])', + example: '--8<-- "examples/rbjeq.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'ar', + description: 'the output signal.', + type: 'performance' + }, + { + name: 'asig', + description: 'the input signal', + type: 'performance' + }, + { + name: 'kfco', + description: 'cutoff, corner, or center frequency, depending on filter type, in Hz. It must be greater than zero, and less than sr / 2 (the range of about sr * 0.0002 to sr * 0.49 should be safe).', + type: 'performance' + }, + { + name: 'klvl', + description: 'level (amount of boost or cut), as amplitude gain (e.g. 1: flat response, 4: 12 dB boost, 0.1: 20 dB cut); zero or negative values are not allowed. It is recognized by the peaking and shelving EQ types (8, 10, 12) only, and is ignored by other filters.', + type: 'performance' + }, + { + name: 'kQ', + description: 'resonance (also kfco / bandwidth in many filter types). Not used by the shelving EQs (imode = 10 and 12). The exact meaning of this parameter depends on the filter type (see above), but it should be always greater than zero, and usually (kfco / kQ) less than sr / 2.', + type: 'performance' + }, + { + name: 'kS', + description: 'shelf slope parameter for shelving filters. Must be greater than zero; a higher value means a steeper slope, with resonance if kS > 1 (however, a too high kS value may make the filter unstable). If kS is set to exactly 1, the shelf slope is as steep as possible without a resonance. Note that the effect of kS - especially if it is greater than 1 - also depends on klvl, and it does not have any well defined unit.', + type: 'performance' + }, + ], + seeAlso: ['Specialized Filters: Parametric EQ'] +}, +] diff --git a/src/lib/csound-reference/signal-modifiers-standard-filters-control.ts b/src/lib/csound-reference/signal-modifiers-standard-filters-control.ts new file mode 100644 index 0000000..36810e2 --- /dev/null +++ b/src/lib/csound-reference/signal-modifiers-standard-filters-control.ts @@ -0,0 +1,268 @@ +import type { CsoundReference } from './types' + +// Signal Modifiers:Standard Filters:Control +export const signalModifiersStandardFiltersControl: CsoundReference[] = [ +{ + name: 'aresonk', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters:Control', + description: 'A notch filter whose transfer functions are the complements of the reson opcode.', + syntax: 'kres = aresonk(ksig, kcf, kbw [, iscl] [, iskip])', + example: '--8<-- "examples/aresonk-modern.csd"', + rates: ['k-rate'], + parameters: [ + { + name: 'kres', + description: 'the output signal at control-rate.', + type: 'performance' + }, + { + name: 'ksig', + description: 'the input signal at control-rate.', + type: 'performance' + }, + { + name: 'kcf', + description: 'the center frequency of the filter, or frequency position of the peak response.', + type: 'performance' + }, + { + name: 'kbw', + description: 'bandwidth of the filter (the Hz difference between the upper and lower half-power points).', + type: 'performance' + }, + ], + seeAlso: ['Standard Filters: Control signal filters'] +}, +{ + name: 'atonek', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters:Control', + description: 'A hi-pass filter whose transfer functions are the complements of the [tonek](../opcodes/tonek.md) opcode.', + syntax: 'kres = atonek(ksig, khp [, iskip])', + example: '--8<-- "examples/atonek-modern.csd"', + rates: ['k-rate'], + parameters: [ + { + name: 'kres', + description: 'the output signal at control-rate.', + type: 'performance' + }, + { + name: 'ksig', + description: 'the input signal at control-rate.', + type: 'performance' + }, + { + name: 'khp', + description: 'the response curve\'s half-power point, in Hertz. Half power is defined as peak power / root 2.', + type: 'performance' + }, + ], + seeAlso: ['Standard Filters: Control signal filters'] +}, +{ + name: 'lag', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters:Control', + description: 'Exponential Lag.', + syntax: 'aout = lag(ain, klagtime [, initialvalue])\n kout = lag(kin, klagtime [, initialvalue])', + example: '--8<-- "examples/lag.csd"', + rates: ['k-rate'], + parameters: [ + { + name: 'ain', + description: 'input signal', + type: 'performance' + }, + { + name: 'klagtime', + description: '60 dB lag time in seconds.', + type: 'performance' + }, + { + name: 'kladown', + description: '60 dB lag time in seconds for the downgoing signal.', + type: 'performance' + }, + ], + seeAlso: ['Standard Filters: Control signal filters'] +}, +{ + name: 'lagud', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters:Control', + description: 'Exponential Lag.', + syntax: 'aout = lagud(ain, klagup, klagdown [, initialvalue])\n kout = lagud(kin, klagup, klagdown [, initialvalue])', + example: '--8<-- "examples/lagud.csd"', + rates: ['k-rate'], + parameters: [ + { + name: 'ain', + description: 'input signal', + type: 'performance' + }, + { + name: 'klagup', + description: '60 dB lag time in seconds for the upgoing signal.', + type: 'performance' + }, + { + name: 'klagdown', + description: '60 dB lag time in seconds for the downgoing signal.', + type: 'performance' + }, + ], + seeAlso: ['Standard Filters: Control signal filters'] +}, +{ + name: 'lineto', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters:Control', + description: 'Generate glissandos starting from a control signal.', + syntax: 'kres = lineto(ksig, ktime)', + example: '--8<-- "examples/lineto.csd"', + rates: ['k-rate'], + parameters: [ + { + name: 'kres', + description: 'Output signal.', + type: 'performance' + }, + { + name: 'ksig', + description: 'Input signal.', + type: 'performance' + }, + { + name: 'ktime', + description: 'Time length of glissando in seconds.', + type: 'performance' + }, + ], + seeAlso: ['Standard Filters: Control signal filters'] +}, +{ + name: 'port', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters:Control', + description: 'Applies portamento to a step-valued control signal.', + syntax: 'kres = port(ksig, ihtim [, isig])', + example: '--8<-- "examples/port.csd"', + rates: ['k-rate'], + parameters: [ + { + name: 'ihtim', + description: 'half-time of the function, in seconds.', + type: 'initialization' + }, + { + name: 'kres', + description: 'the output signal at control-rate.', + type: 'performance' + }, + { + name: 'ksig', + description: 'the input signal at control-rate.', + type: 'performance' + }, + ], + seeAlso: ['Standard Filters: Control signal filters'] +}, +{ + name: 'portk', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters:Control', + description: 'Applies portamento to a step-valued control signal.', + syntax: 'kres = portk(ksig, khtim [, isig])', + example: '--8<-- "examples/portk.csd"', + rates: ['k-rate'], + parameters: [ + { + name: 'kres', + description: 'the output signal at control-rate.', + type: 'performance' + }, + { + name: 'ksig', + description: 'the input signal at control-rate.', + type: 'performance' + }, + { + name: 'khtim', + description: 'half-time of the function in seconds.', + type: 'performance' + }, + ], + seeAlso: ['Standard Filters: Control signal filters'] +}, +{ + name: 'resonk', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters:Control', + description: 'A second-order resonant filter.', + syntax: 'kres = resonk(ksig, kcf, kbw [, iscl] [, iskip])', + example: '--8<-- "examples/resonk.csd"', + rates: ['k-rate'], + parameters: [ + { + name: 'kres', + description: 'the output signal at control-rate.', + type: 'performance' + }, + { + name: 'ksig', + description: 'the input signal at control-rate.', + type: 'performance' + }, + { + name: 'kcf', + description: 'the center frequency of the filter, or frequency position of the peak response.', + type: 'performance' + }, + { + name: 'kbw', + description: 'bandwidth of the filter (the Hz difference between the upper and lower half-power points).', + type: 'performance' + }, + ], + seeAlso: ['Standard Filters: Control signal filters'] +}, +{ + name: 'resonxk', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters:Control', + description: 'Control signal resonant filter stack.', + syntax: 'kres = resonxk(ksig, kcf, kbw[, inumlayer, iscl, istor])', + example: '--8<-- "examples/resonxk.csd"', + rates: ['k-rate'], + parameters: [ + { + name: 'inumlayer', + description: 'number of elements of filter stack. Default value is 4. Maximum value is 10', + type: 'initialization' + }, + { + name: 'kres', + description: 'output signal', + type: 'performance' + }, + { + name: 'ksig', + description: 'input signal', + type: 'performance' + }, + { + name: 'kcf', + description: 'the center frequency of the filter, or frequency position of the peak response.', + type: 'performance' + }, + { + name: 'kbw', + description: 'bandwidth of the filter (the Hz difference between the upper and lower half-power points)', + type: 'performance' + }, + ], + seeAlso: ['Standard Filters: Control signal filters'] +}, +] diff --git a/src/lib/csound-reference/signal-modifiers-standard-filters-resonant.ts b/src/lib/csound-reference/signal-modifiers-standard-filters-resonant.ts new file mode 100644 index 0000000..83e5f83 --- /dev/null +++ b/src/lib/csound-reference/signal-modifiers-standard-filters-resonant.ts @@ -0,0 +1,929 @@ +import type { CsoundReference } from './types' + +// Signal Modifiers:Standard Filters:Resonant +export const signalModifiersStandardFiltersResonant: CsoundReference[] = [ +{ + name: 'areson', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters:Resonant', + description: 'A notch filter whose transfer functions are the complements of the reson opcode.', + syntax: 'ares = areson(asig, kcf, kbw [, iscl] [, iskip])\n ares = areson(asig, acf, kbw [, iscl] [, iskip])\n ares = areson(asig, kcf, abw [, iscl] [, iskip])\n ares = areson(asig, acf, abw [, iscl] [, iskip])', + example: '--8<-- "examples/areson-modern.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'ares', + description: 'the output signal at audio rate.', + type: 'performance' + }, + { + name: 'asig', + description: 'the input signal at audio rate.', + type: 'performance' + }, + { + name: 'kcf', + description: 'the center frequency of the filter, or frequency position of the peak response.', + type: 'performance' + }, + { + name: 'acf', + description: 'the center frequency of the filter, or frequency position of the peak response.', + type: 'performance' + }, + { + name: 'kbw', + description: 'bandwidth of the filter (the Hz difference between the upper and lower half-power points).', + type: 'performance' + }, + { + name: 'abw', + description: 'bandwidth of the filter (the Hz difference between the upper and lower half-power points).', + type: 'performance' + }, + ], + seeAlso: ['Standard Filters: Resonant Low-pass filters'] +}, +{ + name: 'bob', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters:Resonant', + description: 'Runge-Kutte numerical simulation of the Moog analog resonant filter.', + syntax: 'asig = bob(ain, xcf, xres, xsat [, iosamps, istor])', + example: '--8<-- "examples/bob-modern.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'iosamps', + description: 'number of times of oversampling used in the filtering process. This will determine the maximum sharpness of the filter resonance (Q). More oversampling allows higher Qs, less oversampling will limit the resonance. The default is 2 times (iosamps=0).', + type: 'initialization' + }, + { + name: 'istor', + description: 'initial disposition of internal data space. Since filtering incorporates a feedback loop of previous output, the initial status of the storage space used is significant. A zero value will clear the space; a non-zero value will allow previous information to remain. The default value is 0.', + type: 'initialization' + }, + { + name: 'asig', + description: 'input signal', + type: 'performance' + }, + { + name: 'xcf', + description: 'filter cutoff frequency', + type: 'performance' + }, + { + name: 'xres', + description: 'filter resonance. Nominally, a value of 4 should be the limit of stability -- above that, the filter oscillates.', + type: 'performance' + }, + { + name: 'xsat', + description: 'saturation. This parameter determines at what signal level the "transistors" in the model saturate. The maximum output amplitude is about 2/3 of that value.', + type: 'performance' + }, + ], + seeAlso: ['Standard Filters: Resonant Low-pass filters'] +}, +{ + name: 'bqrez', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters:Resonant', + description: 'A second-order multi-mode filter.', + syntax: 'ares = bqrez(asig, xfco, xres [, imode] [, iskip])', + example: '--8<-- "examples/bqrez-modern.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'ares', + description: 'output audio signal.', + type: 'performance' + }, + { + name: 'asig', + description: 'input audio signal.', + type: 'performance' + }, + { + name: 'xfco', + description: 'filter cut-off frequency in Hz. May be i-time, k-rate, a-rate.', + type: 'performance' + }, + { + name: 'xres', + description: 'amount of resonance. Values of 1 to 100 are typical. Resonance should be one or greater. A value of 100 gives a 20dB gain at the cutoff frequency. May be i-time, k-rate, a-rate.', + type: 'performance' + }, + ], + seeAlso: ['Standard Filters: Resonant Low-pass filters'] +}, +{ + name: 'lowpass2', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters:Resonant', + description: 'A resonant second-order lowpass filter.', + syntax: 'ares = lowpass2(asig, kcf, kq [, iskip])', + example: '--8<-- "examples/lowpass2.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'iskip', + description: 'initial disposition of internal data space. A zero value will clear the space; a non-zero value will allow previous information to remain. The default value is 0.', + type: 'initialization' + }, + { + name: 'asig', + description: 'input signal to be filtered', + type: 'performance' + }, + { + name: 'kcf', + description: 'cutoff or resonant frequency of the filter, measured in Hz', + type: 'performance' + }, + { + name: 'kq', + description: 'Q of the filter, defined, for bandpass filters, as bandwidth/cutoff. _kq_ should be between 1 and 500', + type: 'performance' + }, + ], + seeAlso: ['Standard Filters: Resonant Low-pass filters'] +}, +{ + name: 'lowres', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters:Resonant', + description: 'Another resonant lowpass filter.', + syntax: 'ares = lowres(asig, xcutoff, xresonance [, iskip])', + example: '--8<-- "examples/lowres.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'iskip', + description: 'initial disposition of internal data space. A zero value will clear the space; a non-zero value will allow previous information to remain. The default value is 0.', + type: 'initialization' + }, + { + name: 'asig', + description: 'input signal', + type: 'performance' + }, + { + name: 'xcutoff', + description: 'filter cutoff frequency point', + type: 'performance' + }, + { + name: 'xresonance', + description: 'resonance amount', + type: 'performance' + }, + ], + seeAlso: ['Standard Filters: Resonant Low-pass filters'] +}, +{ + name: 'lowresx', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters:Resonant', + description: 'Simulates layers of serially connected resonant lowpass filters.', + syntax: 'ares = lowresx(asig, xcutoff, xresonance [, inumlayer] [, iskip])', + example: '--8<-- "examples/lowresx.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'inumlayer', + description: 'number of elements in a _lowresx_ stack. Default value is 4. There is no maximum.', + type: 'initialization' + }, + { + name: 'iskip', + description: 'initial disposition of internal data space. A zero value will clear the space; a non-zero value will allow previous information to remain. The default value is 0.', + type: 'initialization' + }, + { + name: 'asig', + description: 'input signal', + type: 'performance' + }, + { + name: 'xcutoff', + description: 'filter cutoff frequency point', + type: 'performance' + }, + { + name: 'xresonance', + description: 'resonance amount', + type: 'performance' + }, + ], + seeAlso: ['Standard Filters: Resonant Low-pass filters'] +}, +{ + name: 'lpf18', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters:Resonant', + description: 'A 3-pole sweepable resonant lowpass filter.', + syntax: 'ares = lpf18(asig, xfco, xres, xdist [, iskip])', + example: '--8<-- "examples/lpf18.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'xfco', + description: 'the filter cutoff frequency in Hz. Should be in the range 0 to _sr_/2.', + type: 'performance' + }, + { + name: 'xres', + description: 'the amount of resonance. Self-oscillation occurs when _xres_ is approximately 1. Should usually be in the range 0 to 1, however, values slightly greater than 1 are possible for more sustained oscillation and an “overdrive” effect.', + type: 'performance' + }, + { + name: 'xdist', + description: 'amount of distortion. _kdist_ = 0 gives a clean output. _xdist_ > 0 adds _tanh_() distortion controlled by the filter parameters, in such a way that both low cutoff and high resonance increase the distortion amount. Some experimentation is encouraged.', + type: 'performance' + }, + ], + seeAlso: ['Standard Filters: Resonant Low-pass filters'] +}, +{ + name: 'moogladder', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters:Resonant', + description: 'Moog ladder lowpass filter.', + syntax: 'asig = moogladder(ain, kcf, kres[, istor])\n asig = moogladder(ain, acf, kres[, istor])\n asig = moogladder(ain, kcf, ares[, istor])\n asig = moogladder(ain, acf, ares[, istor])', + example: '--8<-- "examples/moogladder.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'istor', + description: 'initial disposition of internal data space. Since filtering incorporates a feedback loop of previous output, the initial status of the storage space used is significant. A zero value will clear the space; a non-zero value will allow previous information to remain. The default value is 0.', + type: 'initialization' + }, + { + name: 'asig', + description: 'input signal.', + type: 'performance' + }, + { + name: 'kcf', + description: 'filter cutoff frequency', + type: 'performance' + }, + { + name: 'acf', + description: 'filter cutoff frequency', + type: 'performance' + }, + { + name: 'kres', + description: 'resonance, generally < 1, but not limited to it. Higher than 1 resonance values might cause aliasing, analogue synths generally allow resonances to be above 1.', + type: 'performance' + }, + { + name: 'ares', + description: 'resonance, generally < 1, but not limited to it. Higher than 1 resonance values might cause aliasing, analogue synths generally allow resonances to be above 1.', + type: 'performance' + }, + ], + seeAlso: ['Standard Filters: Resonant Low-pass filters'] +}, +{ + name: 'moogladder2', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters:Resonant', + description: 'Moog ladder lowpass filter.', + syntax: 'asig = moogladder2(ain, kcf, kres[, istor])\n asig = moogladder2(ain, acf, kres[, istor])\n asig = moogladder2(ain, kcf, ares[, istor])\n asig = moogladder2(ain, acf, ares[, istor])', + example: '--8<-- "examples/moogladder2.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'istor', + description: 'initial disposition of internal data space. Since filtering incorporates a feedback loop of previous output, the initial status of the storage space used is significant. A zero value will clear the space; a non-zero value will allow previous information to remain. The default value is 0.', + type: 'initialization' + }, + { + name: 'asig', + description: 'input signal.', + type: 'performance' + }, + { + name: 'kcf', + description: 'filter cutoff frequency', + type: 'performance' + }, + { + name: 'acf', + description: 'filter cutoff frequency', + type: 'performance' + }, + { + name: 'kres', + description: 'resonance, generally < 1, but not limited to it. Higher than 1 resonance values might cause aliasing, analogue synths generally allow resonances to be above 1.', + type: 'performance' + }, + { + name: 'ares', + description: 'resonance, generally < 1, but not limited to it. Higher than 1 resonance values might cause aliasing, analogue synths generally allow resonances to be above 1.', + type: 'performance' + }, + ], + seeAlso: ['Standard Filters: Resonant Low-pass filters'] +}, +{ + name: 'moogvcf', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters:Resonant', + description: 'A digital emulation of the Moog diode ladder filter configuration.', + syntax: 'ares = moogvcf(asig, xfco, xres [,iscale, iskip])', + example: '--8<-- "examples/moogvcf.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'asig', + description: 'input signal', + type: 'performance' + }, + { + name: 'xfco', + description: 'filter cut-off frequency in Hz. As of version 3.50, may i-,k-, or a-rate.', + type: 'performance' + }, + { + name: 'xres', + description: 'amount of resonance. Self-oscillation occurs when _xres_ is approximately one. As of version 3.50, may a-rate, i-rate, or k-rate.', + type: 'performance' + }, + ], + seeAlso: ['Standard Filters: Resonant Low-pass filters'] +}, +{ + name: 'moogvcf2', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters:Resonant', + description: 'A digital emulation of the Moog diode ladder filter configuration.', + syntax: 'ares = moogvcf2(asig, xfco, xres [,iscale, iskip])', + example: '--8<-- "examples/moogvcf2.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'asig', + description: 'input signal', + type: 'performance' + }, + { + name: 'xfco', + description: 'filter cut-off frequency in Hz. which may be i-,k-, or a-rate.', + type: 'performance' + }, + { + name: 'xres', + description: 'amount of resonance. Self-oscillation occurs when _xres_ is approximately one. May be a-rate, i-rate, or k-rate.', + type: 'performance' + }, + ], + seeAlso: ['Standard Filters: Resonant Low-pass filters'] +}, +{ + name: 'mvchpf', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters:Resonant', + description: 'Moog voltage-controlled highpass filter emulation.', + syntax: 'asig = mvchpf(ain, xcf[, istor])', + example: '--8<-- "examples/mvchpf.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'istor', + description: 'initial disposition of internal data space. Since filtering incorporates a feedback loop of previous output, the initial status of the storage space used is significant. A zero value will clear the space; a non-zero value will allow previous information to remain. The default value is 0.', + type: 'initialization' + }, + { + name: 'ain', + description: 'input signal.', + type: 'performance' + }, + { + name: 'xcf', + description: 'filter cutoff frequency. The useful range is around six octaves below and above middle C (pch 8.00).', + type: 'performance' + }, + ], + seeAlso: ['Standard Filters: Hi-pass filters'] +}, +{ + name: 'mvclpf1', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters:Resonant', + description: 'Moog voltage-controlled lowpass filter emulation.', + syntax: 'asig = mvclpf1(ain, xcf, xres[,istor])', + example: '--8<-- "examples/mvclpf1.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'istor', + description: 'initial disposition of internal data space. Since filtering incorporates a feedback loop of previous output, the initial status of the storage space used is significant. A zero value will clear the space; a non-zero value will allow previous information to remain. The default value is 0.', + type: 'initialization' + }, + { + name: 'ain', + description: 'input signal.', + type: 'performance' + }, + { + name: 'xcf', + description: 'filter cutoff frequency. The useful range is around six octaves below and above middle C (pch 8.00).', + type: 'performance' + }, + { + name: 'xres', + description: 'resonance, limited to the interval [0,1].', + type: 'performance' + }, + ], + seeAlso: ['Standard Filters: Resonant Low-pass filters'] +}, +{ + name: 'mvclpf2', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters:Resonant', + description: 'Moog voltage-controlled lowpass filter emulation.', + syntax: 'asig = mvclpf2(ain, xcf, xres[, istor])', + example: '--8<-- "examples/mvclpf2.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'istor', + description: 'initial disposition of internal data space. Since filtering incorporates a feedback loop of previous output, the initial status of the storage space used is significant. A zero value will clear the space; a non-zero value will allow previous information to remain. The default value is 0.', + type: 'initialization' + }, + { + name: 'ain', + description: 'input signal.', + type: 'performance' + }, + { + name: 'xcf', + description: 'filter cutoff frequency. The useful range is around six octaves below and above middle C (pch 8.00).', + type: 'performance' + }, + { + name: 'xres', + description: 'resonance, limited to the interval [0,1].', + type: 'performance' + }, + ], + seeAlso: ['Standard Filters: Resonant Low-pass filters'] +}, +{ + name: 'mvclpf3', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters:Resonant', + description: 'Moog voltage-controlled lowpass filter emulation.', + syntax: 'asig = mvclpf3(ain, xcf, xres[, istor])', + example: '--8<-- "examples/mvclpf3.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'istor', + description: 'initial disposition of internal data space. Since filtering incorporates a feedback loop of previous output, the initial status of the storage space used is significant. A zero value will clear the space; a non-zero value will allow previous information to remain. The default value is 0.', + type: 'initialization' + }, + { + name: 'ain', + description: 'input signal.', + type: 'performance' + }, + { + name: 'xcf', + description: 'filter cutoff frequency. The useful range is around six octaves below and above middle C (pch 8.00).', + type: 'performance' + }, + { + name: 'xres', + description: 'resonance, limited to the interval [0,1].', + type: 'performance' + }, + ], + seeAlso: ['Standard Filters: Resonant Low-pass filters'] +}, +{ + name: 'mvclpf4', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters:Resonant', + description: 'Moog voltage-controlled lowpass filter emulation.', + syntax: 'asig1, asig2, asig3, asig4 = mvclpf4(ain, xcf, xres[, istor])', + example: '--8<-- "examples/mvclpf4.csd"', + parameters: [ + { + name: 'istor', + description: 'initial disposition of internal data space. Since filtering incorporates a feedback loop of previous output, the initial status of the storage space used is significant. A zero value will clear the space; a non-zero value will allow previous information to remain. The default value is 0.', + type: 'initialization' + }, + { + name: 'asig1', + description: '6dB/oct low-pass response output.', + type: 'performance' + }, + { + name: 'asig2', + description: '12dB/oct low-pass response output.', + type: 'performance' + }, + { + name: 'asig3', + description: '18dB/oct low-pass response output..', + type: 'performance' + }, + { + name: 'asig4', + description: '24dB/oct low-pass response output.', + type: 'performance' + }, + { + name: 'ain', + description: 'input signal.', + type: 'performance' + }, + { + name: 'xcf', + description: 'filter cutoff frequency. The useful range is around six octaves below and above middle C (pch 8.00).', + type: 'performance' + }, + { + name: 'xres', + description: 'resonance, limited to the interval [0,1].', + type: 'performance' + }, + ], + seeAlso: ['Standard Filters: Resonant Low-pass filters'] +}, +{ + name: 'otafilter', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters:Resonant', + description: 'Resonant 4pole non-linear lowpass filter.', + syntax: 'sig4:a, sig2:a = otafilter(in:a, cf:{a,k}, res:{a,k}, drive:k[, stor:i])', + example: '--8<-- "examples/otafilter.csd"', + parameters: [ + { + name: 'stor', + description: 'initial disposition of internal data space. Since filtering incorporates a feedback loop of previous output, the initial status of the storage space used is significant. A zero value will clear the space; a non-zero value will allow previous information to remain. The default value is 0.', + type: 'initialization' + }, + { + name: 'sig4', + description: '4-pole output', + type: 'performance' + }, + { + name: 'sig2', + description: '2-pole output', + type: 'performance' + }, + { + name: 'in', + description: 'input signal.', + type: 'performance' + }, + { + name: 'cf', + description: 'filter cutoff frequency (a- or k-rate)', + type: 'performance' + }, + { + name: 'res', + description: 'resonance, between 0 and 1. Higher values will make the filter self-oscillate (a- or k-rate).', + type: 'performance' + }, + { + name: 'drive', + description: 'filter drive gain (0 - no drive, > 0 - increased drive)', + type: 'performance' + }, + ], + seeAlso: ['Standard Filters: Resonant Low-pass filters'] +}, +{ + name: 'reson', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters:Resonant', + description: 'A second-order resonant filter.', + syntax: 'ares = reson(asig, xcf, xbw [, iscl] [, iskip])', + example: '--8<-- "examples/reson.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'ares', + description: 'the output signal at audio rate.', + type: 'performance' + }, + { + name: 'asig', + description: 'the input signal at audio rate.', + type: 'performance' + }, + { + name: 'xcf', + description: 'the center frequency of the filter, or frequency position of the peak response.', + type: 'performance' + }, + { + name: 'xbw', + description: 'bandwidth of the filter (the Hz difference between the upper and lower half-power points).', + type: 'performance' + }, + ], + seeAlso: ['Standard Filters: Resonant Low-pass filters'] +}, +{ + name: 'resonr', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters:Resonant', + description: 'A second-order, two-pole two-zero bandpass filter with variable frequency response.', + syntax: 'ares = resonr(asig, xcf, xbw [, iscl] [, iskip])', + example: '--8<-- "examples/resonr.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'asig', + description: 'input signal to be filtered', + type: 'performance' + }, + { + name: 'xcf', + description: 'cutoff or resonant frequency of the filter, measured in Hz', + type: 'performance' + }, + { + name: 'xbw', + description: 'bandwidth of the filter (the Hz difference between the upper and lower half-power points)', + type: 'performance' + }, + ], + seeAlso: ['Standard Filters: Resonant Low-pass filters'] +}, +{ + name: 'resonx', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters:Resonant', + description: 'Emulates a stack of filters using the reson opcode.', + syntax: 'ares = resonx(asig, xcf, xbw [, inumlayer] [, iscl] [, iskip])', + example: '--8<-- "examples/resonx.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'asig', + description: 'input signal', + type: 'performance' + }, + { + name: 'xcf', + description: 'the center frequency of the filter, or frequency position of the peak response.', + type: 'performance' + }, + { + name: 'xbw', + description: 'bandwidth of the filter (the Hz difference between the upper and lower half-power points)', + type: 'performance' + }, + ], + seeAlso: ['Standard Filters: Resonant Low-pass filters'] +}, +{ + name: 'resony', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters:Resonant', + description: 'A bank of second-order bandpass filters, connected in parallel.', + syntax: 'ares = resony(asig, kbf, kbw, inum, ksep [, isepmode] [, iscl] [, iskip])', + example: '--8<-- "examples/resony.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'inum', + description: 'number of filters', + type: 'initialization' + }, + { + name: 'asig', + description: 'audio input signal', + type: 'performance' + }, + { + name: 'kbf', + description: 'base frequency, i.e. center frequency of lowest filter in Hz', + type: 'performance' + }, + { + name: 'kbw', + description: 'bandwidth in Hz', + type: 'performance' + }, + { + name: 'ksep', + description: 'separation of the center frequency of filters in octaves', + type: 'performance' + }, + ], + seeAlso: ['Standard Filters: Resonant Low-pass filters'] +}, +{ + name: 'resonz', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters:Resonant', + description: 'A second-order, two-pole two-zero bandpass filter with variable frequency response.', + syntax: 'ares = resonz(asig, xcf, xbw [, iscl] [, iskip])', + example: '--8<-- "examples/resonr.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'iskip', + description: 'initial disposition of internal data space. Since filtering incorporates a feedback loop of previous output, the initial status of the storage space used is significant. A zero value will clear the space; a non-zero value will allow previous information to remain. The default value is 0.', + type: 'initialization' + }, + { + name: 'iscl', + description: 'coded scaling factor for resonators. A value of 1 signifies a peak response factor of 1, i.e. all frequencies other than _kcf_ are attenuated in accordance with the (normalized) response curve. A value of 2 raises the response factor so that its overall RMS value equals 1. This intended equalization of input and output power assumes all frequencies are physically present; hence it is most applicable to white noise. A zero value signifies no scaling of the signal, leaving that to some later adjustment (see [balance](../opcodes/balance.md)). The default value is 0.', + type: 'initialization' + }, + { + name: 'asig', + description: 'input signal to be filtered', + type: 'performance' + }, + { + name: 'xcf', + description: 'cutoff or resonant frequency of the filter, measured in Hz', + type: 'performance' + }, + { + name: 'xbw', + description: 'bandwidth of the filter (the Hz difference between the upper and lower half-power points)', + type: 'performance' + }, + ], + seeAlso: ['Standard Filters: Resonant Low-pass filters'] +}, +{ + name: 'rezzy', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters:Resonant', + description: 'A resonant low-pass filter.', + syntax: 'ares = rezzy(asig, xfco, xres [, imode, iskip])', + example: '--8<-- "examples/rezzy.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'asig', + description: 'input signal', + type: 'performance' + }, + { + name: 'xfco', + description: 'filter cut-off frequency in Hz. As of version 3.50, may i-,k-, or a-rate.', + type: 'performance' + }, + { + name: 'xres', + description: 'amount of resonance. Values of 1 to 100 are typical. Resonance should be one or greater. As of version 3.50, may a-rate, i-rate, or k-rate.', + type: 'performance' + }, + ], + seeAlso: ['Standard Filters: Resonant Low-pass filters'] +}, +{ + name: 'skf', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters:Resonant', + description: 'Sallen-Key filter.', + syntax: 'asig = skf(asig, xcf, xK[, ihp, istor])', + example: '--8<-- "examples/skf.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'ihp', + description: 'if non-zero, select highpass response. Defaults to 0 (lowpass).', + type: 'initialization' + }, + { + name: 'istor', + description: 'initial disposition of internal data space. Since filtering incorporates a feedback loop of previous output, the initial status of the storage space used is significant. A zero value will clear the space; a non-zero value will allow previous information to remain. The default value is 0.', + type: 'initialization' + }, + { + name: 'asig', + description: 'input', + type: 'performance' + }, + { + name: 'xcf', + description: 'filter cutoff frequency (a- or k-rate)', + type: 'performance' + }, + { + name: 'xK', + description: 'Sallen-Key opamp gain, in the range 1 to 3. At 3 the filter self-oscillates. K=1. 586 gives a Butterworth response, higher values are equivalent to Chebyshev responses (with peaking). At K=1 the filter is critically damped and the poles are real-valued.', + type: 'performance' + }, + ], + seeAlso: ['Standard Filters: Resonant Low-pass filters'] +}, +{ + name: 'spf', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters:Resonant', + description: 'Steiner-Parker filter.', + syntax: 'asig = spf(alp,ahp,abp, xcf, xR[, istor])', + example: '--8<-- "examples/spf.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'istor', + description: 'initial disposition of internal data space. Since filtering incorporates a feedback loop of previous output, the initial status of the storage space used is significant. A zero value will clear the space; a non-zero value will allow previous information to remain. The default value is 0.', + type: 'initialization' + }, + { + name: 'alp', + description: 'lowpass, highpass and bandpass input signals. Different signals can be used as inputs; if the same signal is placed at the lowpass and highpass inputs, the result is a band-reject output for that signal. If the same signal is used for all inputs, an allpass filter results.', + type: 'performance' + }, + { + name: 'ahp', + description: 'lowpass, highpass and bandpass input signals. Different signals can be used as inputs; if the same signal is placed at the lowpass and highpass inputs, the result is a band-reject output for that signal. If the same signal is used for all inputs, an allpass filter results.', + type: 'performance' + }, + { + name: 'abp', + description: 'lowpass, highpass and bandpass input signals. Different signals can be used as inputs; if the same signal is placed at the lowpass and highpass inputs, the result is a band-reject output for that signal. If the same signal is used for all inputs, an allpass filter results.', + type: 'performance' + }, + { + name: 'xcf', + description: 'filter cutoff frequency (a- or k-rate)', + type: 'performance' + }, + { + name: 'xR', + description: 'filter damping factor, which controls peaking (for bandpass, R = 1/Q, where Q is the ratio of centre frequency and bandwidth). A value of sqrt(2) (approx 1.414) gives no peaking (Butterworth response), and lower values will make the filter peak and ring. A value of 0 turns the filter into a sinusoidal oscillator. Valid values in the range of 0 - 2. At 2, the filter has real poles and so it is equivalent to two first-order filters in series.', + type: 'performance' + }, + ], + seeAlso: ['Standard Filters: Resonant Low-pass filters'] +}, +{ + name: 'statevar', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters:Resonant', + description: 'Statevar is a new digital implementation of the analogue state-variable filter.', + syntax: 'ahp, alp, abp, abr = statevar(ain, xcf, xq [, iosamps, istor])', + example: '--8<-- "examples/statevar.csd"', + parameters: [ + { + name: 'iosamps', + description: 'number of times of oversampling used in the filtering process. This will determine the maximum sharpness of the filter resonance (Q). More oversampling allows higher Qs, less oversampling will limit the resonance. The default is 3 times (iosamps=0).', + type: 'initialization' + }, + { + name: 'istor', + description: 'initial disposition of internal data space. Since filtering incorporates a feedback loop of previous output, the initial status of the storage space used is significant. A zero value will clear the space; a non-zero value will allow previous information to remain. The default value is 0.', + type: 'initialization' + }, + { + name: 'ahp', + description: 'high-pass output signal.', + type: 'performance' + }, + { + name: 'alp', + description: 'low-pass output signal.', + type: 'performance' + }, + { + name: 'abp', + description: 'band-pass signal.', + type: 'performance' + }, + { + name: 'abr', + description: 'band-reject signal.', + type: 'performance' + }, + { + name: 'asig', + description: 'input signal.', + type: 'performance' + }, + { + name: 'xcf', + description: 'filter cutoff frequency (k-rate or a-rate).', + type: 'performance' + }, + { + name: 'xq', + description: 'filter Q (k-rate or a-rate). This value is limited internally depending on the frequency and the number of times of oversampling used in the process (3-times oversampling by default).', + type: 'performance' + }, + ], + seeAlso: ['Standard Filters: Resonant Low-pass filters'] +}, +] diff --git a/src/lib/csound-reference/signal-modifiers-standard-filters.ts b/src/lib/csound-reference/signal-modifiers-standard-filters.ts new file mode 100644 index 0000000..00e6b0b --- /dev/null +++ b/src/lib/csound-reference/signal-modifiers-standard-filters.ts @@ -0,0 +1,471 @@ +import type { CsoundReference } from './types' + +// Signal Modifiers:Standard Filters +export const signalModifiersStandardFilters: CsoundReference[] = [ +{ + name: 'atone', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters', + description: 'A hi-pass filter whose transfer functions are the complements of the [tone](../opcodes/tone.md) opcode.', + syntax: 'ares = atone(asig, khp [, iskip])', + example: '--8<-- "examples/atone-modern.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'ares', + description: 'the output signal at audio rate.', + type: 'performance' + }, + { + name: 'asig', + description: 'the input signal at audio rate.', + type: 'performance' + }, + { + name: 'khp', + description: 'the response curve\'s half-power point, in Hertz. Half power is defined as peak power / root 2.', + type: 'performance' + }, + ], + seeAlso: ['Standard filters: Hi-pass filters'] +}, +{ + name: 'atonex', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters', + description: 'Emulates a stack of filters using the atone opcode.', + syntax: 'ares = atonex(asig, khp [, inumlayer] [, iskip])\n ares = atonex(asig, ahp [, inumlayer] [, iskip])', + example: '--8<-- "examples/atonex-modern.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'asig', + description: 'input signal', + type: 'performance' + }, + { + name: 'khp', + description: 'the response curve\'s half-power point. Half power is defined as peak power / root 2.', + type: 'performance' + }, + { + name: 'ahp', + description: 'the response curve\'s half-power point. Half power is defined as peak power / root 2.', + type: 'performance' + }, + ], + seeAlso: ['Standard filters: Hi-pass filters'] +}, +{ + name: 'biquad', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters', + description: 'A sweepable general purpose biquadratic digital filter.', + syntax: 'ares = biquad(asig, kb0, kb1, kb2, ka0, ka1, ka2 [, iskip])', + example: '--8<-- "examples/biquad-modern.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'asig', + description: 'input signal', + type: 'performance' + }, + ], + seeAlso: ['Standard filters: Biquad filters'] +}, +{ + name: 'biquada', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters', + description: 'A sweepable general purpose biquadratic digital filter with a-rate parameters.', + syntax: 'ares = biquada(asig, ab0, ab1, ab2, aa0, aa1, aa2 [, iskip])', + example: '--8<-- "examples/biquada-modern.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'asig', + description: 'input signal', + type: 'performance' + }, + ], + seeAlso: ['Standard filters: Biquad filters'] +}, +{ + name: 'butbp', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters', + description: 'Same as the [butterbp](../opcodes/butterbp.md) opcode.', + syntax: 'ares = butbp(asig, kfreq, kband [, iskip])', + rates: ['a-rate'], +}, +{ + name: 'butbr', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters', + description: 'Same as the [butterbr](../opcodes/butterbr.md) opcode.', + syntax: 'ares = butbr(asig, kfreq, kband [, iskip])', + rates: ['a-rate'], +}, +{ + name: 'buthp', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters', + description: 'Same as the [butterhp](../opcodes/butterhp.md) opcode.', + syntax: 'ares = buthp(asig, kfreq [, iskip])\n ares = buthp(asig, afreq [, iskip])', + rates: ['a-rate'], +}, +{ + name: 'butlp', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters', + description: 'Same as the [butterlp](../opcodes/butterlp.md) opcode.', + syntax: 'ares = butlp(asig, kfreq [, iskip])\n ares = butlp(asig, afreq [, iskip])', + rates: ['a-rate'], +}, +{ + name: 'butterbp', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters', + description: 'A band-pass Butterworth filter.', + syntax: 'ares = butterbp(asig, xfreq, xband [, iskip])', + example: '--8<-- "examples/butterbp-modern.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'asig', + description: 'Input signal to be filtered.', + type: 'performance' + }, + { + name: 'xfreq', + description: 'Cutoff or center frequency for each of the filters.', + type: 'performance' + }, + { + name: 'xband', + description: 'Bandwidth of the bandpass and bandreject filters.', + type: 'performance' + }, + ], + seeAlso: ['Standard filters: Butterworth filters'] +}, +{ + name: 'butterbr', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters', + description: 'A band-reject Butterworth filter.', + syntax: 'ares = butterbr(asig, xfreq, xband [, iskip])', + example: '--8<-- "examples/butterbr-modern.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'asig', + description: 'Input signal to be filtered.', + type: 'performance' + }, + { + name: 'xfreq', + description: 'Cutoff or center frequency for each of the filters.', + type: 'performance' + }, + { + name: 'xband', + description: 'Bandwidth of the bandpass and bandreject filters.', + type: 'performance' + }, + ], + seeAlso: ['Standard filters: Butterworth filters'] +}, +{ + name: 'butterhp', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters', + description: 'A high-pass Butterworth filter.', + syntax: 'ares = butterhp(asig, kfreq [, iskip])\n ares = butterhp(asig, afreq [, iskip])', + example: '--8<-- "examples/butterhp-modern.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'asig', + description: 'Input signal to be filtered.', + type: 'performance' + }, + { + name: 'kfreq', + description: 'Cutoff or center frequency for each of the filters.', + type: 'performance' + }, + { + name: 'afreq', + description: 'Cutoff or center frequency for each of the filters.', + type: 'performance' + }, + ], + seeAlso: ['Standard filters: Butterworth filters'] +}, +{ + name: 'butterlp', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters', + description: 'A low-pass Butterworth filter.', + syntax: 'ares = butterlp(asig, kfreq [, iskip])\n ares = butterlp(asig, afreq [, iskip])', + example: '--8<-- "examples/butterlp-modern.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'asig', + description: 'Input signal to be filtered.', + type: 'performance' + }, + { + name: 'kfreq', + description: 'Cutoff or center frequency for each of the filters.', + type: 'performance' + }, + { + name: 'afreq', + description: 'Cutoff or center frequency for each of the filters.', + type: 'performance' + }, + ], + seeAlso: ['Standard filters: Butterworth filters'] +}, +{ + name: 'clfilt', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters', + description: 'Implements the classical standard analog filter types: low-pass and high-pass.', + syntax: 'ares = clfilt(asig, kfreq, itype, inpol [, ikind] [, ipbr] [, isba] [, iskip])', + example: '--8<-- "examples/clfilt_lowpass-modern.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'itype', + description: '0 for low-pass, 1 for high-pass.', + type: 'initialization' + }, + { + name: 'inpol', + description: 'The number of poles in the filter. It must be an even number from 2 to 80.', + type: 'initialization' + }, + { + name: 'asig', + description: 'The input audio signal.', + type: 'performance' + }, + { + name: 'kfreq', + description: 'The corner frequency for low-pass or high-pass.', + type: 'performance' + }, + ], + seeAlso: ['Standard filters: General filters'] +}, +{ + name: 'diode_ladder', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters', + description: 'Zero-delay feedback implementation of a 4 pole (24 dB/oct) diode low-pass filter.', + syntax: 'asig = diode_ladder(ain, xcf, xk [, inlp, isaturation, istor])', + example: '--8<-- "examples/diode_ladder.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'istor', + description: 'initial disposition of internal data space. Since filtering incorporates a feedback loop of previous output, the initial status of the storage space used is significant. A zero value will clear the space; a non-zero value will allow previous information to remain. The default value is 0.', + type: 'initialization' + }, + { + name: 'asig', + description: 'low-pass output signal.', + type: 'performance' + }, + { + name: 'ain', + description: 'input signal.', + type: 'performance' + }, + { + name: 'xcf', + description: 'filter cutoff frequency (i-, k-, or a-rate).', + type: 'performance' + }, + { + name: 'xk', + description: 'filter feedback value k (i-, k-, or a-rate) that controls resonance. Range 0.0-17.0 . Self-oscillation occurs at 17.0.', + type: 'performance' + }, + ], + seeAlso: ['Standard filters: Zero-delay Feedback Filters (Virtual Analog)'] +}, +{ + name: 'k35_hpf', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters', + description: 'Zero-delay feedback implementation of Korg35 resonant high-pass filter.', + syntax: 'asig = K35_hpf(ain, xcf, xQ [, inlp, isaturation, istor])', + example: '--8<-- "examples/k35.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'istor', + description: 'initial disposition of internal data space. Since filtering incorporates a feedback loop of previous output, the initial status of the storage space used is significant. A zero value will clear the space; a non-zero value will allow previous information to remain. The default value is 0.', + type: 'initialization' + }, + { + name: 'asig', + description: 'output signal.', + type: 'performance' + }, + { + name: 'ain', + description: 'input signal.', + type: 'performance' + }, + { + name: 'xcf', + description: 'filter cutoff frequency (i-, k-, or a-rate).', + type: 'performance' + }, + { + name: 'xQ', + description: 'filter Q value (i-, k-, or a-rate). Range 1.0-10.0 (clamped by opcode). Self-oscillation occurs at 10.0.', + type: 'performance' + }, + ], + seeAlso: ['Standard filters: Zero-delay Feedback Filters (Virtual Analog)'] +}, +{ + name: 'k35_lpf', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters', + description: 'Zero-delay feedback implementation of Korg35 resonant low-pass filter.', + syntax: 'asig = K35_lpf(ain, xcf, xQ [, inlp, isaturation, istor])', + example: '--8<-- "examples/k35.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'istor', + description: 'initial disposition of internal data space. Since filtering incorporates a feedback loop of previous output, the initial status of the storage space used is significant. A zero value will clear the space; a non-zero value will allow previous information to remain. The default value is 0.', + type: 'initialization' + }, + { + name: 'asig', + description: 'output signal.', + type: 'performance' + }, + { + name: 'ain', + description: 'input signal.', + type: 'performance' + }, + { + name: 'xcf', + description: 'filter cutoff frequency (i-, k-, or a-rate).', + type: 'performance' + }, + { + name: 'xQ', + description: 'filter Q value (i-, k-, or a-rate). Range 1.0-10.0 (clamped by opcode). Self-oscillation occurs at 10.0.', + type: 'performance' + }, + ], + seeAlso: ['Standard filters: Zero-delay Feedback Filters (Virtual Analog)'] +}, +{ + name: 'median', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters', + description: 'A median filter, a variant FIR lowpass filter.', + syntax: 'ares = median(asig, ksize, imaxsize [, iskip])', + example: '--8<-- "examples/median.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'imaxsize', + description: 'the maximun size of the window used to select the data.', + type: 'initialization' + }, + { + name: 'iskip', + description: 'initial disposition of internal data space. A zero value will clear the space; a non-zero value will allow previous information to remain. The default value is 0.', + type: 'initialization' + }, + { + name: 'asig', + description: 'input signal to be filtered', + type: 'performance' + }, + { + name: 'ksize', + description: 'size of the window over which the input is to be filtered. It must not exceed the maximum window size; if it does it is truncated.', + type: 'performance' + }, + ], + seeAlso: ['Standard filters: Variant FIR lowpass filter'] +}, +{ + name: 'mediank', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters', + description: 'A median filter, a variant FIR lowpass filter.', + syntax: 'kres = mediank(kin, ksize, imaxsize [, iskip])', + example: '--8<-- "examples/mediank.csd"', + rates: ['k-rate'], + parameters: [ + { + name: 'imaxsize', + description: 'the maximun size of the window used to select the data.', + type: 'initialization' + }, + { + name: 'iskip', + description: 'initial disposition of internal data space. A zero value will clear the space; a non-zero value will allow previous information to remain. The default value is 0.', + type: 'initialization' + }, + { + name: 'kin', + description: 'krate value to be filtered', + type: 'performance' + }, + { + name: 'ksize', + description: 'size of the window over which the input is to be filtered. It must not exceed the maximum window size; if it does it is truncated.', + type: 'performance' + }, + ], + seeAlso: ['Standard filters: Variant FIR lowpass filter'] +}, +{ + name: 'mode', + type: 'opcode', + category: 'Signal Modifiers:Standard Filters', + description: 'A filter that simulates a mass-spring-damper system.', + syntax: 'aout = mode(ain, xfreq, xQ [, iskip])', + example: '--8<-- "examples/mode.csd"', + parameters: [ + { + name: 'aout', + description: 'filtered signal', + type: 'performance' + }, + { + name: 'ain', + description: 'signal to filter', + type: 'performance' + }, + { + name: 'xfreq', + description: 'resonant frequency of the filter', + type: 'performance' + }, + { + name: 'xQ', + description: 'quality factor of the filter', + type: 'performance' + }, + ], + seeAlso: ['Specialized Filters: Other filters'] +}, +] diff --git a/src/lib/csound-reference/signal-modifiers-waveshaping.ts b/src/lib/csound-reference/signal-modifiers-waveshaping.ts new file mode 100644 index 0000000..cb2f9d3 --- /dev/null +++ b/src/lib/csound-reference/signal-modifiers-waveshaping.ts @@ -0,0 +1,170 @@ +import type { CsoundReference } from './types' + +// Signal Modifiers:Waveshaping +export const signalModifiersWaveshaping: CsoundReference[] = [ +{ + name: 'chebyshevpoly', + type: 'opcode', + category: 'Signal Modifiers:Waveshaping', + description: 'Efficiently evaluates the sum of Chebyshev polynomials of arbitrary order.', + syntax: 'aout = chebyshevpoly(ain, k0 [, k1 [, k2 [...]]])', + example: '--8<-- "examples/chebyshevpoly-modern.csd"', + parameters: [ + { + name: 'ain', + description: 'the input signal used as the independent variable of the Chebyshev polynomials ("x").', + type: 'performance' + }, + { + name: 'aout', + description: 'the output signal ("y").', + type: 'performance' + }, + ], + seeAlso: ['Waveshaping', 'Opcode Equivalents of Functions'] +}, +{ + name: 'pdclip', + type: 'opcode', + category: 'Signal Modifiers:Waveshaping', + description: 'Performs linear clipping on an audio signal or a phasor.', + syntax: 'aout = pdclip(ain, kWidth, kCenter [, ibipolar [, ifullscale]])', + example: '--8<-- "examples/pdclip.csd"', + parameters: [ + { + name: 'ibipolar', + description: 'an optional parameter specifying either unipolar (0) or bipolar (1) mode. Defaults to unipolar mode.', + type: 'initialization' + }, + { + name: 'ifullscale', + description: 'an optional parameter specifying the range of input and output values. The maximum will be _ifullscale_. The minimum depends on the mode of operation: zero for unipolar or -_ifullscale_ for bipolar. Defaults to 1.0 -- you should set this parameter to the maximum expected input value.', + type: 'initialization' + }, + { + name: 'ain', + description: 'the input signal to be clipped.', + type: 'performance' + }, + { + name: 'aout', + description: 'the output signal.', + type: 'performance' + }, + { + name: 'kWidth', + description: 'the percentage of the signal range that is clipped (must be between 0 and 1).', + type: 'performance' + }, + { + name: 'kCenter', + description: 'an offset for shifting the unclipped window of the signal higher or lower in the range (essentially a DC offset). Values should be in the range [-1, 1] with a value of zero representing no shift (regardless of whether bipolar or unipolar mode is used).', + type: 'performance' + }, + ], + seeAlso: ['Phase Distortion'] +}, +{ + name: 'pdhalf', + type: 'opcode', + category: 'Signal Modifiers:Waveshaping', + description: 'Distorts a phasor for reading the two halves of a table at different rates.', + syntax: 'aout = pdhalf(ain, kShapeAmount [, ibipolar [, ifullscale]])', + example: 'aphase phasor ifreq\napd pdhalf aphase, kamount\naout tablei apd, 1, 1', + parameters: [ + { + name: 'ibipolar', + description: 'an optional parameter specifying either unipolar (0) or bipolar (1) mode. Defaults to unipolar mode.', + type: 'initialization' + }, + { + name: 'ifullscale', + description: 'an optional parameter specifying the range of input and output values. The maximum will be _ifullscale_. The minimum depends on the mode of operation: zero for unipolar or -_ifullscale_ for bipolar. Defaults to 1.0 -- you should set this parameter to the maximum expected input value.', + type: 'initialization' + }, + { + name: 'ain', + description: 'the input signal to be distorted.', + type: 'performance' + }, + { + name: 'aout', + description: 'the output signal.', + type: 'performance' + }, + { + name: 'kShapeAmount', + description: 'the amount of distortion applied to the input. Must be between negative one and one (-1 to 1). An amount of zero means no distortion.', + type: 'performance' + }, + ], + seeAlso: ['Phase Distortion', 'http://en.wikipedia.org/wiki/Phase_distortion_synthesis'] +}, +{ + name: 'pdhalfy', + type: 'opcode', + category: 'Signal Modifiers:Waveshaping', + description: 'Distorts a phasor for reading two unequal portions of a table in equal periods.', + syntax: 'aout = pdhalfy(ain, kShapeAmount [, ibipolar [, ifullscale]])', + example: 'aphase phasor ifreq\napd pdhalfy aphase, kamount\naout tablei apd, 1, 1', + parameters: [ + { + name: 'ibipolar', + description: 'an optional parameter specifying either unipolar (0) or bipolar (1) mode. Defaults to unipolar mode.', + type: 'initialization' + }, + { + name: 'ifullscale', + description: 'an optional parameter specifying the range of input and output values. The maximum will be _ifullscale_. The minimum depends on the mode of operation: zero for unipolar or -_ifullscale_ for bipolar. Defaults to 1.0 -- you should set this parameter to the maximum expected input value.', + type: 'initialization' + }, + { + name: 'ain', + description: 'the input signal to be distorted.', + type: 'performance' + }, + { + name: 'aout', + description: 'the output signal.', + type: 'performance' + }, + { + name: 'kShapeAmount', + description: 'the amount of distortion applied to the input. Must be between negative one and one (-1 to 1). An amount of zero means no distortion.', + type: 'performance' + }, + ], + seeAlso: ['Phase Distortion', 'http://en.wikipedia.org/wiki/Phase_distortion_synthesis'] +}, +{ + name: 'powershape', + type: 'opcode', + category: 'Signal Modifiers:Waveshaping', + description: 'Waveshapes a signal by raising it to a variable exponent.', + syntax: 'aout = powershape(ain, kShapeAmount [, ifullscale])', + example: '--8<-- "examples/powershape.csd"', + parameters: [ + { + name: 'ifullscale', + description: 'optional parameter specifying the range of input values from -_ifullscale_ to _ifullscale_. Defaults to 1.0 -- you should set this parameter to the maximum expected input value.', + type: 'initialization' + }, + { + name: 'ain', + description: 'the input signal to be shaped.', + type: 'performance' + }, + { + name: 'aout', + description: 'the output signal.', + type: 'performance' + }, + { + name: 'kShapeAmount', + description: 'the amount of the shaping effect applied to the input; equal to the power that the input signal is raised.', + type: 'performance' + }, + ], + seeAlso: ['pow', 'powoftwo', 'Waveshaping', 'Mathematical Functions'] +}, +] diff --git a/src/lib/csound-reference/spectral-processing-ats.ts b/src/lib/csound-reference/spectral-processing-ats.ts new file mode 100644 index 0000000..12b76cf --- /dev/null +++ b/src/lib/csound-reference/spectral-processing-ats.ts @@ -0,0 +1,315 @@ +import type { CsoundReference } from './types' + +// Spectral Processing:ATS +export const spectralProcessingAts: CsoundReference[] = [ +{ + name: 'ATSadd', + type: 'opcode', + category: 'Spectral Processing:ATS', + description: 'Uses the data from an ATS analysis file to perform additive synthesis using an internal array of interpolating oscillators.', + syntax: 'ar = ATSadd(ktimepnt, kfmod, iatsfile, ifn, ipartials [, ipartialoffset, \\\n ipartialincr, igatefn])', + example: 'ktime line 0, p3, 2.5\n asig ATSadd ktime, 1, "clarinet.ats", 1, 20, 2', + rates: ['i-rate'], + parameters: [ + { + name: 'iatsfile', + description: 'the ATS number (n in ats.n) or the name in quotes of the analysis file made using [ATSA](../utility/atsa.md).', + type: 'initialization' + }, + { + name: 'ifn', + description: 'table number of a stored function containing a sine wave for _ATSadd_ and a cosine for [ATSaddnz](../opcodes/ATSaddnz.md) (see examples below for more info)', + type: 'initialization' + }, + { + name: 'ipartials', + description: 'number of partials that will be used in the resynthesis (the noise has a maximum of 25 bands)', + type: 'initialization' + }, + { + name: 'ktimepnt', + description: 'The time pointer in seconds used to index the ATS file. Used for _ATSadd_ exactly the same as for [pvoc](../opcodes/pvoc.md).', + type: 'performance' + }, + { + name: 'kfmod', + description: 'A control-rate transposition factor: a value of 1 incurs no transposition, 1.5 transposes up a perfect fifth, and .5 down an octave. Used for _ATSadd_ exactly the same as for [pvoc](../opcodes/pvoc.md).', + type: 'performance' + }, + ], + seeAlso: ['ATS Spectral Processing'] +}, +{ + name: 'ATSaddnz', + type: 'opcode', + category: 'Spectral Processing:ATS', + description: 'Uses the data from an ATS analysis file to perform noise resynthesis using a modified randi function.', + syntax: 'ar = ATSaddnz(ktimepnt, iatsfile, ibands [, ibandoffset, ibandincr])', + example: 'ktime line 0, p3, 2.5\n asig ATSaddnz ktime, "clarinet.ats", 25', + parameters: [ + { + name: 'iatsfile', + description: 'the ATS number (n in ats.n) or the name in quotes of the analysis file made using [ATSA](../utility/atsa.md).', + type: 'initialization' + }, + { + name: 'ibands', + description: 'number of noise bands that will be used in the resynthesis (the noise has a maximum of 25 bands)', + type: 'initialization' + }, + { + name: 'ktimepnt', + description: 'The time pointer in seconds used to index the ATS file. Used for _ATSaddnz_ exactly the same as for [pvoc](../opcodes/pvoc.md) and [ATSadd](../opcodes/ATSadd.md).', + type: 'performance' + }, + ], + seeAlso: ['ATS Spectral Processing'] +}, +{ + name: 'ATSbufread', + type: 'opcode', + category: 'Spectral Processing:ATS', + description: 'Reads data from and ATS data file and stores it in an internal data table of frequency, amplitude pairs.', + syntax: 'ATSbufread(ktimepnt, kfmod, iatsfile, ipartials [, ipartialoffset, \\\n ipartialincr])', + example: '--8<-- "examples/ATSbufread-modern.csd"', + parameters: [ + { + name: 'iatsfile', + description: 'the ATS number (n in ats.n) or the name in quotes of the analysis file made using [ATSA](../utility/atsa.md).', + type: 'initialization' + }, + { + name: 'ipartials', + description: 'number of partials that will be used in the resynthesis (the noise has a maximum of 25 bands)', + type: 'initialization' + }, + { + name: 'ktimepnt', + description: 'The time pointer in seconds used to index the ATS file. Used for _ATSbufread_ exactly the same as for [pvoc](../opcodes/pvoc.md).', + type: 'performance' + }, + { + name: 'kfmod', + description: 'an input for performing pitch transposition or frequency modulation on all of the synthesized partials, if no fm or pitch change is desired then use a 1 for this value.', + type: 'performance' + }, + ], + seeAlso: ['ATS Spectral Processing'] +}, +{ + name: 'ATScross', + type: 'opcode', + category: 'Spectral Processing:ATS', + description: '_ATScross_ uses data from an ATS analysis file and data from an [ATSbufread](../opcodes/ATSbufread.md) to perform cross synthesis.', + syntax: 'ar = ATScross(ktimepnt, kfmod, iatsfile, ifn, kmylev, kbuflev, ipartials \\\n [, ipartialoffset, ipartialincr])', + example: '--8<-- "examples/ATScross-modern.csd"', + rates: ['i-rate'], + parameters: [ + { + name: 'iatsfile', + description: 'integer or character-string denoting a control-file derived from ATS analysis of an audio signal. An integer denotes the suffix of a file ATS.m; a character-string (in double quotes) gives a filename, optionally a full pathname. If not full-path, the file is sought first in the current directory, then in the one given by the environment variable SADIR (if defined).', + type: 'initialization' + }, + { + name: 'ifn', + description: 'table number of a stored function containing a sine wave.', + type: 'initialization' + }, + { + name: 'ipartials', + description: 'number of partials that will be used in the resynthesis', + type: 'initialization' + }, + { + name: 'ktimepnt', + description: 'The time pointer in seconds used to index the ATS file. Used for _ATScross_ exactly the same as for [pvoc](../opcodes/pvoc.md).', + type: 'performance' + }, + { + name: 'kfmod', + description: 'an input for performing pitch transposition or frequency modulation on all of the synthesized partials, if no fm or pitch change is desired then use a 1 for this value.', + type: 'performance' + }, + { + name: 'kmylev', + description: 'scales the _ATScross_ component of the frequency spectrum applied to the partials from the ATS file indicated by the _ATScross_ opcode. The frequency spectrum information comes from the _ATScross_ ATS file. A value of 1 (and 0 for _kbuflev_) gives the same results as [ATSadd](../opcodes/ATSadd.md).', + type: 'performance' + }, + { + name: 'kbuflev', + description: 'scales the [ATSbufread](../opcodes/ATSbufread.md) component of the frequency spectrum applied to the partials from the ATS file indicated by the _ATScross_ opcode. The frequency spectrum information comes from the [ATSbufread](../opcodes/ATSbufread.md) ATS file. A value of 1 (and 0 for _kmylev_) results in partials that have frequency information from the ATS file given by the _ATScross_, but amplitudes imposed by data from the ATS file given by [ATSbufread](../opcodes/ATSbufread.md).', + type: 'performance' + }, + ], + seeAlso: ['ATS Spectral Processing'] +}, +{ + name: 'ATSinfo', + type: 'opcode', + category: 'Spectral Processing:ATS', + description: 'Reads data out of the header of an ATS file.', + syntax: 'idata = ATSinfo(iatsfile, ilocation)', + example: '--8<-- "examples/ATSinfo-modern.csd"', + parameters: [ + { + name: 'iatsfile', + description: 'the ATS number (n in ats.n) or the name in quotes of the analysis file made using [ATSA](../utility/atsa.md).', + type: 'initialization' + }, + { + name: 'ilocation', + description: 'indicates which location in the header file to return. The data in the header gives information about the data contained in the rest of the ATS file. The possible values for _ilocation_ are given in the following list:', + type: 'initialization' + }, + ], + seeAlso: ['ATS Spectral Processing'] +}, +{ + name: 'ATSinterpread', + type: 'opcode', + category: 'Spectral Processing:ATS', + description: 'Allows a user to determine the frequency envelope of any [ATSbufread](../opcodes/ATSbufread.md).', + syntax: 'kamp = ATSinterpread(kfreq)', + example: '--8<-- "examples/ATSinterpread-modern.csd"', + rates: ['k-rate'], + parameters: [ + { + name: 'kfreq', + description: 'a frequency value (given in Hertz) used by _ATSinterpread_ as in index into the table produced by an [ATSbufread](../opcodes/ATSbufread.md).', + type: 'performance' + }, + ], + seeAlso: ['ATS Spectral Processing'] +}, +{ + name: 'ATSpartialtap', + type: 'opcode', + category: 'Spectral Processing:ATS', + description: 'Returns a frequency, amplitude pair from an [ATSbufread](../opcodes/ATSbufread.md) opcode.', + syntax: 'kfrq, kamp = ATSpartialtap(ipartialnum)', + example: '--8<-- "examples/ATSpartialtap-modern.csd"', + rates: ['k-rate'], + parameters: [ + { + name: 'ipartialnum', + description: 'indicates the partial that the _ATSpartialtap_ opcode should read from an [ATSbufread](../opcodes/ATSbufread.md).', + type: 'initialization' + }, + { + name: 'kfrq', + description: 'returns the frequency value for the requested partial.', + type: 'performance' + }, + { + name: 'kamp', + description: 'returns the amplitude value for the requested partial.', + type: 'performance' + }, + ], + seeAlso: ['ATS Spectral Processing'] +}, +{ + name: 'ATSread', + type: 'opcode', + category: 'Spectral Processing:ATS', + description: 'Reads data from an ATS file.', + syntax: 'kfreq, kamp = ATSread(ktimepnt, iatsfile, ipartial)', + example: '--8<-- "examples/ATSread-modern.csd"', + rates: ['k-rate'], + parameters: [ + { + name: 'iatsfile', + description: 'the ATS number (n in ats.n) or the name in quotes of the analysis file made using [ATSA](../utility/atsa.md).', + type: 'initialization' + }, + { + name: 'ipartial', + description: 'the number of the analysis partial to return the frequency in Hz and amplitude.', + type: 'initialization' + }, + { + name: 'kfreq', + description: 'outputs of the _ATSread_ unit. These values represent the frequency and amplitude of a specific partial selected by the user using _ipartial_. The partials\' informations are derived from an ATS analysis. _ATSread_ linearly interpolates the frequency and amplitude between frames in the ATS analysis file at k-rate. The output is dependent on the data in the analysis file and the pointer _ktimepnt_.', + type: 'performance' + }, + { + name: 'kamp', + description: 'outputs of the _ATSread_ unit. These values represent the frequency and amplitude of a specific partial selected by the user using _ipartial_. The partials\' informations are derived from an ATS analysis. _ATSread_ linearly interpolates the frequency and amplitude between frames in the ATS analysis file at k-rate. The output is dependent on the data in the analysis file and the pointer _ktimepnt_.', + type: 'performance' + }, + { + name: 'ktimepnt', + description: 'The time pointer in seconds used to index the ATS file. Used for _ATSread_ exactly the same as for [pvoc](../opcodes/pvoc.md) and [ATSadd](../opcodes/ATSadd.md).', + type: 'performance' + }, + ], + seeAlso: ['ATS Spectral Processing'] +}, +{ + name: 'ATSreadnz', + type: 'opcode', + category: 'Spectral Processing:ATS', + description: 'reads data from an ATS file.', + syntax: 'kenergy = ATSreadnz(ktimepnt, iatsfile, iband)', + example: 'ktime line 2.5, p3, 0\n kenergy\tATSreadnz ktime, "clarinet.ats", 5', + parameters: [ + { + name: 'iatsfile', + description: 'the ATS number (n in ats.n) or the name in quotes of the analysis file made using [ATSA](../utility/atsa.md).', + type: 'initialization' + }, + { + name: 'iband', + description: 'the number of the noise band to return the energy data.', + type: 'initialization' + }, + { + name: 'ktimepnt', + description: 'The time pointer in seconds used to index the ATS file. Used for _ATSreadnz_ exactly the same as for [pvoc](../opcodes/pvoc.md) and [ATSadd](../opcodes/ATSadd.md).', + type: 'performance' + }, + ], + seeAlso: ['ATS Spectral Processing'] +}, +{ + name: 'ATSsinnoi', + type: 'opcode', + category: 'Spectral Processing:ATS', + description: '_ATSsinnoi_ reads data from an ATS data file and uses the information to synthesize sines and noise together.', + syntax: 'ar = ATSsinnoi(ktimepnt, ksinlev, knzlev, kfmod, iatsfile, ipartials \\\n [, ipartialoffset, ipartialincr])', + example: 'ktime line 0, p3, 2.5\n asig ATSsinnoi ktime, 1, 1, 1, "beats.ats", 42', + parameters: [ + { + name: 'iatsfile', + description: 'the ATS number (n in ats.n) or the name in quotes of the analysis file made using [ATSA](../utility/atsa.md).', + type: 'initialization' + }, + { + name: 'ipartials', + description: 'number of partials that will be used in the resynthesis (the noise has a maximum of 25 bands)', + type: 'initialization' + }, + { + name: 'ktimepnt', + description: 'The time pointer in seconds used to index the ATS file. Used for _ATSsinnoi_ exactly the same as for [pvoc](../opcodes/pvoc.md).', + type: 'performance' + }, + { + name: 'ksinlev', + description: 'controls the level of the sines in the _ATSsinnoi_ ugen. A value of 1 gives full volume sinewaves.', + type: 'performance' + }, + { + name: 'knzlev', + description: 'controls the level of the noise components in the _ATSsinnoi_ ugen. A value of 1 gives full volume noise.', + type: 'performance' + }, + { + name: 'kfmod', + description: 'an input for performing pitch transposition or frequency modulation on all of the synthesized partials, if no fm or pitch change is desired then use a 1 for this value.', + type: 'performance' + }, + ], + seeAlso: ['ATS Spectral Processing'] +}, +] diff --git a/src/lib/csound-reference/spectral-processing-lpc.ts b/src/lib/csound-reference/spectral-processing-lpc.ts new file mode 100644 index 0000000..3a93f11 --- /dev/null +++ b/src/lib/csound-reference/spectral-processing-lpc.ts @@ -0,0 +1,416 @@ +import type { CsoundReference } from './types' + +// Spectral Processing:LPC +export const spectralProcessingLpc: CsoundReference[] = [ +{ + name: 'allpole', + type: 'opcode', + category: 'Spectral Processing:LPC', + description: 'Allpole filter implementation using direct convolution.', + syntax: 'ares = allpole(asig, kCoef[])', + example: '--8<-- "examples/allpole-modern.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'asig', + description: 'audio input', + type: 'performance' + }, + { + name: 'ares', + description: 'audio output', + type: 'performance' + }, + ], + seeAlso: ['Streaming Linear Predictive Coding (SLPC) Resynthesis'] +}, +{ + name: 'apoleparams', + type: 'opcode', + category: 'Spectral Processing:LPC', + description: 'Extracts allpole filter parameters from coefficients.', + syntax: 'kPar[] = apoleparams(kCoef[])', + example: '--8<-- "examples/apoleparams-modern.csd"', + seeAlso: ['Streaming Linear Predictive Coding (SLPC) Resynthesis'] +}, +{ + name: 'lpcanal', + type: 'opcode', + category: 'Spectral Processing:LPC', + description: 'Streaming linear prediction analysis.', + syntax: 'kCoef[], krms, kerr, kcps = lpcanal(asrc, kflg, kprd, isiz, iord [, iwin])\n kCoef[], krms, kerr, kcps = lpcanal(koff, kflg, ifn, isiz, iord [, iwin])\n iCoef[], irms, ierr, icps = lpcanal(ioff, iflg, ifn, isiz, iord [, iwin])', + example: '--8<-- "examples/lpcanal.csd"', + rates: ['k-rate', 'i-rate'], + parameters: [ + { + name: 'isiz', + description: 'size of lpc input frame in samples.', + type: 'initialization' + }, + { + name: 'iord', + description: 'linear predictor order.', + type: 'initialization' + }, + { + name: 'ifn', + description: 'streaming LPC analysis source function table', + type: 'initialization' + }, + { + name: 'iwin', + description: 'window function table number (optional)', + type: 'initialization' + }, + { + name: 'krms', + description: 'RMS estimate of source signal.', + type: 'performance' + }, + { + name: 'kerr', + description: 'linear prediction error (or residual).', + type: 'performance' + }, + { + name: 'kcps', + description: 'fundamental frequency estimate, from the autocorrelation function.', + type: 'performance' + }, + { + name: 'asrc', + description: 'streaming LPC analysis source signal', + type: 'performance' + }, + { + name: 'kflg', + description: 'compute flag, non-zero values switch on linear prediction analysis replacing filter coefficients, zero switch it off, keeping current filter coefficients.', + type: 'performance' + }, + { + name: 'kprd', + description: 'analysis period in samples, determining how often new coefficients are computed.', + type: 'performance' + }, + { + name: 'koff', + description: 'function table position offset, in samples, determining the start position of analysis frame.', + type: 'performance' + }, + ], + seeAlso: ['Streaming Linear Predictive Coding (SLPC) Resynthesis'] +}, +{ + name: 'lpcfilter', + type: 'opcode', + category: 'Spectral Processing:LPC', + description: 'Streaming linear prediction all-pole filter whose coefficients are obtained from streaming linear prediction analysis.', + syntax: 'ares = lpcfilter(asig, asrc, kflg, kprd, isiz, iord [, iwin])\n ares = lpcfilter(asig, koff, kflg, ifn, isiz, iord [, iwin])', + example: '--8<-- "examples/lpcfilter.csd"', + rates: ['a-rate', 'i-rate'], + parameters: [ + { + name: 'isiz', + description: 'size of lpc input frame in samples.', + type: 'initialization' + }, + { + name: 'iord', + description: 'linear predictor order.', + type: 'initialization' + }, + { + name: 'ifn', + description: 'streaming LPC analysis source function table', + type: 'initialization' + }, + { + name: 'iwin', + description: 'window function table number (optional)', + type: 'initialization' + }, + { + name: 'ares', + description: 'output', + type: 'performance' + }, + { + name: 'asig', + description: 'audio input', + type: 'performance' + }, + { + name: 'asrc', + description: 'streaming LPC analysis source signal', + type: 'performance' + }, + { + name: 'kflg', + description: 'compute flag, non-zero values switch on linear prediction analysis replacing filter coefficients, zero switch it off, keeping current filter coefficients.', + type: 'performance' + }, + { + name: 'kprd', + description: 'analysis period in samples, determining how often new coefficients are computed.', + type: 'performance' + }, + { + name: 'koff', + description: 'function table position offset, in samples, determining the start position of analysis frame.', + type: 'performance' + }, + ], + seeAlso: ['Streaming Linear Predictive Coding (SLPC) Resynthesis'] +}, +{ + name: 'lpfreson', + type: 'opcode', + category: 'Spectral Processing:LPC', + description: 'Resynthesises a signal from the data passed internally by a previous _lpread_, applying formant shifting.', + syntax: 'ares = lpfreson(asig, kfrqratio)', + example: '--8<-- "examples/lpfreson.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'asig', + description: 'an audio driving function for resynthesis.', + type: 'performance' + }, + { + name: 'kfrqratio', + description: 'frequency ratio. Must be greater than 0.', + type: 'performance' + }, + ], + seeAlso: ['Linear Predictive Coding (LPC) Resynthesis'] +}, +{ + name: 'lpinterp', + type: 'opcode', + category: 'Spectral Processing:LPC', + description: 'Computes a new set of poles from the interpolation between two analysis.', + syntax: 'lpinterp(islot1, islot2, kmix)', + parameters: [ + { + name: 'islot1', + description: 'slot where the first analysis was stored', + type: 'initialization' + }, + { + name: 'islot2', + description: 'slot where the second analysis was stored', + type: 'initialization' + }, + { + name: 'kmix', + description: 'mix value between the two analysis. Should be between 0 and 1. 0 means analysis 1 only. 1 means analysis 2 only. Any value in between will produce interpolation between the filters.', + type: 'initialization' + }, + ], + seeAlso: ['Linear Predictive Coding (LPC) Resynthesis'] +}, +{ + name: 'lpread', + type: 'opcode', + category: 'Spectral Processing:LPC', + description: 'Reads a control file of time-ordered information frames.', + syntax: 'krmsr, krmso, kerr, kcps = lpread(ktimpnt, ifilcod [, inpoles] [, ifrmrate])', + example: '--8<-- "examples/lpread.csd"', + rates: ['k-rate'], + parameters: [ + { + name: 'ifilcod', + description: 'integer or character-string denoting a control-file (reflection coefficients and four parameter values) derived from n-pole linear predictive spectral analysis of a source audio signal. An integer denotes the suffix of a file _lp.m_; a character-string (in double quotes) gives a filename, optionally a full pathname. If not fullpath, the file is sought first in the current directory, then in that of the environment variable SADIR (if defined). Memory usage depends on the size of the file, which is held entirely in memory during computation but shared by multiple calls (see also _adsyn_, [pvoc](../opcodes/pvoc.md)).', + type: 'initialization' + }, + { + name: 'krmsr', + description: 'root-mean-square (rms) of the residual of analysis', + type: 'performance' + }, + { + name: 'krmso', + description: 'rms of the original signal', + type: 'performance' + }, + { + name: 'kerr', + description: 'the normalized error signal', + type: 'performance' + }, + { + name: 'kcps', + description: 'pitch in Hz', + type: 'performance' + }, + { + name: 'ktimpnt', + description: 'The passage of time, in seconds, through the analysis file. _ktimpnt_ must always be positive, but can move forwards or backwards in time, be stationary or discontinuous, as a pointer into the analysis file.', + type: 'performance' + }, + ], + seeAlso: ['Linear Predictive Coding (LPC) Resynthesis'] +}, +{ + name: 'lpreson', + type: 'opcode', + category: 'Spectral Processing:LPC', + description: 'RResynthesises a signal from the data passed internally by a previous _lpread_.', + syntax: 'ares = lpreson(asig)', + example: '--8<-- "examples/lpreson.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'asig', + description: 'an audio driving function for resynthesis.', + type: 'performance' + }, + ], + seeAlso: ['Linear Predictive Coding (LPC) Resynthesis'] +}, +{ + name: 'lpslot', + type: 'opcode', + category: 'Spectral Processing:LPC', + description: 'Selects the slot to be use by further lp opcodes.', + syntax: 'lpslot(islot)', + example: '--8<-- "examples/lpslot.csd"', + parameters: [ + { + name: 'islot', + description: 'number of slot to be selected.', + type: 'initialization' + }, + ], + seeAlso: ['Linear Predictive Coding (LPC) Resynthesis'] +}, +{ + name: 'pvscfs', + type: 'opcode', + category: 'Spectral Processing:LPC', + description: 'Cepstrum all-pole coefficient analysis.', + syntax: 'kCoef[], krms, kerr = pvscfs(fsig, iord [, imod])', + example: '--8<-- "examples/pvscfs.csd"', + parameters: [ + { + name: 'iord', + description: 'all-pole filter order.', + type: 'initialization' + }, + { + name: 'imod', + description: 'filter stabilisation mode (0=no stabilisation; 1= pole reflection; 2 = pole limiting; defaults to 1).', + type: 'initialization' + }, + { + name: 'krms', + description: 'RMS estimate of source signal.', + type: 'performance' + }, + { + name: 'kerr', + description: 'error (or residual).', + type: 'performance' + }, + { + name: 'fsig', + description: 'pvs signal input in PV_AMP_* format.', + type: 'performance' + }, + ], + seeAlso: ['Streaming Linear Predictive Coding (SLPC) Resynthesis'] +}, +{ + name: 'pvslpc', + type: 'opcode', + category: 'Spectral Processing:LPC', + description: 'Streaming linear prediction analysis.', + syntax: 'fsig = pvslpc(asrc, idftsiz, ihop, iord [, iwin])', + example: '--8<-- "examples/pvslpc.csd"', + parameters: [ + { + name: 'idftsiz', + description: 'size of lpc input frame in samples and fsig analysis frame. It needs to be a power-of-two.', + type: 'initialization' + }, + { + name: 'iord', + description: 'linear predictor order.', + type: 'initialization' + }, + { + name: 'ihop', + description: 'analysis hop size.', + type: 'initialization' + }, + { + name: 'iwin', + description: 'window function table number (optional).', + type: 'initialization' + }, + { + name: 'fsig', + description: 'fsig output', + type: 'performance' + }, + { + name: 'asrc', + description: 'source signal for lpc analysis', + type: 'performance' + }, + ], + seeAlso: ['Streaming Linear Predictive Coding (SLPC) Resynthesis'] +}, +{ + name: 'resonbnk', + type: 'opcode', + category: 'Spectral Processing:LPC', + description: 'A resonator filter bank.', + syntax: 'asig = resonbnk(ain, kPar[], kmin, kmax, iper [, imode, iscal, iskip])', + example: '--8<-- "examples/resonbnk.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'iper', + description: 'filter parameter interpolation period (in samples).', + type: 'initialization' + }, + { + name: 'imode', + description: 'filter connection mode (0 = serial, 1 = parallel, defaults to 1).', + type: 'initialization' + }, + { + name: 'iscal', + description: 'filter scaling mode (0 = no scaling, 1 and 2 modes as in reson, defaults to 0).', + type: 'initialization' + }, + { + name: 'iskip', + description: 'skip initialisation if non-zero (defaults to 0).', + type: 'initialization' + }, + { + name: 'asig', + description: 'output signal', + type: 'performance' + }, + { + name: 'ain', + description: 'input signal', + type: 'performance' + }, + { + name: 'kmin', + description: 'minimum filter frequency.', + type: 'performance' + }, + { + name: 'kmax', + description: 'maximum filter frequency.', + type: 'performance' + }, + ], + seeAlso: ['Streaming Linear Predictive Coding (SLPC) Resynthesis'] +}, +] diff --git a/src/lib/csound-reference/spectral-processing-non-standard.ts b/src/lib/csound-reference/spectral-processing-non-standard.ts new file mode 100644 index 0000000..f1db785 --- /dev/null +++ b/src/lib/csound-reference/spectral-processing-non-standard.ts @@ -0,0 +1,210 @@ +import type { CsoundReference } from './types' + +// Spectral Processing:Non-Standard +export const spectralProcessingNonStandard: CsoundReference[] = [ +{ + name: 'specaddm', + type: 'opcode', + category: 'Spectral Processing:Non-Standard', + description: 'Perform a weighted add of two input spectra.', + syntax: 'wsig = specaddm(wsig1, wsig2 [, imul2])', + parameters: [ + { + name: 'wsig1', + description: 'the first input spectra.', + type: 'performance' + }, + { + name: 'wsig2', + description: 'the second input spectra.', + type: 'performance' + }, + ], + seeAlso: ['specdiff', 'specfilt', 'spechist', 'specscal'] +}, +{ + name: 'specdiff', + type: 'opcode', + category: 'Spectral Processing:Non-Standard', + description: 'Finds the positive difference values between consecutive spectral frames.', + syntax: 'wsig = specdiff(wsigin)', + example: 'wsig2 specdiff wsig1 ; sense onsets \n wsig3 specfilt wsig2, 2 ; absorb slowly\n specdisp wsig2, 0.1 ; & display both spectra\n specdisp wsig3, 0.1', + parameters: [ + { + name: 'wsig', + description: 'the output spectrum.', + type: 'performance' + }, + { + name: 'wsigin', + description: 'the input spectra.', + type: 'performance' + }, + ], + seeAlso: ['specaddm', 'specfilt', 'spechist', 'specscal'] +}, +{ + name: 'specdisp', + type: 'opcode', + category: 'Spectral Processing:Non-Standard', + description: 'Displays the magnitude values of the spectrum.', + syntax: 'specdisp(wsig, iprd [, iwtflg])', + example: 'ksum specsum wsig, 1 ; sum the spec bins, and ksmooth\n if ksum < 2000 kgoto zero ; if sufficient amplitude\n koct specptrk wsig ; pitch-track the signal\n kgoto contin\nzero: \n koct = 0 ; else output zero\ncontin:', + parameters: [ + { + name: 'iprd', + description: 'the period, in seconds, of each new display.', + type: 'initialization' + }, + { + name: 'wsig', + description: 'the input spectrum.', + type: 'performance' + }, + ], + seeAlso: ['specsum'] +}, +{ + name: 'specfilt', + type: 'opcode', + category: 'Spectral Processing:Non-Standard', + description: 'Filters each channel of an input spectrum.', + syntax: 'wsig = specfilt(wsigin, ifhtim)', + example: 'wsig2 specdiff wsig1 ; sense onsets\n wsig3 specfilt wsig2, 2 ; absorb slowly\n specdisp wsig2, 0.1 ; & display both spectra\n specdisp wsig3, 0.1', + parameters: [ + { + name: 'ifhtim', + description: 'half-time constant.', + type: 'initialization' + }, + { + name: 'wsigin', + description: 'the input spectrum.', + type: 'performance' + }, + ], + seeAlso: ['specaddm', 'specdiff', 'spechist', 'specscal'] +}, +{ + name: 'spechist', + type: 'opcode', + category: 'Spectral Processing:Non-Standard', + description: 'Accumulates the values of successive spectral frames.', + syntax: 'wsig = spechist(wsigin)', + example: 'wsig2 specdiff wsig1 ; sense onsets\n wsig3 specfilt wsig2, 2 ; absorb slowly\n specdisp wsig2, 0.1 ; & display both spectra\n specdisp wsig3, 0.1', + parameters: [ + { + name: 'wsigin', + description: 'the input spectra.', + type: 'performance' + }, + ], + seeAlso: ['specaddm', 'specdiff', 'specfilt', 'specscal'] +}, +{ + name: 'specptrk', + type: 'opcode', + category: 'Spectral Processing:Non-Standard', + description: 'Estimates the pitch of the most prominent complex tone in the spectrum.', + syntax: 'koct, kamp = specptrk(wsig, kvar, ilo, ihi, istr, idbthresh, inptls, irolloff \\\n [, iodd] [, iconfs] [, interp] [, ifprd] [, iwtflg])', + example: 'a1, a2 ins ; read a stereo clarinet input\n krms rms a1, 20 ; find a monaural rms value\n kvar = 0.6 + krms/8000 ; & use to gate the pitch variance\n wsig spectrum a1, 0.01, 7, 24, 15, 0, 3 ; get a 7-oct spectrum, 24 bibs/oct\n specdisp wsig, 0.2 ; display this and now estimate\n ; the pch and amp\n koct, ka spectrk wsig, kvar, 7.0, 10, 9, 20, 4, 0.7, 1, 5, 1, 0.2\n aosc oscil ka * ka * 10, cpsoct(koct), 2 ; & generate \\ new tone with these\n koct = (koct < 7.0 ? 7.0 : koct) ; replace non pitch with low C\n display koct - 7.0, 0.25, 20 ; & display the pitch track\n display ka, 0.25, 20 ; plus the summed root mag\n outs a1, aosc ; output 1 original and 1 new track', + rates: ['k-rate'], + parameters: [ + { + name: 'ilo', + description: 'pitch range conditioners (low, high, and starting) expressed in decimal octave form.', + type: 'initialization' + }, + { + name: 'ihi', + description: 'pitch range conditioners (low, high, and starting) expressed in decimal octave form.', + type: 'initialization' + }, + { + name: 'istr', + description: 'pitch range conditioners (low, high, and starting) expressed in decimal octave form.', + type: 'initialization' + }, + { + name: 'idbthresh', + description: 'energy threshold (in decibels) for pitch tracking to occur. Once begun, tracking will be continuous until the energy falls below one half the threshold (6 dB down), whence the _koct_ and _kamp_ outputs will be zero until the full threshold is again surpassed. _idbthresh_ is a guiding value. At initialization it is first converted to the _idbout_ mode of the source spectrum (and the 6 dB down point becomes .5, .25, or 1/root 2 for modes 0, 2 and 3). The values are also further scaled to allow for the weighted partial summation used during correlation.The actual thresholding is done using the internal weighted and summed _kamp_ value that is visible as the second output parameter.', + type: 'initialization' + }, + { + name: 'inptls', + description: 'number of harmonic partials used as a matching template in the spectrally-based pitch detection, and an amplitude rolloff for the set expressed as some fraction per octave (linear, so don\'t roll off to negative). Since the partials and rolloff fraction can affect the pitch following, some experimentation will be useful: try 4 or 5 partials with .6 rolloff as an initial setting; raise to 10 or 12 partials with rolloff .75 for complex timbres like the bassoon (weak fundamental). Computation time is dependent on the number of partials sought. The maximum number is 16.', + type: 'initialization' + }, + { + name: 'irolloff', + description: 'number of harmonic partials used as a matching template in the spectrally-based pitch detection, and an amplitude rolloff for the set expressed as some fraction per octave (linear, so don\'t roll off to negative). Since the partials and rolloff fraction can affect the pitch following, some experimentation will be useful: try 4 or 5 partials with .6 rolloff as an initial setting; raise to 10 or 12 partials with rolloff .75 for complex timbres like the bassoon (weak fundamental). Computation time is dependent on the number of partials sought. The maximum number is 16.', + type: 'initialization' + }, + { + name: 'ilo', + description: '_ihi_ (decimal octave low and high pitch). _kvar_ can be dynamic, e.g. onset amp dependent. Pitch resolution uses the originating _spectrum_ _ifrqs_ bins/octave, with further parabolic interpolation between adjacent bins. Settings of root magnitude, _ifrqs_ = 24, _iq_ = 15 should capture all the inflections of interest. Between frames, the output is either repeated or interpolated at the k-rate. (See [spectrum](../opcodes/spectrum.md).)', + type: 'performance' + }, + ], +}, +{ + name: 'specscal', + type: 'opcode', + category: 'Spectral Processing:Non-Standard', + description: 'Scales an input spectral datablock with spectral envelopes.', + syntax: 'wsig = specscal(wsigin, ifscale, ifthresh)', + example: 'wsig2 specdiff wsig1 ; sense onsets\n wsig3 specfilt wsig2, 2 ; absorb slowly\n specdisp wsig2, 0.1 ; & display both spectra\n specdisp wsig3, 0.1', + parameters: [ + { + name: 'ifscale', + description: 'scale function table. A function table containing values by which a value\'s magnitude is rescaled.', + type: 'initialization' + }, + { + name: 'ifthresh', + description: 'threshold function table. If _ifthresh_ is non-zero, each magnitude is reduced by its corresponding table-value (to not less than zero)', + type: 'initialization' + }, + { + name: 'wsig', + description: 'the output spectrum', + type: 'performance' + }, + { + name: 'wsigin', + description: 'the input spectra', + type: 'performance' + }, + ], + seeAlso: ['specaddm', 'specdiff', 'specfilt', 'spechist'] +}, +{ + name: 'specsum', + type: 'opcode', + category: 'Spectral Processing:Non-Standard', + description: 'Sums the magnitudes across all channels of the spectrum.', + syntax: 'ksum = specsum(wsig [, interp])', + example: 'ksum specsum wsig, 1 ; sum the spec bins, and ksmooth\n if ksum < 2000 kgoto zero ; if sufficient amplitude\n koct specptrk wsig ; pitch-track the signal\n kgoto contin\nzero: \n koct = 0 ; else output zero\ncontin:', + parameters: [ + { + name: 'ksum', + description: 'the output signal.', + type: 'performance' + }, + { + name: 'wsig', + description: 'the input spectrum.', + type: 'performance' + }, + ], + seeAlso: ['specdisp'] +}, +{ + name: 'spectrum', + type: 'opcode', + category: 'Spectral Processing:Non-Standard', + description: 'Generate a constant-Q, exponentially-spaced DFT across all octaves of a multiply-downsampled control or audio input signal.', + syntax: 'wsig = spectrum(xsig, iprd, iocts, ifrqa [, iq] [, ihann] [, idbout] \\\n [, idsprd] [, idsinrs])', + example: 'asig in ; get external audio\nwsig spectrum asig, 0.02, 6, 12, 33, 0, 1, 1 ; downsample in 6 octs & calc a 72 pt dft\n ; (Q 33, dB out) every 20 msecs', +}, +] diff --git a/src/lib/csound-reference/spectral-processing-other.ts b/src/lib/csound-reference/spectral-processing-other.ts new file mode 100644 index 0000000..7e0809b --- /dev/null +++ b/src/lib/csound-reference/spectral-processing-other.ts @@ -0,0 +1,230 @@ +import type { CsoundReference } from './types' + +// Spectral Processing:Other +export const spectralProcessingOther: CsoundReference[] = [ +{ + name: 'centroid', + type: 'opcode', + category: 'Spectral Processing:Other', + description: 'Calculate the spectral centroid of an audio signal on a given trigger.', + syntax: 'kcent = centroid(asig, ktrig, ifftsize)', + example: '--8<-- "examples/centroid-modern.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'ifftsize', + description: 'fftsize. Non pow-of-two values are converted to the next pow-of-two not smaller than ifftsize.', + type: 'initialization' + }, + { + name: 'kcent', + description: 'the spectral centroid in Hz', + type: 'performance' + }, + { + name: 'asig', + description: 'an input audio signal', + type: 'performance' + }, + { + name: 'ktrig', + description: '1 to calculate a new centroid, 0 to skip the process (and output previous value).', + type: 'performance' + }, + ], + seeAlso: ['Sensing and Control: Tempo and Pitch estimation'] +}, +{ + name: 'filescal', + type: 'opcode', + category: 'Spectral Processing:Other', + description: 'Phase-locked vocoder processing with onset detection/processing, \'tempo-scaling\'.', + syntax: 'asig [,asig2] = filescal(ktimescal, kamp, kpitch, Sfile, klock \\\n [,ifftsize, idecim, ithresh])', + example: '--8<-- "examples/filescal.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'Sfile', + description: 'source soundfile, mono or stereo files are allowed, but need to match the number of outputs.', + type: 'initialization' + }, + { + name: 'ifftsize', + description: 'FFT size (power-of-two), defaults to 2048.', + type: 'initialization' + }, + { + name: 'idecim', + description: 'decimation, defaults to 4 (meaning hopsize = fftsize/4)', + type: 'initialization' + }, + { + name: 'idbthresh', + description: 'threshold based on dB power spectrum ratio between two successive windows. A detected ratio above it will cancel timescaling momentarily, to avoid smearing (defaults to 1)', + type: 'initialization' + }, + { + name: 'ktimescal', + description: 'timescaling ratio, < 1 stretch, > 1 contract. Non-negative numbers only.', + type: 'performance' + }, + { + name: 'kamp', + description: 'amplitude scaling', + type: 'performance' + }, + { + name: 'kpitch', + description: 'grain pitch scaling (1=normal pitch, < 1 lower, > 1 higher; negative, backwards)', + type: 'performance' + }, + { + name: 'klock', + description: 'switchec phase-locking on (non-zero) or off (zero).', + type: 'performance' + }, + ], + seeAlso: ['Short-time Fourier Transform (STFT) Resynthesis'] +}, +{ + name: 'mincer', + type: 'opcode', + category: 'Spectral Processing:Other', + description: 'Phase-locked vocoder processing.', + syntax: 'asig = mincer(atimpt, kamp, kpitch, ktab, klock [ ,ifftsize, idecim])', + example: '--8<-- "examples/mincer.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'ifftsize', + description: 'FFT size (power-of-two), defaults to 2048.', + type: 'initialization' + }, + { + name: 'idecim', + description: 'decimation, defaults to 4 (meaning hopsize = fftsize/4)', + type: 'initialization' + }, + { + name: 'atimpt', + description: 'time position of current audio sample in secs. Table reading wraps around the ends of the function table.', + type: 'performance' + }, + { + name: 'kamp', + description: 'amplitude scaling', + type: 'performance' + }, + { + name: 'kpitch', + description: 'grain pitch scaling (1=normal pitch, < 1 lower, > 1 higher; negative, backwards)', + type: 'performance' + }, + { + name: 'klock', + description: '0 or 1, to switch phase-locking on/off', + type: 'performance' + }, + { + name: 'ktab', + description: 'source signal function table. Deferred-allocation tables (see [GEN01](../scoregens/gen01.md)) are accepted, but the opcode expects a mono source. Tables can be switched at k-rate.', + type: 'performance' + }, + ], + seeAlso: ['Short-time Fourier Transform (STFT) Resynthesis'] +}, +{ + name: 'mp3scal', + type: 'opcode', + category: 'Spectral Processing:Other', + description: 'Phase-locked vocoder processing with onset detection/processing, \'tempo-scaling\'.', + syntax: 'asig, asig2, ktime = mp3scal(Sfile, ktimescal, kpitch, kamp \\\n [, iskip, ifftsize, idecim, ilock])\n )', + example: '--8<-- "examples/mp3scal.csd"', + rates: ['a-rate', 'k-rate'], + parameters: [ + { + name: 'Sfile', + description: 'source soundfile stereo mp3 files.', + type: 'initialization' + }, + { + name: 'ifftsize', + description: 'FFT size (power-of-two), defaults to 2048.', + type: 'initialization' + }, + { + name: 'idecim', + description: 'decimation, defaults to 4 (meaning hopsize = fftsize/4)', + type: 'initialization' + }, + { + name: 'iskip', + description: 'skiptime in seconds, defaults to 1.', + type: 'initialization' + }, + { + name: 'ilock', + description: '0 or 1, to switch phase-locking on/off, defaults to 1.', + type: 'initialization' + }, + { + name: 'ktimescal', + description: 'timescaling ratio, < 1 stretch, > 1 contract. Non-negative numbers only.', + type: 'performance' + }, + { + name: 'kamp', + description: 'amplitude scaling', + type: 'performance' + }, + { + name: 'kpitch', + description: 'grain pitch scaling (1=normal pitch, < 1 lower, > 1 higher)', + type: 'performance' + }, + { + name: 'ktime', + description: 'time stamp', + type: 'performance' + }, + { + name: 'asig', + description: 'stereo output signals', + type: 'performance' + }, + { + name: 'asig2', + description: 'stereo output signals', + type: 'performance' + }, + ], + seeAlso: ['Short-time Fourier Transform (STFT) Resynthesis'] +}, +{ + name: 'paulstretch', + type: 'opcode', + category: 'Spectral Processing:Other', + description: 'Extreme time-stretching algorithm by Nasca Octavian Paul.', + syntax: 'asig = paulstretch(istretch, iwindowsize, ift)', + example: '--8<-- "examples/paulstretch.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'istretch', + description: 'Stretch factor.', + type: 'initialization' + }, + { + name: 'iwindowsize', + description: 'Window size, in seconds.', + type: 'initialization' + }, + { + name: 'ift', + description: 'source signal function table. Deferred-allocation tables (see [GEN01](../scoregens/gen01.md)) are accepted, but the opcode expects a mono source.', + type: 'initialization' + }, + ], + seeAlso: ['Special Effects'] +}, +] diff --git a/src/lib/csound-reference/spectral-processing-stft.ts b/src/lib/csound-reference/spectral-processing-stft.ts new file mode 100644 index 0000000..b6c9750 --- /dev/null +++ b/src/lib/csound-reference/spectral-processing-stft.ts @@ -0,0 +1,211 @@ +import type { CsoundReference } from './types' + +// Spectral Processing:STFT +export const spectralProcessingStft: CsoundReference[] = [ +{ + name: 'pvadd', + type: 'opcode', + category: 'Spectral Processing:STFT', + description: 'Reads from a _pvoc_ file and uses the data to perform additive synthesis.', + syntax: 'ares = pvadd(ktimpnt, kfmod, ifilcod, ifn, ibins [, ibinoffset] \\\n [, ibinincr] [, iextractmode] [, ifreqlim] [, igatefn])', + example: 'ktime line 0, p3, p3\nasig pvadd ktime, 1, “oboe.pvoc”, 1, 100, 2', + rates: ['a-rate', 'i-rate'], + parameters: [ + { + name: 'ifilcod', + description: 'integer or character-string denoting a control-file derived from [pvanal](../utility/pvanal.md) analysis of an audio signal. An integer denotes the suffix of a file _pvoc.m_; a character-string (in double quotes) gives a filename, optionally a full pathname. If not fullpath, the file is sought first in the current directory, then in the one given by the environment variable [SADIR](../invoke/environment-variables.md) (if defined). _pvoc_ control files contain data organized for fft resynthesis. Memory usage depends on the size of the files involved, which are read and held entirely in memory during computation but are shared by multiple calls (see also [lpread](../opcodes/lpread.md)).', + type: 'initialization' + }, + { + name: 'ifn', + description: 'table number of a stored function containing a sine wave.', + type: 'initialization' + }, + { + name: 'ibins', + description: 'number of bins that will be used in the resynthesis (each bin counts as one oscillator in the re-synthesis)', + type: 'initialization' + }, + ], + seeAlso: ['Short-time Fourier Transform (STFT) Resynthesis'] +}, +{ + name: 'pvbufread', + type: 'opcode', + category: 'Spectral Processing:STFT', + description: 'Reads from a phase vocoder analysis file and makes the retrieved data available.', + syntax: 'pvbufread(ktimpnt, ifile)', + example: 'ktime1 line 0, p3, 3.5 ; used as index in the "oboe.pvoc" file\nktime2 line 0, p3, 4.5 ; used as index in the "clar.pvoc" file\nkinterp linseg 1, p3*0.15, 1, p3*0.35, 0, p3*0.25, 0, p3*0.15, 1, p3*0.1, 1\n pvbufread ktime1, "oboe.pvoc"\napv pvinterp ktime2,1,"clar.pvoc", 1, 1.065, 1, 0.75, 1-kinterp, 1-kinterp', + parameters: [ + { + name: 'ifile', + description: 'the _pvoc_ number (n in pvoc.n) or the name in quotes of the analysis file made using _pvanal_. (See [pvoc](../opcodes/pvoc.md).)', + type: 'initialization' + }, + { + name: 'ktimpnt', + description: 'the passage of time, in seconds, through this file. _ktimpnt_ must always be positive, but can move forwards or backwards in time, be stationary or discontinuous, as a pointer into the analysis file.', + type: 'performance' + }, + ], + seeAlso: ['Short-time Fourier Transform (STFT) Resynthesis'] +}, +{ + name: 'pvcross', + type: 'opcode', + category: 'Spectral Processing:STFT', + description: 'Applies the amplitudes from one phase vocoder analysis file to the data from a second file and then performs the resynthesis.', + syntax: 'ares = pvcross(ktimpnt, kfmod, ifile, kampscale1, kampscale2 [, ispecwp])', + example: 'ktime1 line 0, p3, 3.5 ; used as index in the "oboe.pvoc" file\nktime2 line 0, p3, 4.5 ; used as index in the "clar.pvoc" file\nkcross expon 0.001, p3, 1\n pvbufread ktime1, "oboe.pvoc"\napv pvcross ktime2, 1, "clar.pvoc", 1-kcross, kcross', + rates: ['a-rate'], + parameters: [ + { + name: 'ifile', + description: 'the _pvoc_ number (n in pvoc.n) or the name in quotes of the analysis file made using _pvanal_. (See [pvoc](../opcodes/pvoc.md).)', + type: 'initialization' + }, + { + name: 'ktimpnt', + description: 'the passage of time, in seconds, through this file. _ktimpnt_ must always be positive, but can move forwards or backwards in time, be stationary or discontinuous, as a pointer into the analysis file.', + type: 'performance' + }, + { + name: 'kfmod', + description: 'a control-rate transposition factor: a value of 1 incurs no transposition, 1.5 transposes up a perfect fifth, and 0.5 down an octave.', + type: 'performance' + }, + { + name: 'kampscale1', + description: 'used to scale the amplitudes stored in each frame of the phase vocoder analysis file. _kampscale1_ scale the amplitudes of the data from the file read by the previously called _pvbufread_. _kampscale2_ scale the amplitudes of the file named by _ifile_.', + type: 'performance' + }, + { + name: 'kampscale2', + description: 'used to scale the amplitudes stored in each frame of the phase vocoder analysis file. _kampscale1_ scale the amplitudes of the data from the file read by the previously called _pvbufread_. _kampscale2_ scale the amplitudes of the file named by _ifile_.', + type: 'performance' + }, + ], + seeAlso: ['Short-time Fourier Transform (STFT) Resynthesis'] +}, +{ + name: 'pvinterp', + type: 'opcode', + category: 'Spectral Processing:STFT', + description: 'Interpolates between the amplitudes and frequencies of two phase vocoder analysis files.', + syntax: 'ares = pvinterp(ktimpnt, kfmod, ifile, kfreqscale1, kfreqscale2, \\\n kampscale1, kampscale2, kfreqinterp, kampinterp)', + example: 'ktime1 line 0, p3, 3.5 ; used as index in the "oboe.pvoc" file\nktime2 line 0, p3, 4.5 ; used as index in the "clar.pvoc" file\nkinterp linseg 1, p3*0.15, 1, p3*0.35, 0, p3*0.25, 0, p3*0.15, 1, p3*0.1, 1\n pvbufread ktime1, "oboe.pvoc"\napv pvinterp ktime2,1,"clar.pvoc", 1, 1.065, 1, 0.75, 1-kinterp, 1-kinterp', + rates: ['a-rate'], + parameters: [ + { + name: 'ifile', + description: 'the _pvoc_ number (n in pvoc.n) or the name in quotes of the analysis file made using pvanal. (See [pvoc](../opcodes/pvoc.md).)', + type: 'initialization' + }, + { + name: 'ktimpnt', + description: 'the passage of time, in seconds, through this file. _ktimpnt_ must always be positive, but can move forwards or backwards in time, be stationary or discontinuous, as a pointer into the analysis file.', + type: 'performance' + }, + { + name: 'kfmod', + description: 'a control-rate transposition factor: a value of 1 incurs no transposition, 1.5 transposes up a perfect fifth, and .5 down an octave.', + type: 'performance' + }, + { + name: 'kfreqscale1', + description: 'used in _pvinterp_ to scale the frequencies and amplitudes stored in each frame of the phase vocoder analysis file. _kfreqscale1_ and _kampscale1_ scale the frequencies and amplitudes of the data from the file read by the previously called [pvbufread](../opcodes/pvbufread.md) (this data is passed internally to the _pvinterp_ unit). _kfreqscale2_ and _kampscale2_ scale the frequencies and amplitudes of the file named by _ifile_ in the _pvinterp_ argument list and read within the _pvinterp_ unit.', + type: 'performance' + }, + { + name: 'kfreqscale2', + description: 'used in _pvinterp_ to scale the frequencies and amplitudes stored in each frame of the phase vocoder analysis file. _kfreqscale1_ and _kampscale1_ scale the frequencies and amplitudes of the data from the file read by the previously called [pvbufread](../opcodes/pvbufread.md) (this data is passed internally to the _pvinterp_ unit). _kfreqscale2_ and _kampscale2_ scale the frequencies and amplitudes of the file named by _ifile_ in the _pvinterp_ argument list and read within the _pvinterp_ unit.', + type: 'performance' + }, + { + name: 'kampscale1', + description: 'used in _pvinterp_ to scale the frequencies and amplitudes stored in each frame of the phase vocoder analysis file. _kfreqscale1_ and _kampscale1_ scale the frequencies and amplitudes of the data from the file read by the previously called [pvbufread](../opcodes/pvbufread.md) (this data is passed internally to the _pvinterp_ unit). _kfreqscale2_ and _kampscale2_ scale the frequencies and amplitudes of the file named by _ifile_ in the _pvinterp_ argument list and read within the _pvinterp_ unit.', + type: 'performance' + }, + { + name: 'kampscale2', + description: 'used in _pvinterp_ to scale the frequencies and amplitudes stored in each frame of the phase vocoder analysis file. _kfreqscale1_ and _kampscale1_ scale the frequencies and amplitudes of the data from the file read by the previously called [pvbufread](../opcodes/pvbufread.md) (this data is passed internally to the _pvinterp_ unit). _kfreqscale2_ and _kampscale2_ scale the frequencies and amplitudes of the file named by _ifile_ in the _pvinterp_ argument list and read within the _pvinterp_ unit.', + type: 'performance' + }, + { + name: 'kfreqinterp', + description: 'used in _pvinterp_, determine the interpolation distance between the values of one phase vocoder file and the values of a second file. When the value of _kfreqinterp_ is 1, the frequency values will be entirely those from the first file (read by the _pvbufread_), post scaling by the _kfreqscale1_ argument. When the value of _kfreqinterp_ is 0 the frequency values will be those of the second file (read by the _pvinterp_ unit itself), post scaling by _kfreqscale2_. When _kfreqinterp_ is between 0 and 1 the frequency values will be calculated, on a bin, by bin basis, as the percentage between each pair of frequencies (in other words, _kfreqinterp_=0.5 will cause the frequencies values to be half way between the values in the set of data from the first file and the set of data from the second file).', + type: 'performance' + }, + { + name: 'kampinterp', + description: 'used in _pvinterp_, determine the interpolation distance between the values of one phase vocoder file and the values of a second file. When the value of _kfreqinterp_ is 1, the frequency values will be entirely those from the first file (read by the _pvbufread_), post scaling by the _kfreqscale1_ argument. When the value of _kfreqinterp_ is 0 the frequency values will be those of the second file (read by the _pvinterp_ unit itself), post scaling by _kfreqscale2_. When _kfreqinterp_ is between 0 and 1 the frequency values will be calculated, on a bin, by bin basis, as the percentage between each pair of frequencies (in other words, _kfreqinterp_=0.5 will cause the frequencies values to be half way between the values in the set of data from the first file and the set of data from the second file).', + type: 'performance' + }, + ], + seeAlso: ['Short-time Fourier Transform (STFT) Resynthesis'] +}, +{ + name: 'pvoc', + type: 'opcode', + category: 'Spectral Processing:STFT', + description: 'Implements signal reconstruction using an fft-based phase vocoder.', + syntax: 'ares = pvoc(ktimpnt, kfmod, ifilcod [, ispecwp] [, iextractmode] \\\n [, ifreqlim] [, igatefn])', + example: '--8<-- "examples/pvoc.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'ifilcod', + description: 'integer or character-string denoting a control-file derived from analysis of an audio signal. An integer denotes the suffix of a file _pvoc.m_; a character-string (in double quotes) gives a filename, optionally a full pathname. If not fullpath, the file is sought first in the current directory, then in the one given by the environment variable [SADIR](../invoke/environment-variables.md) (if defined). _pvoc_ control contains breakpoint amplitude and frequency envelope values organized for fft resynthesis. Memory usage depends on the size of the files involved, which are read and held entirely in memory during computation but are shared by multiple calls (see also [lpread](../opcodes/lpread.md)).', + type: 'initialization' + }, + { + name: 'ktimpnt', + description: 'The passage of time, in seconds, through the analysis file. _ktimpnt_ must always be positive, but can move forwards or backwards in time, be stationary or discontinuous, as a pointer into the analysis file.', + type: 'performance' + }, + { + name: 'kfmod', + description: 'a control-rate transposition factor: a value of 1 incurs no transposition, 1.5 transposes up a perfect fifth, and .5 down an octave.', + type: 'performance' + }, + ], + seeAlso: ['Short-time Fourier Transform (STFT) Resynthesis'] +}, +{ + name: 'pvread', + type: 'opcode', + category: 'Spectral Processing:STFT', + description: 'Reads from a [pvoc](../opcodes/pvoc.md) file and returns the frequency and amplitude from a single analysis channel or bin.', + syntax: 'kfreq, kamp = pvread(ktimpnt, ifile, ibin)', + example: '--8<-- "examples/pvread.csd"', + rates: ['k-rate'], + parameters: [ + { + name: 'ifile', + description: 'the _pvoc_ number (n in pvoc.n) or the name in quotes of the analysis file made using _pvanal_. (See [pvoc](../opcodes/pvoc.md).)', + type: 'initialization' + }, + { + name: 'ibin', + description: 'the number of the analysis channel from which to return frequency in Hz and magnitude.', + type: 'initialization' + }, + { + name: 'kfreq', + description: 'outputs of the _pvread_ unit. These values, retrieved from a phase vocoder analysis file, represent the values of frequency and amplitude from a single analysis channel specified in the _ibin_ argument. Interpolation between analysis frames is performed at k-rate resolution and dependent of course upon the rate and direction of _ktimpnt_.', + type: 'performance' + }, + { + name: 'kamp', + description: 'outputs of the _pvread_ unit. These values, retrieved from a phase vocoder analysis file, represent the values of frequency and amplitude from a single analysis channel specified in the _ibin_ argument. Interpolation between analysis frames is performed at k-rate resolution and dependent of course upon the rate and direction of _ktimpnt_.', + type: 'performance' + }, + { + name: 'ktimpnt', + description: 'the passage of time, in seconds, through this file. _ktimpnt_ must always be positive, but can move forwards or backwards in time, be stationary or discontinuous, as a pointer into the analysis file.', + type: 'performance' + }, + ], + seeAlso: ['Short-time Fourier Transform (STFT) Resynthesis'] +}, +] diff --git a/src/lib/csound-reference/spectral-processing-streaming.ts b/src/lib/csound-reference/spectral-processing-streaming.ts new file mode 100644 index 0000000..e5bf8cb --- /dev/null +++ b/src/lib/csound-reference/spectral-processing-streaming.ts @@ -0,0 +1,1569 @@ +import type { CsoundReference } from './types' + +// Spectral Processing:Streaming +export const spectralProcessingStreaming: CsoundReference[] = [ +{ + name: 'binit', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'PVS tracks to amplitude+frequency conversion.', + syntax: 'fsig = binit(fin, isize)', + example: '--8<-- "examples/binit-modern.csd"', + parameters: [ + { + name: 'fsig', + description: 'output pv stream in PVS_AMP_FREQ format', + type: 'performance' + }, + { + name: 'fin', + description: 'input pv stream in TRACKS format', + type: 'performance' + }, + { + name: 'isize', + description: 'FFT size of output (N).', + type: 'performance' + }, + ], + seeAlso: ['Tools for Real-time Spectral Processing (pvs opcodes)'] +}, +{ + name: 'part2txt', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'Write a text file containing partial tracks data.', + syntax: 'part2txt(SFile, ftrks)', + example: '--8<-- "examples/part2txt.csd"', + parameters: [ + { + name: 'SFile', + description: 'output filename', + type: 'initialization' + }, + { + name: 'ftrks', + description: 'output pv stream in TRACKS format', + type: 'performance' + }, + ], + seeAlso: ['Tools for Real-time Spectral Processing (pvs opcodes)'] +}, +{ + name: 'partials', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'Partial track spectral analysis.', + syntax: 'ftrks = partials(ffr, fphs, kthresh, kminpts, kmaxgap, imaxtracks)', + example: '--8<-- "examples/partials.csd"', + parameters: [ + { + name: 'ftrks', + description: 'output pv stream in TRACKS format', + type: 'performance' + }, + { + name: 'ffr', + description: 'input pv stream in AMP_FREQ format', + type: 'performance' + }, + { + name: 'fphs', + description: 'input pv stream in AMP_PHASE format', + type: 'performance' + }, + { + name: 'kthresh', + description: 'analysis threshold factor, defined between -1 and 1. If non-negative, the analysis threshold is taken to be relative to the maximum magnitude in each analysis frame (kthresh * max_magnitude). If negative, the absolute threshold value is relative to 0dbfs (kthresh * 0dbfs). Tracks below this threshold will be discarded.', + type: 'performance' + }, + { + name: 'kminpoints', + description: 'minimum number of time points for a detected peak to make a track (1 is the minimum). Since this opcode works with streaming signals, larger numbers will increase the delay between input and output, as we have to wait for the required minimum number of points.', + type: 'performance' + }, + { + name: 'kmaxgap', + description: 'maximum gap between time-points for track continuation (> 0). Tracks that have no continuation after kmaxgap will be discarded.', + type: 'performance' + }, + { + name: 'imaxtracks', + description: 'maximum number of analysis tracks (number of bins >= imaxtracks)', + type: 'performance' + }, + ], + seeAlso: ['Tools for Real-time Spectral Processing (pvs opcodes)'] +}, +{ + name: 'pvs2array', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'Same as the [pvs2tab](../opcodes/pvs2tab.md) opcode.', + syntax: 'kframe = pvs2array(kvar[], fsig)\n kframe = pvs2array(kmags[], kfreqs[], fsig)', +}, +{ + name: 'pvs2tab', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'Copies spectral data to k-rate arrays (or t-variables). Also known as [pvs2array](pvs2array.md).', + syntax: 'kframe = pvs2tab(tvar|kvar[], fsig)\n kframe = pvs2tab(kmags[], kfreqs[], fsig)', + example: 'karr[] init 1026\na1 inch 1\nfsig1 pvsanal a1, 1024,256,1024, 1\nkframe pvs2tab karr, fsig1', + parameters: [ + { + name: 'kframe', + description: 'current copied frame number. It can be used to detect when a new frame has been copied.', + type: 'performance' + }, + { + name: 'fsig', + description: 'input fsig to be copied.', + type: 'performance' + }, + ], + seeAlso: ['Tools for Real-time Spectral Processing (pvs opcodes)', 'Array-based spectral opcodes'] +}, +{ + name: 'pvsadsyn', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'Resynthesize using a fast oscillator-bank.', + syntax: 'ares = pvsadsyn(fsrc, inoscs, kfmod [, ibinoffset] [, ibinincr] [, iinit])', + example: '--8<-- "examples/pvsadsyn.csd"', + rates: ['a-rate'], + parameters: [ + { + name: 'inoscs', + description: 'The number of analysis bins to synthesise. Cannot be larger than the size of fsrc (see [pvsinfo](../opcodes/pvsinfo.md)), e.g. as created by [pvsanal](../opcodes/pvsanal.md). Processing time is directly proportional to inoscs.', + type: 'initialization' + }, + { + name: 'kfmod', + description: 'Scale all frequencies by factor kfmod. 1.0 = no change, 2 = up one octave.', + type: 'performance' + }, + ], + seeAlso: ['Tools for Real-time Spectral Processing (pvs opcodes)'] +}, +{ + name: 'pvsanal', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'Generate an fsig from a mono audio source ain, using phase vocoder overlap-add analysis.', + syntax: 'fsig = pvsanal(ain, ifftsize, ioverlap, iwinsize, iwintype [, iformat] [, iinit])', + example: '--8<-- "examples/pvsanal.csd"', + parameters: [ + { + name: 'ifftsize', + description: 'The FFT size in samples. Need not be a power of two (though these are especially efficient), but must be even. Odd numbers are rounded up internally. _ifftsize_ determines the number of analysis bins in _fsig_, as _ifftsize/2 + 1_. For example, where _ifftsize_ = 1024, _fsig_ will contain 513 analysis bins, ordered linearly from the fundamental to Nyquist. The fundamental of analysis (which in principle gives the lowest resolvable frequency) is determined as _sr/ifftsize_. Thus, for the example just given and assuming _sr_ = 44100, the fundamental of analysis is 43.07Hz. In practice, due to the phase-preserving nature of the phase vocoder, the frequency of any bin can deviate bilaterally, so that DC components are recorded. Given a strongly pitched signal, frequencies in adjacent bins can bunch very closely together, around partials in the source, and the lowest bins may even have negative frequencies.', + type: 'initialization' + }, + { + name: 'ioverlap', + description: 'The distance in samples (“hop size”) between overlapping analysis frames. As a rule, this needs to be at least _ifftsize/4_, e.g. 256 for the example above. _ioverlap_ determines the underlying analysis rate, as _sr/ioverlap_. _ioverlap_ does not require to be a simple factor of _ifftsize_; for example a value of 160 would be legal. The choice of _ioverlap_ may be dictated by the degree of pitch modification applied to the _fsig_, if any. As a rule of thumb, the more extreme the pitch shift, the higher the analysis rate needs to be, and hence the smaller the value for _ioverlap_. A higher analysis rate can also be advantageous with broadband transient sounds, such as drums (where a small analysis window gives less smearing, but more frequency-related errors).', + type: 'initialization' + }, + { + name: 'iwinsize', + description: 'The size in samples of the analysis window filter (as set by _iwintype_). This must be at least _ifftsize_, and can usefully be larger. Though other proportions are permitted, it is recommended that _iwinsize_ always be an integral multiple of _ifftsize_, e.g. 2048 for the example above. Internally, the analysis window (Hamming, von Hann) is multiplied by a sinc function, so that amplitudes are zero at the boundaries between frames. The larger analysis window size has been found to be especially important for oscillator bank resynthesis (e.g. using _pvsadsyn_), as it has the effect of increasing the frequency resolution of the analysis, and hence the accuracy of the resynthesis. As noted above, _iwinsize_ determines the overall latency of the analysis/resynthesis system. In many cases, and especially in the absence of pitch modifications, it will be found that setting _iwinsize=ifftsize_ works very well, and offers the lowest latency.', + type: 'initialization' + }, + { + name: 'iwintype', + description: 'The shape of the analysis window. Currently three choices computed windows implemented:', + type: 'initialization' + }, + { + name: 'iformat', + description: '(optional) The analysis format. Currently only one format is implemented by this opcode:', + type: 'initialization' + }, + { + name: 'iinit', + description: '(optional) Skip reinitialization. This is not currently implemented for any of these opcodes, and it remains to be seen if it is even practical.', + type: 'initialization' + }, + ], + seeAlso: ['Tools for Real-time Spectral Processing (pvs opcodes)'] +}, +{ + name: 'pvsarp', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'Arpeggiate the spectral components of a streaming pv signal.', + syntax: 'fsig = pvsarp(fsigin, kbin, kdepth, kgain)', + example: '--8<-- "examples/pvsarp.csd"', + parameters: [ + { + name: 'fsig', + description: 'output pv stream', + type: 'performance' + }, + { + name: 'fsigin', + description: 'input pv stream', + type: 'performance' + }, + { + name: 'kbin', + description: 'target bin, normalised 0 - 1 (0Hz - Nyquist).', + type: 'performance' + }, + { + name: 'kdepth', + description: 'depth of attenuation of surrounding bins', + type: 'performance' + }, + { + name: 'kgain', + description: 'gain boost applied to target bin', + type: 'performance' + }, + ], + seeAlso: ['Tools for Real-time Spectral Processing (pvs opcodes)'] +}, +{ + name: 'pvsbandp', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'A band pass filter working in the spectral domain.', + syntax: 'fsig = pvsbandp(fsigin, xlowcut, xlowfull, xhighfull, xhighcut [, ktype])', + example: '--8<-- "examples/pvsbandp.csd"', + parameters: [ + { + name: 'fsig', + description: 'output pv stream', + type: 'performance' + }, + { + name: 'fsigin', + description: 'input pv stream.', + type: 'performance' + }, + { + name: 'xlowcut', + description: 'define a trapezium shape for the band that is passed. The a-rate versions only apply to the sliding case.', + type: 'performance' + }, + { + name: 'xlowfull', + description: 'define a trapezium shape for the band that is passed. The a-rate versions only apply to the sliding case.', + type: 'performance' + }, + { + name: 'xhighfull', + description: 'define a trapezium shape for the band that is passed. The a-rate versions only apply to the sliding case.', + type: 'performance' + }, + { + name: 'xhighcut', + description: 'define a trapezium shape for the band that is passed. The a-rate versions only apply to the sliding case.', + type: 'performance' + }, + { + name: 'ktype', + description: 'specifies the shape of the transitional band. If at the default value of zero the shape is as below, with linear transition in amplitude. Other values yield and exponential shape:', + type: 'performance' + }, + ], + seeAlso: ['Tools for Real-time Spectral Processing (pvs opcodes)'] +}, +{ + name: 'pvsbandr', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'A band reject filter working in the spectral domain.', + syntax: 'fsig = pvsbandr(fsigin, xlowcut, xlowfull, xhighfull, xhighcut [, ktype])', + example: '--8<-- "examples/pvsbandr.csd"', + parameters: [ + { + name: 'fsig', + description: 'output pv stream', + type: 'performance' + }, + { + name: 'fsigin', + description: 'input pv stream.', + type: 'performance' + }, + { + name: 'xlowcut', + description: 'define a trapezium shape for the band that is rejected. The a-rate versions only apply to the sliding case.', + type: 'performance' + }, + { + name: 'xlowfull', + description: 'define a trapezium shape for the band that is rejected. The a-rate versions only apply to the sliding case.', + type: 'performance' + }, + { + name: 'xhighfull', + description: 'define a trapezium shape for the band that is rejected. The a-rate versions only apply to the sliding case.', + type: 'performance' + }, + { + name: 'xhighcut', + description: 'define a trapezium shape for the band that is rejected. The a-rate versions only apply to the sliding case.', + type: 'performance' + }, + { + name: 'ktype', + description: 'specifies the shape of the transitional band. If at the default value of zero the shape is as below, with linear transition in amplitude. Other values give an exponential curve', + type: 'performance' + }, + ], + seeAlso: ['Tools for Real-time Spectral Processing (pvs opcodes)'] +}, +{ + name: 'pvsbandwidth', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'Calculate the spectral bandwidth of a signal from its discrete Fourier transform.', + syntax: 'kbnd = pvsbandwidth(fsig)', + example: '--8<-- "examples/pvsbandwidth.csd"', + parameters: [ + { + name: 'kbnd', + description: 'the spectral bandwidth', + type: 'performance' + }, + { + name: 'fsig', + description: 'an input pv stream', + type: 'performance' + }, + ], + seeAlso: ['Tools for Real-time Spectral Processing (pvs opcodes)'] +}, +{ + name: 'pvsbin', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'Obtain the amp and freq values off a PVS signal bin as k-rate variables.', + syntax: 'kamp, kfr = pvsbin(fsig, kbin)', + example: '--8<-- "examples/pvsbin.csd"', + rates: ['k-rate'], + parameters: [ + { + name: 'kamp', + description: 'bin amplitude', + type: 'performance' + }, + { + name: 'kfr', + description: 'bin frequency', + type: 'performance' + }, + { + name: 'fsig', + description: 'an input pv stream', + type: 'performance' + }, + { + name: 'kbin', + description: 'bin number', + type: 'performance' + }, + ], + seeAlso: ['Tools for Real-time Spectral Processing (pvs opcodes)'] +}, +{ + name: 'pvsblur', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'Average the amp/freq time functions of each analysis channel for a specified time (truncated to number of frames).', + syntax: 'fsig = pvsblur(fsigin, kblurtime, imaxdel)', + example: '--8<-- "examples/pvsblur.csd"', + parameters: [ + { + name: 'fsig', + description: 'output pv stream', + type: 'performance' + }, + { + name: 'fsigin', + description: 'input pv stream.', + type: 'performance' + }, + { + name: 'kblurtime', + description: 'time in secs during which windows will be averaged .', + type: 'performance' + }, + { + name: 'imaxdel', + description: 'maximum delay time, used for allocating memory used in the averaging operation.', + type: 'performance' + }, + ], + seeAlso: ['Tools for Real-time Spectral Processing (pvs opcodes)'] +}, +{ + name: 'pvsbuffer', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'This opcode creates and writes to a circular buffer for f-signals (streaming PV signals).', + syntax: 'ihandle, ktime = pvsbuffer(fsig, ilen)', + example: '--8<-- "examples/pvsbuffer.csd"', + parameters: [ + { + name: 'fsig', + description: 'an input pv stream', + type: 'performance' + }, + { + name: 'ktime', + description: 'the current time of writing in the buffer', + type: 'performance' + }, + ], + seeAlso: ['Tools for Real-time Spectral Processing (pvs opcodes)'] +}, +{ + name: 'pvsbufread', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'This opcode reads a circular buffer of f-signals (streaming PV signals).', + syntax: 'fsig = pvsbufread(ktime, khandle [, ilo, ihi, iclear])', + example: 'fsig1 pvsanal asig1, 1024, 256, 1024, 1\nfsig2 pvsanal asig2, 1024, 256, 1024, 1\n\n\nibuf1, kt1 pvsbuffer fsig1, 10 ; 10-sec buf with fsig1\nibuf2, kt2 pvsbuffer fsig2, 7 ; 7-sec buf with fsig2\n\nkhan init ibuf1 ; initialise handle to buf1\n\nif ktrig > 0 then ; switch buffers according to trigger\nkhan = ibuf2\nelse\nkhan = ibuf1\nendif\n\nfsb pvsbufread kt1, khan ; read buffer', + parameters: [ + { + name: 'fsig', + description: 'output pv stream', + type: 'performance' + }, + { + name: 'ktime', + description: 'time position of reading pointer (in secs).', + type: 'performance' + }, + { + name: 'khandle', + description: 'handle identifying the buffer to be read. When using k-rate handles, it is important to initialise the k-rate variable to a given existing handle. When changing buffers, fsig buffers need to be compatible (same fsig format).', + type: 'performance' + }, + ], + seeAlso: ['Tools for Real-time Spectral Processing (pvs opcodes)'] +}, +{ + name: 'pvsbufread2', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'This opcode reads a circular buffer of f-signals (streaming PV signals), with binwise additional delays.', + syntax: 'fsig = pvsbufread2(ktime, khandle, ift1, ift2)', + example: '--8<-- "examples/pvsbufread2.csd"', + parameters: [ + { + name: 'ift1', + description: 'function table with at least fftisze/2+1 points where delays (in secs) for bin amplitudes are set (function table positions are equivalent to bin numbers)', + type: 'initialization' + }, + { + name: 'ift2', + description: 'function table with at least fftisze/2+1 points where delays (in secs) for bin frequencies are set (function table positions are equivalent to bin numbers)', + type: 'initialization' + }, + { + name: 'fsig', + description: 'output pv stream', + type: 'performance' + }, + { + name: 'ktime', + description: 'time position of reading pointer (in secs).', + type: 'performance' + }, + { + name: 'khandle', + description: 'handle identifying the buffer to be read. When using k-rate handles, it is important to initialise the k-rate variable to a given existing handle. When changing buffers, fsig buffers need to be compatible (same fsig format).', + type: 'performance' + }, + ], + seeAlso: ['Tools for Real-time Spectral Processing (pvs opcodes)'] +}, +{ + name: 'pvscale', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'Scale the frequency components of a pv stream, resulting in pitch shift.', + syntax: 'fsig = pvscale(fsigin, kscal [, kkeepform, kgain, kcoefs])', + example: 'asig in ; get the signal in\n\nfsig pvsanal asig, 1024, 256, 1024, 1 ; analyse it\nftps pvscale fsig, 1.5, 1, 1 ; transpose it keeping formants\natps pvsynth ftps ; synthesise it\n\nadp delayr 0.1 ; delay original signal\nadel deltapn 1024 ; by 1024 samples\n delayw asig\n out atps + adel ; add tranposed and original', + parameters: [ + { + name: 'fsig', + description: 'output pv stream', + type: 'performance' + }, + { + name: 'fsigin', + description: 'input pv stream', + type: 'performance' + }, + { + name: 'kscal', + description: 'scaling ratio.', + type: 'performance' + }, + { + name: 'kkeepform', + description: 'attempt to keep input signal formants; 0: do not keep formants; 1: keep formants using a liftered cepstrum method; 2: keep formants by using a true envelope method (defaults to 0).', + type: 'performance' + }, + { + name: 'kgain', + description: 'amplitude scaling (defaults to 1).', + type: 'performance' + }, + { + name: 'kcoefs', + description: 'number of cepstrum coefs used in formant preservation (defaults to 80).', + type: 'performance' + }, + ], + seeAlso: ['Tools for Real-time Spectral Processing (pvs opcodes)'] +}, +{ + name: 'pvscent', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'Calculate the spectral centroid of a signal from its discrete Fourier transform.', + syntax: 'kcent = pvscent(fsig)\n acent = pvscent(fsig)', + example: '--8<-- "examples/pvscent.csd"', + parameters: [ + { + name: 'kcent', + description: 'the spectral centroid', + type: 'performance' + }, + { + name: 'acent', + description: 'the spectral centroid', + type: 'performance' + }, + { + name: 'fsig', + description: 'an input pv stream', + type: 'performance' + }, + ], + seeAlso: ['Tools for Real-time Spectral Processing (pvs opcodes)'] +}, +{ + name: 'pvsceps', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'Calculate the cepstrum of a pvs input, optionally liftering coefficients.', + syntax: 'keps[] = pvsceps(fsig[, icoefs])', + example: '--8<-- "examples/pvsceps.csd"', + parameters: [ + { + name: 'icoefs', + description: 'the number of retained coefficients in the cepstrum output. By default, no coefficients are liftered.', + type: 'initialization' + }, + { + name: 'fsig', + description: 'an input pv stream', + type: 'performance' + }, + ], + seeAlso: ['Tools for Real-time Spectral Processing (pvs opcodes)'] +}, +{ + name: 'pvscross', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'Performs cross-synthesis between two source fsigs.', + syntax: 'fsig = pvscross(fsrc, fdest, kamp1, kamp2)', + example: '--8<-- "examples/pvscross.csd"', + seeAlso: ['Tools for Real-time Spectral Processing (pvs opcodes)'] +}, +{ + name: 'pvsdemix', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'Spectral azimuth-based de-mixing of stereo sources, with a reverse-panning result.', + syntax: 'fsig = pvsdemix(fleft, fright, kpos, kwidth, ipoints)', + example: 'ifftsize = 1024 \niwtype = 1 /* cleaner with hanning window */\nipos = -0.8 /* to the left of the stereo image */\niwidth = 20 /* use peaks of 20 points around it */\n\nal,ar soundin "sinput.wav"\n\nflc pvsanal al, ifftsize, ifftsize/4, ifftsize, iwtype\nfrc pvsanal ar, ifftsize, ifftsize/4, ifftsize, iwtype\nfdm pvsdemix flc, frc, kpos, kwidth, 100\nadm pvsynth fdm\n \n outs adm, adm', + parameters: [ + { + name: 'fsig', + description: 'output pv stream', + type: 'performance' + }, + { + name: 'fleft', + description: 'left channel input pv stream.', + type: 'performance' + }, + { + name: 'fright', + description: 'right channel pv stream.', + type: 'performance' + }, + { + name: 'kpos', + description: 'the azimuth target centre position, which will be de-mixed, from left to right (-1 <= _kpos_ <= 1). This is the reverse pan-pot control.', + type: 'performance' + }, + { + name: 'kwidth', + description: 'the azimuth subspace width, which will determine the number of points around _kpos_ which will be used in the de-mixing process. (1 <= _kwidth_ <= _ipoints_)', + type: 'performance' + }, + { + name: 'ipoints', + description: 'total number of discrete points, which will divide each pan side of the stereo image. This ultimately affects the resolution of the process.', + type: 'performance' + }, + ], + seeAlso: ['Tools for Real-time Spectral Processing (pvs opcodes)'] +}, +{ + name: 'pvsdiskin', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'Create an fsig stream by reading a selected channel from a PVOC-EX analysis file, with frame interpolation.', + syntax: 'fsig = pvsdiskin(SFname, ktscal, kgain [, ioffset, ichan])', + example: '--8<-- "examples/pvsdiskin.csd"', + parameters: [ + { + name: 'Sfname', + description: 'Name of the analysis file. This must have the .pvx file extension.', + type: 'initialization' + }, + { + name: 'ichan', + description: '(optional) The channel to read (counting from 1). Default is 1.', + type: 'initialization' + }, + { + name: 'ioff', + description: 'start offset from beginning of file (secs) (default: 0) .', + type: 'initialization' + }, + { + name: 'ktscal', + description: 'time scale, ie. the read pointer speed (1 is normal speed, negative is backwards, 0 < ktscal < 1 is slower and ktscal > 1 is faster)', + type: 'performance' + }, + { + name: 'kgain', + description: 'gain scaling.', + type: 'performance' + }, + ], + seeAlso: ['Tools for Real-time Spectral Processing (pvs opcodes)'] +}, +{ + name: 'pvsdisp', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'Displays a PVS signal as an amplitude vs. freq graph.', + syntax: 'pvsdisp(fsig [, ibins, iwtflg])', + example: '--8<-- "examples/pvsdisp.csd"', + parameters: [ + { + name: 'pvsdisp', + description: 'displays the PVS signal frame-by-frame.', + type: 'performance' + }, + ], + seeAlso: ['Tools for Real-time Spectral Processing (pvs opcodes)'] +}, +{ + name: 'pvsfilter', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'Multiply amplitudes of a pvoc stream by those of a second pvoc stream, with dynamic scaling.', + syntax: 'fsig = pvsfilter(fsigin, fsigfil, kdepth [, igain])', + example: 'kfreq expon 500, p3, 4000 ; 3-octave sweep\nkdepth linseg 1, p3/2, 0.5, p3/2, 1 ; varying filter depth\n\nasig in ; input\nafil oscili 1, kfreq, 1 ; filter t-domain signal\n\nfim pvsanal asig,1024,256,1024,0 ; pvoc analysis\nfil pvsanal afil,1024,256,1024,0 \nfou pvsfilter fim, fil, kdepth ; filter signal\naout pvsynth fou ; pvoc synthesis', + parameters: [ + { + name: 'fsig', + description: 'output pv stream', + type: 'performance' + }, + { + name: 'fsigin', + description: 'input pv stream.', + type: 'performance' + }, + { + name: 'fsigfil', + description: 'filtering pvoc stream.', + type: 'performance' + }, + { + name: 'kdepth', + description: 'controls the depth of filtering of fsigin by fsigfil .', + type: 'performance' + }, + { + name: 'igain', + description: 'amplitude scaling (optional, defaults to 1).', + type: 'performance' + }, + ], + seeAlso: ['Tools for Real-time Spectral Processing (pvs opcodes)'] +}, +{ + name: 'pvsfread', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'Read a selected channel from a PVOC-EX analysis file.', + syntax: 'fsig = pvsfread(ktimpt, ifn [, ichan])', + example: '--8<-- "examples/pvsfread.csd"', + rates: ['i-rate'], + parameters: [ + { + name: 'ifn', + description: 'Name of the analysis file. This must have the .pvx file extension.', + type: 'initialization' + }, + { + name: 'ichan', + description: '(optional) The channel to read (counting from 0). Default is 0.', + type: 'initialization' + }, + { + name: 'ktimpt', + description: 'Time pointer into analysis file, in seconds. See the description of the same parameter of [pvoc](../opcodes/pvoc.md) for usage.', + type: 'performance' + }, + ], + seeAlso: ['Tools for Real-time Spectral Processing (pvs opcodes)'] +}, +{ + name: 'pvsfreeze', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'Freeze the amplitude and frequency time functions of a pv stream according to a control-rate trigger.', + syntax: 'fsig = pvsfreeze(fsigin, kfreeza, kfreezf)', + example: 'asig in ; input\nktrig oscil 1.5, 0.25, 1 ; trigger\nfim pvsanal asig1, 1024, 256, 1024, 0 ; pvoc analysis \nfou pvsfreeze fim, abs(ktrig), abs(ktrig) ; regular \'freeze\' of spectra\naout pvsynth fou ; pvoc synthesis', + parameters: [ + { + name: 'fsig', + description: 'output pv stream', + type: 'performance' + }, + { + name: 'fsigin', + description: 'input pv stream.', + type: 'performance' + }, + { + name: 'kfreeza', + description: 'freezing switch for amplitudes. Freezing is on if above or equal to 1 and off if below 1.', + type: 'performance' + }, + { + name: 'kfcf', + description: 'freezing switch for frequencies. Freezing is on if above or equal to 1 and off if below 1.', + type: 'performance' + }, + ], + seeAlso: ['Tools for Real-time Spectral Processing (pvs opcodes)'] +}, +{ + name: 'pvsfromarray', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'Same as the [tab2pvs](../opcodes/tab2pvs.md) opcode.', + syntax: 'fsig = pvsfromarray(karr[] [,ihopsize, iwinsize, iwintype])\n fsig = pvsfromarray(kmags[], kfreqs[] [,ihopsize, iwinsize, iwintype])', +}, +{ + name: 'pvsftr', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'Reads amplitude and/or frequency data from function tables.', + syntax: 'pvsftr(fsrc, ifna [, ifnf])', + example: '--8<-- "examples/pvsftr.csd"', + parameters: [ + { + name: 'ifna', + description: 'A table, at least inbins in size, that stores amplitude data. Ignored if ifna = 0', + type: 'initialization' + }, + { + name: 'fsrc', + description: 'a PVOC-EX formatted source.', + type: 'performance' + }, + ], + seeAlso: ['Tools for Real-time Spectral Processing (pvs opcodes)'] +}, +{ + name: 'pvsftw', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'Writes amplitude and/or frequency data to function tables.', + syntax: 'kflag = pvsftw(fsrc, ifna [, ifnf])', + example: '--8<-- "examples/pvsftw.csd"', + parameters: [ + { + name: 'ifna', + description: 'A table, at least inbins in size, that stores amplitude data. Ignored if ifna = 0', + type: 'initialization' + }, + { + name: 'ifnf', + description: 'A table, at least inbins in size, that stores frequency data. Ignored if ifnf = 0', + type: 'initialization' + }, + { + name: 'kflag', + description: 'A flag that has the value of 1 when new data is available, 0 otherwise.', + type: 'performance' + }, + { + name: 'fsrc', + description: 'a PVOC-EX formatted source.', + type: 'performance' + }, + ], + seeAlso: ['Tools for Real-time Spectral Processing (pvs opcodes)'] +}, +{ + name: 'pvsfwrite', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'Write a fsig to a PVOCEX file (which in turn can be read by _pvsfread_ or other programs that support PVOCEX file input).', + syntax: 'pvsfwrite(fsig, ifile)', + example: '--8<-- "examples/pvsfwrite.csd"', + parameters: [ + { + name: 'fsig', + description: 'fsig input data.', + type: 'initialization' + }, + { + name: 'ifile', + description: 'filename (a string in double-quotes) .', + type: 'initialization' + }, + ], + seeAlso: ['Tools for Real-time Spectral Processing (pvs opcodes)'] +}, +{ + name: 'pvsgain', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'Scale the amplitude of a pv stream.', + syntax: 'fsig = pvsgain(fsigin, kgain)', + example: '--8<-- "examples/pvsgain.csd"', + parameters: [ + { + name: 'fsig', + description: 'output pv stream', + type: 'performance' + }, + { + name: 'fsigin', + description: 'input pv stream', + type: 'performance' + }, + { + name: 'kgain', + description: 'amplitude scaling (defaults to 1).', + type: 'performance' + }, + ], + seeAlso: ['Tools for Real-time Spectral Processing (pvs opcodes)'] +}, +{ + name: 'pvshift', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'Shift the frequency components of a pv stream, stretching/compressing its spectrum.', + syntax: 'fsig = pvshift(fsigin, kshift, klowest [, kkeepform, igain, kcoefs])', + example: 'asig in ; get the signal in\n\nfsig pvsanal asig, 1024, 256, 1024, 1 ; analyse it\nftps pvshift fsig, 100, 0 ; add 100 Hz to each component\natps pvsynth ftps ; synthesise it', + parameters: [ + { + name: 'fsig', + description: 'output pv stream', + type: 'performance' + }, + { + name: 'fsigin', + description: 'input pv stream', + type: 'performance' + }, + { + name: 'kshift', + description: 'shift amount (in Hz, positive or negative).', + type: 'performance' + }, + { + name: 'klowest', + description: 'lowest frequency to be shifted.', + type: 'performance' + }, + { + name: 'kkeepform', + description: 'attempt to keep input signal formants; 0: do not keep formants; 1: keep formants using a liftered cepstrum method; 2: keep formants by using a true envelope method (defaults to 0).', + type: 'performance' + }, + { + name: 'kgain', + description: 'amplitude scaling (defaults to 1).', + type: 'performance' + }, + { + name: 'kcoefs', + description: 'number of cepstrum coefs used in formant preservation (defaults to 80).', + type: 'performance' + }, + ], + seeAlso: ['Tools for Real-time Spectral Processing (pvs opcodes)'] +}, +{ + name: 'pvsifd', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'Instantaneous Frequency Distribution, magnitude and phase analysis.', + syntax: 'ffr, fphs = pvsifd(ain, ifftsize, ihopsize, iwintype [,iscal])', + example: '--8<-- "examples/pvsifd.csd"', + parameters: [ + { + name: 'ffr', + description: 'output pv stream in AMP_FREQ format', + type: 'performance' + }, + { + name: 'fphs', + description: 'output pv stream in AMP_PHASE format', + type: 'performance' + }, + { + name: 'ifftsize', + description: 'FFT analysis size, must be power-of-two and integer multiple of the hopsize.', + type: 'performance' + }, + { + name: 'ihopsize', + description: 'hopsize in samples', + type: 'performance' + }, + { + name: 'iwintype', + description: 'window type (O: Hamming, 1: Hanning)', + type: 'performance' + }, + { + name: 'iscal', + description: 'amplitude scaling (defaults to 1).', + type: 'performance' + }, + ], + seeAlso: ['Tools for Real-time Spectral Processing (pvs opcodes)'] +}, +{ + name: 'pvsin', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'Retrieve an fsig from the input software bus; a pvs equivalent to _chani_.', + syntax: 'fsig = pvsin(kchan [, isize, iolap, iwinsize, iwintype, iformat])', + example: 'fsig pvsin 0 ; get data from pvs in bus channel 0', + parameters: [ + { + name: 'isize', + description: 'initial DFT size,defaults to 1024.', + type: 'initialization' + }, + { + name: 'iolap', + description: 'size of overlap, defaults to _isize_/4.', + type: 'initialization' + }, + { + name: 'iwinsize', + description: 'size of analysis window, defaults to _isize_.', + type: 'initialization' + }, + { + name: 'iwintype', + description: 'type of window, defaults to Hanning (1) (see _pvsanal_)', + type: 'initialization' + }, + { + name: 'iformat', + description: 'data format, defaults 0 (PVS_AMP_FREQ). Other possible values are 1 (PVS_AMP_PHASE), 2 (PVS_COMPLEX) or 3 (PVS_TRACKS).', + type: 'initialization' + }, + { + name: 'fsig', + description: 'output fsig.', + type: 'performance' + }, + { + name: 'kchan', + description: 'channel number. If non-existent, a channel will be created.', + type: 'performance' + }, + ], + seeAlso: ['Tools for Real-time Spectral Processing (pvs opcodes)'] +}, +{ + name: 'pvsinfo', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'Get information from a PVOC-EX formatted source.', + syntax: 'ioverlap, inumbins, iwinsize, iformat = pvsinfo(fsrc)', + example: '--8<-- "examples/pvsinfo.csd"', + parameters: [ + { + name: 'ioverlap', + description: 'The stream overlap size.', + type: 'initialization' + }, + { + name: 'inumbins', + description: 'The number of analysis bins (amplitude+frequency) in fsrc. The underlying FFT size is calculated as (inumbins -1) * 2.', + type: 'initialization' + }, + { + name: 'iwinsize', + description: 'The analysis window size. May be larger than the FFT size.', + type: 'initialization' + }, + { + name: 'iformat', + description: 'The analysis frame format. If fsrc is created by an opcode, iformat will always be 0, signifying amplitude+frequency. If fsrc is defined from a PVOC-EX file, iformat may also have the value 1 or 2 (amplitude+phase, complex).', + type: 'initialization' + }, + ], + seeAlso: ['Tools for Real-time Spectral Processing (pvs opcodes)'] +}, +{ + name: 'pvsinit', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'Initialise a spectral (f) variable to zero.', + syntax: 'fsig = pvsinit(isize [, iolap, iwinsize, iwintype, iformat])', + example: '--8<-- "examples/pvsinit.csd"', + parameters: [ + { + name: 'fsig', + description: 'output pv stream set to zero.', + type: 'performance' + }, + { + name: 'isize', + description: 'size of the DFT frame.', + type: 'performance' + }, + { + name: 'iolap', + description: 'size of the analysis overlap, defaults to _isize_/4.', + type: 'performance' + }, + { + name: 'iwinsize', + description: 'size of the analysis window, defaults to _isize_.', + type: 'performance' + }, + { + name: 'iwintype', + description: 'type of analysis window, defaults to 1, Hanning.', + type: 'performance' + }, + { + name: 'iformat', + description: 'pvsdata format, defaults to 0:PVS_AMP_FREQ.', + type: 'performance' + }, + ], + seeAlso: ['Tools for Real-time Spectral Processing (pvs opcodes)'] +}, +{ + name: 'pvsmaska', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'Modify amplitudes using a function table, with dynamic scaling.', + syntax: 'fsig = pvsmaska(fsrc, ifn, kdepth)', + example: '--8<-- "examples/pvsmaska.csd"', + rates: ['i-rate'], + parameters: [ + { + name: 'ifn', + description: 'The f-table to use. Given fsrc has N analysis bins, table ifn must be of size N or larger. The table need not be normalized, but values should lie within the range 0 to 1. It can be supplied from the score in the usual way, or from within the orchestra by using [pvsinfo](../opcodes/pvsinfo.md) to find the size of fsrc, (returned by pvsinfo in inbins), which can then be passed to ftgen to create the f-table.', + type: 'initialization' + }, + { + name: 'kdepth', + description: 'Controls the degree of modification applied to fsrc, using simple linear scaling. 0 leaves amplitudes unchanged, 1 applies the full profile of ifn.', + type: 'performance' + }, + ], + seeAlso: ['Tools for Real-time Spectral Processing (pvs opcodes)'] +}, +{ + name: 'pvsmix', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'Mix \'seamlessly\' two pv signals.', + syntax: 'fsig = pvsmix(fsigin1, fsigin2)', + example: '--8<-- "examples/pvsmix.csd"', + parameters: [ + { + name: 'fsig', + description: 'output pv stream', + type: 'performance' + }, + { + name: 'fsigin1', + description: 'input pv stream.', + type: 'performance' + }, + { + name: 'fsigin2', + description: 'input pv stream, which must have same format as _fsigin1_.', + type: 'performance' + }, + ], + seeAlso: ['Tools for Real-time Spectral Processing (pvs opcodes)'] +}, +{ + name: 'pvsmooth', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'Smooth the amplitude and frequency time functions of a pv stream using parallel 1st order lowpass IIR filters with time-varying cutoff frequency.', + syntax: 'fsig = pvsmooth(fsigin, kacf, kfcf)', + example: '--8<-- "examples/pvsmooth.csd"', + parameters: [ + { + name: 'fsig', + description: 'output pv stream', + type: 'performance' + }, + { + name: 'fsigin', + description: 'input pv stream.', + type: 'performance' + }, + { + name: 'kacf', + description: 'amount of cutoff frequency for amplitude function filtering, between 0 and 1, in fractions of 1/2 frame-rate.', + type: 'performance' + }, + { + name: 'kfcf', + description: 'amount of cutoff frequency for frequency function filtering, between 0 and 1, in fractions of 1/2 frame-rate.', + type: 'performance' + }, + ], + seeAlso: ['Tools for Real-time Spectral Processing (pvs opcodes)'] +}, +{ + name: 'pvsmorph', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'Performs morphing (or interpolation) between two source fsigs.', + syntax: 'fsig = pvsmorph(fsig1, fsig2, kampint, kfrqint)', + example: '--8<-- "examples/pvsmorph.csd"', + seeAlso: ['Tools for Real-time Spectral Processing (pvs opcodes)'] +}, +{ + name: 'pvsosc', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'PVS-based oscillator simulator.', + syntax: 'fsig = pvsosc(kamp, kfreq, ktype, isize [,ioverlap] [, iwinsize] [, iwintype] \\\n [, iformat])', + example: '--8<-- "examples/pvsosc.csd"', + rates: ['k-rate'], + parameters: [ + { + name: 'kamp', + description: 'signal amplitude. Note that the actual signal amplitude can, depending on wave type and frequency, vary slightly above or below this value. Generally the amplitude will tend to exceed kamp on higher frequencies (> 1000 Hz) and be reduced on lower ones. Also due to the overlap-add process, when resynthesing with pvsynth, frequency glides will cause the output amplitude to fluctuate above and below kamp.', + type: 'performance' + }, + { + name: 'kfreq', + description: 'fundamental frequency in Hz.', + type: 'performance' + }, + { + name: 'ktype', + description: 'wave type: 1. sawtooh-like, 2.square-like, 3.pulse and any other value for cosine.', + type: 'performance' + }, + ], + seeAlso: ['Tools for Real-time Spectral Processing (pvs opcodes)'] +}, +{ + name: 'pvsout', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'Write a fsig to the pvs output bus.', + syntax: 'pvsout(fsig, kchan)', + example: 'asig in ; input\nfsig pvsanal asig, 1024, 256, 1024, 1 ; analysis\n pvsout fsig, 0 ; write signal to pvs out bus channel 0', + parameters: [ + { + name: 'fsig', + description: 'fsig input data.', + type: 'performance' + }, + { + name: 'kchan', + description: 'pvs out bus channel number.', + type: 'performance' + }, + ], + seeAlso: ['Tools for Real-time Spectral Processing (pvs opcodes)'] +}, +{ + name: 'pvspitch', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'Track the pitch and amplitude of a PVS signal as k-rate variables.', + syntax: 'kfr, kamp = pvspitch(fsig, kthresh)', + example: '--8<-- "examples/pvspitch.csd"', + rates: ['k-rate'], + parameters: [ + { + name: 'kamp', + description: 'Amplitude of fundamental frequency', + type: 'performance' + }, + { + name: 'kfr', + description: 'Fundamental frequency', + type: 'performance' + }, + { + name: 'fsig', + description: 'an input pv stream', + type: 'performance' + }, + { + name: 'kthresh', + description: 'analysis threshold (between 0 and 1). Higher values will eliminate low-amplitude components from the analysis.', + type: 'performance' + }, + ], + seeAlso: ['Tools for Real-time Spectral Processing (pvs opcodes)', 'Sensing and Control: Tempo and Pitch estimation'] +}, +{ + name: 'pvstanal', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'Phase vocoder analysis processing with onset detection/processing.', + syntax: 'fsig = pvstanal(ktimescal, kamp, kpitch, ktab, [kdetect, kwrap, ioffset, \\\n ifftsize, ihop, idbthresh])\n )', + example: '--8<-- "examples/pvstanal.csd"', + rates: ['k-rate'], + parameters: [ + { + name: 'ifftsize', + description: 'FFT size (power-of-two), defaults to 2048.', + type: 'initialization' + }, + { + name: 'ihop', + description: 'hopsize, defaults to 512', + type: 'initialization' + }, + { + name: 'ioffset', + description: 'startup read offset into table, in secs.', + type: 'initialization' + }, + { + name: 'idbthresh', + description: 'threshold for onset detection, based on dB power spectrum ratio between two successive windows. A detected ratio above it will cancel timescaling momentarily, to avoid smearing (defaults to 1). By default anything more than a 1 dB inter-frame power difference will be detected as an onset.', + type: 'initialization' + }, + { + name: 'ktimescal', + description: 'timescaling ratio, < 1 stretch, > 1 contract.', + type: 'performance' + }, + { + name: 'kamp', + description: 'amplitude scaling', + type: 'performance' + }, + { + name: 'kpitch', + description: 'grain pitch scaling (1=normal pitch, < 1 lower, > 1 higher; negative, backwards)', + type: 'performance' + }, + { + name: 'kdetect', + description: '0 or 1, to switch onset detection/processing. The onset detector checks for power difference between analysis windows. If more than what has been specified in the dbthresh parameter, an onset is declared. It suspends timescaling momentarily so the onsets are not modified. The default is 1, so onset detection/processing is on.', + type: 'performance' + }, + { + name: 'ktab', + description: 'source signal function table. Deferred-allocation tables (see [GEN01](../scoregens/gen01.md)) are accepted, but the opcode expects a mono source. Tables can be switched at k-rate.', + type: 'performance' + }, + { + name: 'kwrap', + description: '0 or 1, to switch on/off table wrap-around read (default to 1)', + type: 'performance' + }, + ], + seeAlso: ['Tools for Real-time Spectral Processing (pvs opcodes)'] +}, +{ + name: 'pvstencil', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'Transforms a pvoc stream according to a masking function table.', + syntax: 'fsig = pvstencil(fsigin, kgain, klevel, iftable)', + example: '--8<-- "examples/pvstencil.csd"', + parameters: [ + { + name: 'fsig', + description: 'output pv stream', + type: 'performance' + }, + { + name: 'fsigin', + description: 'input pv stream.', + type: 'performance' + }, + { + name: 'kgain', + description: '`stencil\' gain.', + type: 'performance' + }, + { + name: 'klevel', + description: 'masking function level (scales the ftable prior to `stenciling\') .', + type: 'performance' + }, + { + name: 'iftable', + description: 'masking function table.', + type: 'performance' + }, + ], + seeAlso: ['Tools for Real-time Spectral Processing (pvs opcodes)'] +}, +{ + name: 'pvstrace', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'Process a PV stream by retaining only the N bins with the highest amplitude, zeroing the others.', + syntax: 'fsig = pvstrace(fsigin, kn)\n fsig, kBins[] = pvstrace(fsigin, kn [, isort, imin, imax])', + example: '--8<-- "examples/pvstrace.csd"', + parameters: [ + { + name: 'fsig', + description: 'output pv stream', + type: 'performance' + }, + { + name: 'fsigin', + description: 'input pv stream', + type: 'performance' + }, + { + name: 'kn', + description: 'number of bins to be retained', + type: 'performance' + }, + ], + seeAlso: ['Tools for Real-time Spectral Processing (pvs opcodes)'] +}, +{ + name: 'pvsvoc', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'Combine the spectral envelope of one fsig with the excitation (frequencies) of another.', + syntax: 'fsig = pvsvoc(famp, fexc, kdepth, kgain [, kcoefs])', + example: '--8<-- "examples/pvsvoc.csd"', + parameters: [ + { + name: 'fsig', + description: 'output pv stream', + type: 'performance' + }, + { + name: 'famp', + description: 'input pv stream from which the amplitudes will be extracted', + type: 'performance' + }, + { + name: 'fexc', + description: 'input pv stream from which the frequencies will be taken', + type: 'performance' + }, + { + name: 'kdepth', + description: 'depth of effect, affecting how much of the frequencies will be taken from the second fsig: 0, the output is the famp signal, 1 the output is the famp amplitudes and fexc frequencies.', + type: 'performance' + }, + { + name: 'kgain', + description: 'gain boost/attenuation applied to the output.', + type: 'performance' + }, + { + name: 'kcoefs', + description: 'number of cepstrum coefs used in spectral envelope estimation (defaults to 80).', + type: 'performance' + }, + ], + seeAlso: ['Tools for Real-time Spectral Processing (pvs opcodes)'] +}, +{ + name: 'pvswarp', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'Warp the spectral envelope of a PVS signal by means of shifting and scaling.', + syntax: 'fsig = pvswarp(fsigin, kscal, kshift [, klowest, kmeth, kgain, kcoefs])', + example: '--8<-- "examples/pvswarp.csd"', + parameters: [ + { + name: 'fsig', + description: 'output pv stream', + type: 'performance' + }, + { + name: 'fsigin', + description: 'input pv stream', + type: 'performance' + }, + { + name: 'kscal', + description: 'spectral envelope scaling ratio. Values > 1 stretch the envelope and < 1 compress it.', + type: 'performance' + }, + { + name: 'kshift', + description: 'spectral envelope shift (in Hz), values > 0 shift the envelope linearly upwards and values < 0 shift it downwards.', + type: 'performance' + }, + { + name: 'klowest', + description: 'lowest frequency shifted (affects only kshift, defaults to 0).', + type: 'performance' + }, + { + name: 'kmethod', + description: 'spectral envelope extraction method. 1: liftered cepstrum method; 2: true envelope method (defaults to 1).', + type: 'performance' + }, + { + name: 'kgain', + description: 'amplitude scaling (defaults to 1).', + type: 'performance' + }, + { + name: 'kcoefs', + description: 'number of cepstrum coefs used in formant preservation (defaults to 80).', + type: 'performance' + }, + ], + seeAlso: ['Tools for Real-time Spectral Processing (pvs opcodes)'] +}, +{ + name: 'pvsynth', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'Resynthesise phase vocoder data (f-signal) using a FFT overlap-add.', + syntax: 'ares = pvsynth(fsrc, [iinit])', + example: '; score f-table using cubic spline to define shaped peaks\nf1 0 513 8 0 2 1 3 0 4 1 6 0 10 1 12 0 16 1 32 0 1 0 436 0\n\nasig buzz 20000, 199, 50, 1 ; pulsewave source\nfsig pvsanal asig, 1024, 256, 1024, 0 ; create fsig\nkmod linseg 0, p3/2, 1, p3/2, 0 ; simple control sig\n\nfsigout pvsmaska fsig, 2, kmod ; apply weird eq to fsig\naout pvsynth fsigout ; resynthesize,\n dispfft aout, 0.1, 1024 ; and view the effect', + rates: ['a-rate'], + parameters: [ + { + name: 'ares', + description: 'output audio signal', + type: 'performance' + }, + { + name: 'fsrc', + description: 'input signal', + type: 'performance' + }, + { + name: 'iinit', + description: 'not yet implemented.', + type: 'performance' + }, + ], + seeAlso: ['Tools for Real-time Spectral Processing (pvs opcodes)'] +}, +{ + name: 'resyn', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'Streaming partial track additive synthesis with cubic phase interpolation.', + syntax: 'asig = resyn(fin, kscal, kpitch, kmaxtracks, ifn)', + example: '--8<-- "examples/resyn.csd"', + rates: ['a-rate', 'i-rate'], + parameters: [ + { + name: 'asig', + description: 'output audio rate signal', + type: 'performance' + }, + { + name: 'fin', + description: 'input pv stream in TRACKS format', + type: 'performance' + }, + { + name: 'kscal', + description: 'amplitude scaling', + type: 'performance' + }, + { + name: 'kpitch', + description: 'pitch scaling', + type: 'performance' + }, + { + name: 'kmaxtracks', + description: 'max number of tracks in resynthesis. Limiting this will cause a non-linear filtering effect, by discarding newer and higher-frequency tracks (tracks are ordered by start time and ascending frequency, respectively)', + type: 'performance' + }, + { + name: 'ifn', + description: 'function table containing one cycle of a sinusoid (sine or cosine)', + type: 'performance' + }, + ], + seeAlso: ['Tools for Real-time Spectral Processing (pvs opcodes)'] +}, +{ + name: 'sinsyn', + type: 'opcode', + category: 'Spectral Processing:Streaming', + description: 'Streaming partial track additive synthesis with cubic phase interpolation.', + syntax: 'asig = sinsyn(fin, kscal, kmaxtracks, ifn)', + example: '--8<-- "examples/sinsyn.csd"', + rates: ['a-rate', 'i-rate'], + parameters: [ + { + name: 'asig', + description: 'output audio rate signal', + type: 'performance' + }, + { + name: 'fin', + description: 'input pv stream in TRACKS format', + type: 'performance' + }, + { + name: 'kscal', + description: 'amplitude scaling', + type: 'performance' + }, + { + name: 'kmaxtracks', + description: 'max number of tracks in sinsynthesis. Limiting this will cause a non-linear filtering effect, by discarding newer and higher-frequency tracks (tracks are ordered by start time and ascending frequency, respectively)', + type: 'performance' + }, + { + name: 'ifn', + description: 'function table containing one cycle of a sinusoid (sine or cosine).', + type: 'performance' + }, + ], + seeAlso: ['Tools for Real-time Spectral Processing (pvs opcodes)'] +}, +] diff --git a/src/lib/csound-reference/strings-conversion.ts b/src/lib/csound-reference/strings-conversion.ts new file mode 100644 index 0000000..ef5c635 --- /dev/null +++ b/src/lib/csound-reference/strings-conversion.ts @@ -0,0 +1,39 @@ +import type { CsoundReference } from './types' + +// Strings:Conversion +export const stringsConversion: CsoundReference[] = [ +{ + name: 'strchar', + type: 'opcode', + category: 'Strings:Conversion', + description: 'Return the ASCII code of the character in Sstr at ipos (defaults to zero which means the first character), or zero if ipos is out of range.', + syntax: 'ichr = strchar(Sstr [, ipos])', + example: '--8<-- "examples/strchar.csd"', + seeAlso: ['String Conversion Opcodes'] +}, +{ + name: 'strchark', + type: 'opcode', + category: 'Strings:Conversion', + description: 'Return the ASCII code of the character in Sstr at kpos (defaults to zero which means the first character), or zero if kpos is out of range.', + syntax: 'kchr = strchark(Sstr [, kpos])', + seeAlso: ['String Conversion Opcodes'] +}, +{ + name: 'strlower', + type: 'opcode', + category: 'Strings:Conversion', + description: 'Convert Ssrc to lower case, and write the result to Sdst.', + syntax: 'Sdst = strlower(Ssrc)', + example: '--8<-- "examples/strlower.csd"', + seeAlso: ['String Conversion Opcodes'] +}, +{ + name: 'strlowerk', + type: 'opcode', + category: 'Strings:Conversion', + description: 'Convert Ssrc to lower case, and write the result to Sdst.', + syntax: 'Sdst = strlowerk(Ssrc)', + seeAlso: ['String Conversion Opcodes'] +}, +] diff --git a/src/lib/csound-reference/strings-definition.ts b/src/lib/csound-reference/strings-definition.ts new file mode 100644 index 0000000..68f5d93 --- /dev/null +++ b/src/lib/csound-reference/strings-definition.ts @@ -0,0 +1,68 @@ +import type { CsoundReference } from './types' + +// Strings:Definition +export const stringsDefinition: CsoundReference[] = [ +{ + name: 'strfromurl', + type: 'opcode', + category: 'Strings:Definition', + description: 'Set a string variable to the value found from reading an URL.', + syntax: 'Sdst = strfromurl(StringURL)', + example: '--8<-- "examples/strfromurl.csd"', + parameters: [ + { + name: 'StringURL', + description: 'string naming an URL.', + type: 'initialization' + }, + { + name: 'Sdst', + description: 'destination string variable', + type: 'initialization' + }, + ], + seeAlso: ['String Manipulation Opcodes'] +}, +{ + name: 'strget', + type: 'opcode', + category: 'Strings:Definition', + description: 'Set a string variable at initialization time to the value stored in [strset](../opcodes/strset.md) table at the specified index, or a string p-field from the score.', + syntax: 'Sdst = strget(indx)', + example: '--8<-- "examples/strget.csd"', + parameters: [ + { + name: 'indx', + description: 'strset index, or score p-field', + type: 'initialization' + }, + { + name: 'Sdst', + description: 'destination string variable', + type: 'initialization' + }, + ], + seeAlso: ['String Manipulation Opcodes'] +}, +{ + name: 'strset', + type: 'opcode', + category: 'Strings:Definition', + description: 'Allows a string to be linked with a numeric value.', + syntax: 'strset(iarg, istring)', + example: 'strset 10, "asound.wav"', + parameters: [ + { + name: 'iarg', + description: 'the numeric value.', + type: 'initialization' + }, + { + name: 'istring', + description: 'the alphanumeric string (in double-quotes).', + type: 'initialization' + }, + ], + seeAlso: ['String Manipulation Opcodes', 'Orchestra Header Statements'] +}, +] diff --git a/src/lib/csound-reference/strings-manipulation.ts b/src/lib/csound-reference/strings-manipulation.ts new file mode 100644 index 0000000..1bb3e26 --- /dev/null +++ b/src/lib/csound-reference/strings-manipulation.ts @@ -0,0 +1,223 @@ +import type { CsoundReference } from './types' + +// Strings:Manipulation +export const stringsManipulation: CsoundReference[] = [ +{ + name: 'puts', + type: 'opcode', + category: 'Strings:Manipulation', + description: 'Print a string with an optional newline at the end whenever the trigger signal is positive and changes.', + syntax: 'puts(Sstr, ktrig [, inonl])', + example: '--8<-- "examples/puts.csd"', + parameters: [ + { + name: 'Sstr', + description: 'string to be printed', + type: 'initialization' + }, + { + name: 'ktrig', + description: 'trigger signal, should be valid at i-time. The string is printed at initialization time if ktrig is positive, and at performance time whenever ktrig is both positive and different from the previous value. Use a constant value of 1 to print once at note initialization.', + type: 'performance' + }, + ], + seeAlso: ['String Manipulation Opcodes'] +}, +{ + name: 'sprintf', + type: 'opcode', + category: 'Strings:Manipulation', + description: 'printf-style formatted output to a string variable.', + syntax: 'Sdst = sprintf(Sfmt, xarg1[, xarg2[, ... ]])', + example: '--8<-- "examples/sprintf.csd"', + parameters: [ + { + name: 'Sfmt', + description: 'format string, has the same format as in printf() and other similar C functions, except length modifiers (l, ll, h, etc.) are not supported. The following conversion specifiers are allowed:', + type: 'initialization' + }, + { + name: 'Sdst', + description: 'output string variable', + type: 'performance' + }, + ], + seeAlso: ['String Manipulation Opcodes'] +}, +{ + name: 'sprintfk', + type: 'opcode', + category: 'Strings:Manipulation', + description: 'printf-style formatted output to a string variable at k-rate.', + syntax: 'Sdst = sprintfk(Sfmt, xarg1[, xarg2[, ... ]])', + example: '--8<-- "examples/sprintfk.csd"', + parameters: [ + { + name: 'Sfmt', + description: 'format string, has the same format as in printf() and other similar C functions, except length modifiers (l, ll, h, etc.) are not supported. The following conversion specifiers are allowed:', + type: 'initialization' + }, + { + name: 'Sdst', + description: 'output string variable', + type: 'performance' + }, + ], + seeAlso: ['String Manipulation Opcodes'] +}, +{ + name: 'strcat', + type: 'opcode', + category: 'Strings:Manipulation', + description: 'Concatenate two strings and store the result in a variable.', + syntax: 'Sdst = strcat(Ssrc1, Ssrc2)', + example: '--8<-- "examples/strcat.csd"', + seeAlso: ['String Manipulation Opcodes'] +}, +{ + name: 'strcatk', + type: 'opcode', + category: 'Strings:Manipulation', + description: 'Concatenate two strings and store the result in a variable.', + syntax: 'Sdst = strcatk(Ssrc1, Ssrc2)', + example: '--8<-- "examples/strcatk.csd"', + seeAlso: ['String Manipulation Opcodes'] +}, +{ + name: 'strcmp', + type: 'opcode', + category: 'Strings:Manipulation', + description: 'Compare strings.', + syntax: 'ires = strcmp(S1, S2)', + example: '--8<-- "examples/strcmp.csd"', + rates: ['i-rate'], + seeAlso: ['String Manipulation Opcodes'] +}, +{ + name: 'strcmpk', + type: 'opcode', + category: 'Strings:Manipulation', + description: 'Compare strings.', + syntax: 'kres = strcmpk(S1, S2)', + rates: ['k-rate'], + seeAlso: ['String Manipulation Opcodes'] +}, +{ + name: 'strcpy', + type: 'opcode', + category: 'Strings:Manipulation', + description: 'Assign to a string variable by copying the source which may be a constant or another string variable.', + syntax: 'Sdst = strcpy(Ssrc)\n Sdst = Ssrc', + example: 'Sfoo strcpy "Hello, world !"\n puts Sfoo, 1', + seeAlso: ['String Manipulation Opcodes'] +}, +{ + name: 'strcpyk', + type: 'opcode', + category: 'Strings:Manipulation', + description: 'Assign to a string variable by copying the source which may be a constant or another string variable.', + syntax: 'Sdst = strcpyk(Ssrc)', + example: '--8<-- "examples/strcpyk.csd"', + seeAlso: ['String Manipulation Opcodes'] +}, +{ + name: 'strindex', + type: 'opcode', + category: 'Strings:Manipulation', + description: 'Return the position of the first occurence of S2 in S1, or -1 if not found. If S2 is empty, 0 is returned.', + syntax: 'ipos = strindex(S1, S2)', + seeAlso: ['String Manipulation Opcodes'] +}, +{ + name: 'strindexk', + type: 'opcode', + category: 'Strings:Manipulation', + description: 'Return the position of the first occurence of S2 in S1, or -1 if not found. If S2 is empty, 0 is returned.', + syntax: 'kpos = strindexk(S1, S2)', + example: '--8<-- "examples/strindexk.csd"', + seeAlso: ['String Manipulation Opcodes'] +}, +{ + name: 'strlen', + type: 'opcode', + category: 'Strings:Manipulation', + description: 'Return the length of a string, or zero if it is empty. strlen runs at init time only.', + syntax: 'ilen = strlen(Sstr)', + seeAlso: ['String Manipulation Opcodes'] +}, +{ + name: 'strlenk', + type: 'opcode', + category: 'Strings:Manipulation', + description: 'Return the length of a string, or zero if it is empty. strlenk runs both at init and performance time.', + syntax: 'klen = strlenk(Sstr)', + seeAlso: ['String Manipulation Opcodes'] +}, +{ + name: 'strrindex', + type: 'opcode', + category: 'Strings:Manipulation', + description: 'Return the position of the last occurence of S2 in S1, or -1 if not found. If S2 is empty, the length of S1 is returned.', + syntax: 'ipos = strrindex(S1, S2)', + example: '--8<-- "examples/strrindex.csd"', + seeAlso: ['String Manipulation Opcodes'] +}, +{ + name: 'strrindexk', + type: 'opcode', + category: 'Strings:Manipulation', + description: 'Return the position of the last occurence of S2 in S1, or -1 if not found. If S2 is empty, the length of S1 is returned.', + syntax: 'kpos = strrindexk(S1, S2)', + seeAlso: ['String Manipulation Opcodes'] +}, +{ + name: 'strstrip', + type: 'opcode', + category: 'Strings:Manipulation', + description: 'Strip whitespace from string.', + syntax: 'Sout = strstrip(Sin [, Smode])', + example: '--8<-- "examples/strstrip.csd"', + parameters: [ + { + name: 'Sin', + description: 'Input string', + type: 'initialization' + }, + { + name: 'Smode', + description: 'If not given, whitespace is stripped from both sides. If "l", strip whitespace from left side. If "r", strip whitespace from right side.', + type: 'initialization' + }, + ], + seeAlso: ['String Manipulation Opcodes'] +}, +{ + name: 'strsub', + type: 'opcode', + category: 'Strings:Manipulation', + description: 'Extract a substring of the source string.', + syntax: 'Sdst = strsub(Ssrc [, istart[, iend]])', + example: '--8<-- "examples/strsub.csd"', + seeAlso: ['String Manipulation Opcodes'] +}, +{ + name: 'strsubk', + type: 'opcode', + category: 'Strings:Manipulation', + description: 'Extract a substring of the source string.', + syntax: 'Sdst = strsubk(Ssrc, kstart, kend)', + parameters: [ + { + name: 'kstart', + description: 'start position in Ssrc, counting from 0. A negative value means the end of the string.', + type: 'performance' + }, + { + name: 'kend', + description: 'end position in Ssrc, counting from 0. A negative value means the end of the string. If kend is less than kstart, the output is reversed.', + type: 'performance' + }, + ], + seeAlso: ['String Manipulation Opcodes'] +}, +] diff --git a/src/lib/csound-reference/table-control-read-write-operations.ts b/src/lib/csound-reference/table-control-read-write-operations.ts new file mode 100644 index 0000000..283a2b7 --- /dev/null +++ b/src/lib/csound-reference/table-control-read-write-operations.ts @@ -0,0 +1,354 @@ +import type { CsoundReference } from './types' + +// Table Control:Read/Write Operations +export const tableControlReadWriteOperations: CsoundReference[] = [ +{ + name: 'ftaudio', + type: 'opcode', + category: 'Table Control:Read/Write Operations', + description: 'Write a previously-allocated table to an audio file in a variety of formats.', + syntax: 'ians = ftaudio(ifn, "filename", iformat[, ibeg, iend])\n kans = ftaudio(ktrig, kfn, "filename", kformat [, isync, kbeg, kend])', + example: '--8<-- "examples/ftaudio.csd"', + rates: ['i-rate'], + parameters: [ + { + name: 'ifn', + description: 'Number of table to write.', + type: 'initialization' + }, + { + name: 'kfn', + description: 'Number of table to write.', + type: 'initialization' + }, + { + name: 'iformat', + description: 'Format of the file to save.', + type: 'initialization' + }, + { + name: 'kformat', + description: 'Format of the file to save.', + type: 'initialization' + }, + { + name: 'isync', + description: 'if zero the k-rate version waits for the write to finish. If non-zero (default) the writing of data is delegated to a separate thread which then allows Csound to continue with the rendering.', + type: 'initialization' + }, + { + name: 'ibeg', + description: 'gives limits to start and end of section of the table to write, in samples. Default values of zero means from start to end.', + type: 'initialization' + }, + { + name: 'iend', + description: 'gives limits to start and end of section of the table to write, in samples. Default values of zero means from start to end.', + type: 'initialization' + }, + { + name: 'kbeg', + description: 'gives limits to start and end of section of the table to write, in samples. Default values of zero means from start to end.', + type: 'initialization' + }, + { + name: 'kend', + description: 'gives limits to start and end of section of the table to write, in samples. Default values of zero means from start to end.', + type: 'initialization' + }, + { + name: 'ians', + description: 'returns zero if the operation fails or 1 on success. In the asynchronous mode this is updated when the writing finishes, until when it has the value -1', + type: 'initialization' + }, + { + name: 'kans', + description: 'returns zero if the operation fails or 1 on success. In the asynchronous mode this is updated when the writing finishes, until when it has the value -1', + type: 'initialization' + }, + { + name: 'ktrig', + description: 'the k-rate version only happens on a k-cycle when ktrig is non-zero.', + type: 'performance' + }, + ], + seeAlso: ['Read/Write Operations'] +}, +{ + name: 'ftload', + type: 'opcode', + category: 'Table Control:Read/Write Operations', + description: 'Load a set of previously-allocated tables from a file.', + syntax: 'ftload(Sfilename, iflag, ifn1 [, ifn2] [...])', + parameters: [ + { + name: 'iflag', + description: 'Type of the file to load/save. (0 = binary file, Non-zero = text file)', + type: 'initialization' + }, + ], + seeAlso: ['Read/Write Operations'] +}, +{ + name: 'ftloadk', + type: 'opcode', + category: 'Table Control:Read/Write Operations', + description: 'Load a set of previously-allocated tables from a file.', + syntax: 'ftloadk(Sfilename, ktrig, iflag, ifn1 [, ifn2] [...])', + parameters: [ + { + name: 'Sfilename', + description: 'A string value denoting the name of the file to load.', + type: 'initialization' + }, + { + name: 'iflag', + description: 'Type of the file to load/save. (0 = binary file, Non-zero = text file)', + type: 'initialization' + }, + { + name: 'ktrig', + description: 'The trigger signal. Load the file each time it is non-zero.', + type: 'performance' + }, + ], + seeAlso: ['Read/Write Operations'] +}, +{ + name: 'ftprint', + type: 'opcode', + category: 'Table Control:Read/Write Operations', + description: 'Print the contents of a table (for debugging).', + syntax: 'ftprint(ifn [, ktrig, kstart, kend, kstep, inumcols ])', + example: '--8<-- "examples/ftprint.csd"', + rates: ['i-rate'], + parameters: [ + { + name: 'ifn', + description: 'The table to print', + type: 'initialization' + }, + { + name: 'inumcols', + description: 'The number of elements to print in one column (default = 10)', + type: 'initialization' + }, + { + name: 'ktrig', + description: 'The table will be printed whenever this value changes from 0 to possitive. Can be used together with metro to print at a given time interval. A value of -1 indicates to print at each k-cycle (default = 1)', + type: 'performance' + }, + { + name: 'kstart', + description: 'The first index to print. (default = 0)', + type: 'performance' + }, + { + name: 'kend', + description: 'The end index to print (non inclusive). (default = length of table)', + type: 'performance' + }, + { + name: 'kstep', + description: 'How many elements to skip (default = 1)', + type: 'performance' + }, + ], + seeAlso: ['Printing and Display', 'Read/Write Operations'] +}, +{ + name: 'ftsamplebank', + type: 'opcode', + category: 'Table Control:Read/Write Operations', + description: 'Reads a directory for sound files and loads them to a series of GEN01 function tables.', + syntax: 'iNumberOfFile = ftsamplebank(SDirectory, iFirstTableNumber, iSkipTime, iFormat, \\\n iChannel,)\n kNumberOfFile = ftsamplebank(SDirectory, kFirstTableNumber, kTrigger, kSkipTime, \\\n kFormat, kChannel,)', + example: '--8<-- "examples/ftsamplebank.csd"', + parameters: [ + { + name: 'SDirectory', + description: 'a string that identifies the directory to browse for files', + type: 'initialization' + }, + { + name: 'FirstTableNumber', + description: 'this sets the number of the first table into which a soundfile will be loaded', + type: 'initialization' + }, + { + name: 'Trigger', + description: 'updates the tables when kTrigger is 1, only applicable to k-rate version.', + type: 'initialization' + }, + { + name: 'SkipTime', + description: 'begin reading at _skiptime_ seconds into the file.', + type: 'initialization' + }, + { + name: 'Format', + description: 'specifies the audio data-file format:', + type: 'initialization' + }, + { + name: 'Channel', + description: 'channel number to read in. 0 denotes read all channels.', + type: 'initialization' + }, + { + name: 'iNumberOfFile', + description: 'the number of tables that have been created', + type: 'performance' + }, + { + name: 'kNumberOfFile', + description: 'the number of tables that have been created', + type: 'performance' + }, + ], + seeAlso: ['Read/Write Operations'] +}, +{ + name: 'ftsave', + type: 'opcode', + category: 'Table Control:Read/Write Operations', + description: 'Save a set of previously-allocated tables to a file.', + syntax: 'ftsave("filename", iflag, ifn1 [, ifn2] [...])', + example: '--8<-- "examples/ftsave.csd"', + parameters: [ + { + name: 'iflag', + description: 'Type of the file to save. (0 = binary file, Non-zero = text file)', + type: 'initialization' + }, + ], + seeAlso: ['Read/Write Operations'] +}, +{ + name: 'ftsavek', + type: 'opcode', + category: 'Table Control:Read/Write Operations', + description: 'Save a set of previously-allocated tables to a file.', + syntax: 'ftsavek("filename", ktrig, iflag, ifn1 [, ifn2] [...])', + parameters: [ + { + name: 'iflag', + description: 'Type of the file to save. (0 = binary file, Non-zero = text file)', + type: 'initialization' + }, + { + name: 'ktrig', + description: 'The trigger signal. Save the file each time it is non-zero.', + type: 'performance' + }, + ], + seeAlso: ['Read/Write Operations'] +}, +{ + name: 'ftset', + type: 'opcode', + category: 'Table Control:Read/Write Operations', + description: 'Sets multiple elements of a table to a given value.', + syntax: 'ftset(ktablenum, kvalue [, kstart=0, kend=0, kstep=1 ])\n ftset(itablenum, ivalue [, istart=0, iend=0, istep=1 ])', + example: '--8<-- "examples/ftset.csd"', + parameters: [ + { + name: 'ktablenum', + description: 'the number of the table to be modified', + type: 'performance' + }, + { + name: 'kvalue', + description: 'the value to write to the table', + type: 'performance' + }, + { + name: 'kstart', + description: 'the start index to modify (defaults to 0)', + type: 'performance' + }, + { + name: 'kend', + description: 'the end index to modify. Defaults to 0, which indicates the end of the table. A negative index can be used to count from the end, so for example -1 will modifiy the table without changing the last element.', + type: 'performance' + }, + { + name: 'kstep', + description: 'the increment to use between modified indexes. Defaults to 1, which means to modify every element between start and end', + type: 'performance' + }, + ], + seeAlso: ['Read/Write Operations'] +}, +{ + name: 'ftslice', + type: 'opcode', + category: 'Table Control:Read/Write Operations', + description: 'Copy a slice from an f-table to another f-table at performance.', + syntax: 'ftslice(ifnsource, ifndest [, kstart, kend, kstep ])\n ftslice(kfnsource, kfndest [, kstart, kend, kstep ])', + example: '--8<-- "examples/ftslice.csd"', + parameters: [ + { + name: 'ifnsource', + description: 'The table number to copy data from', + type: 'initialization' + }, + { + name: 'ifndest', + description: 'The table number to copy data to', + type: 'initialization' + }, + { + name: 'kstart', + description: 'The index to start copying from. _Defaults to 0_', + type: 'performance' + }, + { + name: 'kend', + description: 'The end index to stop copying. This is NOT inclusive. 0 means copy to the end of the table. _Defaults to end of table_', + type: 'performance' + }, + { + name: 'kstep', + description: 'How many elements to skip. _Defaults to 1_', + type: 'performance' + }, + ], + seeAlso: ['Read/Write Operations'] +}, +{ + name: 'ftslicei', + type: 'opcode', + category: 'Table Control:Read/Write Operations', + description: 'Copy a slice from an f-table to another f-table at init.', + syntax: 'ftslicei(ifnsource, ifndest [, istart, iend, istep ])', + example: '--8<-- "examples/ftslice.csd"', + parameters: [ + { + name: 'ifnsource', + description: 'The table number to copy data from', + type: 'initialization' + }, + { + name: 'ifndest', + description: 'The table number to copy data to', + type: 'initialization' + }, + { + name: 'istart', + description: 'The index to start copying from. _Defaults to 0_', + type: 'initialization' + }, + { + name: 'iend', + description: 'The end index to stop copying. This is NOT inclusive. 0 means copy to the end of the table. _Defaults to end of table_', + type: 'initialization' + }, + { + name: 'istep', + description: 'How many elements to skip. _Defaults to 1_', + type: 'initialization' + }, + ], + seeAlso: ['Read/Write Operations'] +}, +] diff --git a/src/lib/csound-reference/table-control-table-queries.ts b/src/lib/csound-reference/table-control-table-queries.ts new file mode 100644 index 0000000..98d1320 --- /dev/null +++ b/src/lib/csound-reference/table-control-table-queries.ts @@ -0,0 +1,162 @@ +import type { CsoundReference } from './types' + +// Table Control:Table Queries +export const tableControlTableQueries: CsoundReference[] = [ +{ + name: 'ftchnls', + type: 'opcode', + category: 'Table Control:Table Queries', + description: 'Returns the number of channels in a stored function table.', + example: '--8<-- "examples/ftchnls.csd"', + seeAlso: ['Table Control:Table Queries'] +}, +{ + name: 'ftcps', + type: 'opcode', + category: 'Table Control:Table Queries', + description: 'Returns the base frequency of a stored function table in Hz.', + example: '--8<-- "examples/ftcps.csd"', + seeAlso: ['Table Control:Table Queries'] +}, +{ + name: 'ftexists', + type: 'opcode', + category: 'Table Control:Table Queries', + description: 'Query if a given table exists.', + syntax: 'iexists = ftexists(ifn)\n kexists = ftexists(kfn / ifn)', + example: '--8<-- "examples/ftexists.csd"', + rates: ['i-rate'], + seeAlso: ['Table Control:Table Queries'] +}, +{ + name: 'ftlen', + type: 'opcode', + category: 'Table Control:Table Queries', + description: 'Returns the size of a stored function table.', + example: '--8<-- "examples/ftlen.csd"', + seeAlso: ['Table Control:Table Queries'] +}, +{ + name: 'ftlptim', + type: 'opcode', + category: 'Table Control:Table Queries', + description: 'Returns the loop segment start-time of a stored function table number.', + example: '--8<-- "examples/ftlptim.csd"', + seeAlso: ['Table Control:Table Queries'] +}, +{ + name: 'ftsr', + type: 'opcode', + category: 'Table Control:Table Queries', + description: 'Returns the sampling-rate of a stored function table.', + example: '--8<-- "examples/ftsr.csd"', + seeAlso: ['Table Control:Table Queries'] +}, +{ + name: 'genarray_i', + type: 'opcode', + category: 'Table Control:Table Queries', + description: 'Generate a vector (one-dimensional k-rate) with an arithmetic sequence at initialisation time.', + syntax: 'karray = genarray_i(istart, iend [,inc])', + example: '--8<-- "examples/genarray_i.csd"', + parameters: [ + { + name: 'istart', + description: 'value to place in first element.', + type: 'initialization' + }, + { + name: 'iend', + description: 'last value to place in array.', + type: 'initialization' + }, + { + name: 'inc', + description: 'amount to add to previous value (default 1).', + type: 'initialization' + }, + ], + seeAlso: ['Vectorial opcodes', 'fillarray'] +}, +{ + name: 'lenarray', + type: 'opcode', + category: 'Table Control:Table Queries', + description: 'Evaluates the size or number of dimensions of an array.', + syntax: 'ir = lenarray(karray[, iwhich])\n kr = lenarray(karray[, iwhich])', + example: '--8<-- "examples/lenarray.csd"', + parameters: [ + { + name: 'kr', + description: 'length of vector.', + type: 'performance' + }, + { + name: 'karray', + description: 'array to query.', + type: 'performance' + }, + ], + seeAlso: ['Array opcodes'] +}, +{ + name: 'maparray', + type: 'opcode', + category: 'Table Control:Table Queries', + description: 'Apply a function of one argument to every element of a vector (one-dimensional k-rate array).', + syntax: 'karray = maparray(kinarray, String)\n karray = maparray_i(kinarray, String)', + example: '--8<-- "examples/maparray.csd"', + parameters: [ + { + name: 'String', + description: 'a string that names an opcode function, at i-rate for maparray_i or k-rate for maparray.', + type: 'initialization' + }, + { + name: 'karray', + description: 'array for answers.', + type: 'performance' + }, + { + name: 'kinarray', + description: 'array for arguments to the function.', + type: 'performance' + }, + ], + seeAlso: ['Array opcodes'] +}, +{ + name: 'nsamp', + type: 'opcode', + category: 'Table Control:Table Queries', + description: 'Returns the number of samples loaded into a stored function table number.', + example: '--8<-- "examples/nsamp.csd"', + seeAlso: ['Table Control:Table Queries'] +}, +{ + name: 'slicearray', + type: 'opcode', + category: 'Table Control:Table Queries', + description: 'Take a slice of a vector (one-dimensional k-rate array).', + syntax: 'karray = slicearray(kinarray, istart, iend [,istride])', + example: '--8<-- "examples/slicearray.csd"', + parameters: [ + { + name: 'istart', + description: 'index of the first part of the answer.', + type: 'initialization' + }, + { + name: 'iend', + description: 'index of the last element of the answer.', + type: 'initialization' + }, + { + name: 'istride', + description: 'increment for source elements (optional), defaults to 1.', + type: 'initialization' + }, + ], + seeAlso: ['Array opcodes'] +}, +] diff --git a/src/lib/csound-reference/table-control.ts b/src/lib/csound-reference/table-control.ts new file mode 100644 index 0000000..87a3c7b --- /dev/null +++ b/src/lib/csound-reference/table-control.ts @@ -0,0 +1,144 @@ +import type { CsoundReference } from './types' + +// Table Control +export const tableControl: CsoundReference[] = [ +{ + name: 'ftfree', + type: 'opcode', + category: 'Table Control', + description: 'Deletes function table.', + syntax: 'ftfree(ifno, iwhen)', + example: '--8<-- "examples/ftfree.csd"', + parameters: [ + { + name: 'ifno', + description: 'the number of the table to be deleted', + type: 'initialization' + }, + { + name: 'iwhen', + description: 'if zero the table is deleted at init time; otherwise the table number is registered for being deleted at note deactivation.', + type: 'initialization' + }, + ], + seeAlso: ['Function Table Control'] +}, +{ + name: 'ftgen', + type: 'opcode', + category: 'Table Control', + description: 'Generate a score function table from within the orchestra.', + syntax: 'gir = ftgen(ifn, itime, isize, igen, iarga [, iargb ] [...])\n gir = ftgen(ifn, itime, isize, igen, iarray)', + example: '--8<-- "examples/ftgen.csd"', + rates: ['i-rate'], + parameters: [ + { + name: 'gir', + description: 'either a requested or automatically assigned table number above 100.', + type: 'initialization' + }, + { + name: 'ifn', + description: 'requested table number If _ifn_ is zero, the number is assigned automatically and the value placed in _gir_. Any other value is used as the table number', + type: 'initialization' + }, + { + name: 'itime', + description: 'is ignored, but otherwise corresponds to p2 in the score _f statement_.', + type: 'initialization' + }, + { + name: 'isize', + description: 'table size. Corresponds to p3 of the score _f statement_.', + type: 'initialization' + }, + { + name: 'igen', + description: 'function table _GEN_ routine. Corresponds to p4 of the score _f statement_.', + type: 'initialization' + }, + { + name: 'iarray', + description: 'ane dimensionl array holding the function table arguments. Correspond to p5 through pn of the score _f statement_.', + type: 'initialization' + }, + ], + seeAlso: ['GEN routine overview', 'Orchestra Header Statements'] +}, +{ + name: 'ftgentmp', + type: 'opcode', + category: 'Table Control', + description: 'Generate a score function table from within the orchestra, which is deleted at the end of the note.', + syntax: 'ifno = ftgentmp(ip1, ip2dummy, isize, igen, iarga, iargb, ...)', + example: '--8<-- "examples/ftgentmp.csd"', + parameters: [ + { + name: 'ifno', + description: 'either a requested or automatically assigned table number above 100.', + type: 'initialization' + }, + { + name: 'ip1', + description: 'the number of the table to be generated or 0 if the number is to be assigned, in which case the table is deleted at the end of the note activation.', + type: 'initialization' + }, + { + name: 'ip2dummy', + description: 'ignored.', + type: 'initialization' + }, + { + name: 'isize', + description: 'table size. Corresponds to p3 of the score _f statement_.', + type: 'initialization' + }, + { + name: 'igen', + description: 'function table _GEN_ routine. Corresponds to p4 of the score _f statement_.', + type: 'initialization' + }, + ], + seeAlso: ['Function Table Control'] +}, +{ + name: 'getftargs', + type: 'opcode', + category: 'Table Control', + description: 'Fill a string variable with the arguments used to create a function table at k-rate.', + syntax: 'Sdst = getftargs(iftno, ktrig)', + example: '--8<-- "examples/getftargs.csd"', + parameters: [ + { + name: 'ifno', + description: 'Number of the table whose arguments we want to request.', + type: 'initialization' + }, + { + name: 'Sdst', + description: 'output string variable.', + type: 'performance' + }, + { + name: 'ktrig', + description: 'trigger signal, should be valid at i-time. The output string variable is filled at initialization time if ktrig is positive, and at performance time whenever ktrig is both positive and different from the previous value. Use a constant value of 1 to print once at note initialization.', + type: 'performance' + }, + ], + seeAlso: ['Table Control:Table Queries'] +}, +{ + name: 'sndload', + type: 'opcode', + category: 'Table Control', + description: 'Loads a sound file into memory for use by [loscilx](../opcodes/loscilx.md).', + syntax: 'sndload(Sfname[, ifmt[, ichns[, isr[, ibas[, iamp[, istrt [, ilpmod[, ilps \\\n [, ilpe]]]]]]]]])', + parameters: [ + { + name: 'Sfname', + description: 'file name as a string constant or variable, string p-field, or a number that is used either as an index to strings set with strset, or, if that is not available, a file name in the format soundin.n is used. If the file name does not include a full path, the file is searched in the current directory first, then those specified by [SSDIR](../invoke/environment-variables.md) (if defined), and finally [SFDIR](../invoke/environment-variables.md). If the same file was already loaded previously, it will not be read again, but the parameters ibas, iamp, istrt, ilpmod, ilps, and ilpe are still updated.', + type: 'initialization' + }, + ], +}, +] diff --git a/src/lib/csound-reference/types.ts b/src/lib/csound-reference/types.ts new file mode 100644 index 0000000..ee03138 --- /dev/null +++ b/src/lib/csound-reference/types.ts @@ -0,0 +1,35 @@ +export interface CsoundReference { + name: string + type: 'opcode' | 'keyword' | 'header' | 'constant' + category: string + description: string + syntax?: string + example?: string + rates?: string[] + parameters?: { + name: string + description: string + type: 'initialization' | 'performance' + }[] + seeAlso?: string[] +} + +export interface ParsedOpcode { + id: string + category: string + title: string + description: string + syntaxModern?: string + syntaxClassic?: string + initParams: { name: string; description: string }[] + perfParams: { name: string; description: string }[] + example?: string + seeAlso: string[] + rawContent: string +} + +export interface CategoryGroup { + categoryKey: string + categoryName: string + opcodes: CsoundReference[] +} diff --git a/src/lib/csound-reference/utilities.ts b/src/lib/csound-reference/utilities.ts new file mode 100644 index 0000000..db58750 --- /dev/null +++ b/src/lib/csound-reference/utilities.ts @@ -0,0 +1,46 @@ +import type { CsoundReference } from './types' + +// Utilities +export const utilities: CsoundReference[] = [ +{ + name: 'lufs', + type: 'opcode', + category: 'Utilities', + description: 'Momentary, Integrated and Short-Term Loudness meter in LUFS.', + syntax: 'kmom, kint, kshort = lufs(kreset, ain1 [, ain2])', + example: '--8<-- "examples/lufs.csd"', + parameters: [ + { + name: 'kreset', + description: 'reset input. It resets the value of the integrated loudness if kreset is not 0.', + type: 'performance' + }, + { + name: 'ain1', + description: 'input audio signal(s). Only mono and stereo are supported (see below)', + type: 'performance' + }, + { + name: 'ain2', + description: 'input audio signal(s). Only mono and stereo are supported (see below)', + type: 'performance' + }, + { + name: 'kmom', + description: 'momentary loudness in LUFS', + type: 'performance' + }, + { + name: 'kint', + description: 'integrated loudness in LUFS', + type: 'performance' + }, + { + name: 'kshort', + description: 'short-term loudness in LUFS', + type: 'performance' + }, + ], + seeAlso: ['Sensing and Control: Envelope followers'] +}, +] diff --git a/src/lib/csound-reference/vectorial-cellular-automata.ts b/src/lib/csound-reference/vectorial-cellular-automata.ts new file mode 100644 index 0000000..ae41694 --- /dev/null +++ b/src/lib/csound-reference/vectorial-cellular-automata.ts @@ -0,0 +1,46 @@ +import type { CsoundReference } from './types' + +// Vectorial:Cellular Automata +export const vectorialCellularAutomata: CsoundReference[] = [ +{ + name: 'cell', + type: 'opcode', + category: 'Vectorial:Cellular Automata', + description: 'Cellular Automaton.', + syntax: 'cell(ktrig, kreinit, ioutFunc, initStateFunc, iRuleFunc, ielements)', + example: '--8<-- "examples/cell-modern.csd"', + parameters: [ + { + name: 'ioutFunc', + description: 'number of the table where the state of each cell is stored.', + type: 'initialization' + }, + { + name: 'initStateFunc', + description: 'number of the table containing the inital states of cells.', + type: 'initialization' + }, + { + name: 'iRuleFunc', + description: 'number of a lookup table containing the 8-bit rule.', + type: 'initialization' + }, + { + name: 'ielements', + description: 'total number of cells in a row.', + type: 'initialization' + }, + { + name: 'ktri', + description: 'trigger signal. Each time it is non-zero, a new generation of cells is evaluated.', + type: 'performance' + }, + { + name: 'kreinit', + description: 'reset signal. Each time it is non-zero, state of all cells is forced to be that of initStateFunc.', + type: 'performance' + }, + ], + seeAlso: ['Models and Emulations'] +}, +] diff --git a/to_continue.md b/to_continue.md deleted file mode 100644 index b02c0af..0000000 --- a/to_continue.md +++ /dev/null @@ -1,1030 +0,0 @@ -# Project Mode Implementation - Continuation Guide - -## Overview - -This document provides a complete roadmap for continuing the implementation of dual-mode support in OldBoy: **Composition Mode** (full document evaluation) and **Live Coding Mode** (block-based evaluation with persistent Csound instance). - ---- - -## What Has Been Completed - -### 1. Type System & Data Model ✅ - -**Files Modified:** -- `/src/lib/project-system/types.ts` -- `/src/lib/project-system/project-manager.ts` - -**Changes:** -1. Created `ProjectMode` type: - ```typescript - export type ProjectMode = 'composition' | 'livecoding'; - ``` - -2. Added `mode` field to `CsoundProject` interface: - ```typescript - export interface CsoundProject { - // ... existing fields - mode: ProjectMode; // NEW: Execution mode - } - ``` - -3. Updated `CreateProjectData` to accept optional mode: - ```typescript - export interface CreateProjectData { - // ... existing fields - mode?: ProjectMode; // Defaults to 'composition' if not provided - } - ``` - -4. Updated `UpdateProjectData` to allow mode updates: - ```typescript - export interface UpdateProjectData { - // ... existing fields - mode?: ProjectMode; // Can change mode after creation - } - ``` - -5. Modified `ProjectManager.createProject()`: - - Line 100: Added `mode: data.mode || 'composition'` to project initialization - - Ensures all new projects have a mode (defaults to composition) - -6. Modified `ProjectManager.updateProject()`: - - Line 165: Added `...(data.mode !== undefined && { mode: data.mode })` to update logic - - Allows mode to be updated without affecting other fields - -**Result:** All projects now have a mode field that persists in IndexedDB and is included in import/export operations. - ---- - -### 2. UI for Mode Selection ✅ - -**Files Modified:** -- `/src/lib/components/ui/FileBrowser.svelte` -- `/src/lib/stores/projectEditor.svelte.ts` -- `/src/App.svelte` - -**FileBrowser Changes:** - -1. **Imports (Line 7):** - ```typescript - import type { ProjectMode } from '../../project-system/types'; - ``` - -2. **Props Interface (Line 13):** - ```typescript - onMetadataUpdate?: (projectId: string, updates: { - title?: string; - author?: string; - mode?: ProjectMode // NEW - }) => void; - ``` - -3. **State (Line 30):** - ```typescript - let editMode = $state