A Node.js client library for communicating with Calrec audio consoles using the CSCP (Calrec Serial Control Protocol). This library provides a robust, type-safe interface for controlling and monitoring Calrec mixing consoles over TCP/IP.
- 🔌 TCP/IP Communication - Connect to Calrec consoles over network
- 🎛️ Full Console Control - Control faders, mutes, routing, and more
- 📡 Real-time Monitoring - Receive live updates from the console
- 🔄 Auto-reconnection - Automatic reconnection on connection loss
- 🛡️ Type Safety - Full TypeScript support with comprehensive type definitions
- 🎯 Event-driven - Clean event-based API for state changes
- 📊 Unit Conversion - Built-in dB/level conversion utilities
npm install @bitfocusas/calrec-cscp
import { CalrecClient } from '@bitfocusas/calrec-cscp';
// Create a client instance
const client = new CalrecClient({
host: '192.168.1.100', // Your Calrec console IP
port: 1337, // Your configured TCP port
});
// Set up event listeners
client.on('ready', () => {
console.log('Connected and ready!');
});
client.on('faderLevelChange', (faderId, level) => {
console.log(`Fader ${faderId} level changed to ${level}`);
});
client.on('error', (error) => {
console.error('Connection error:', error);
});
// Connect to the console
client.connect();
import { CalrecClient } from '@bitfocusas/calrec-cscp';
const client = new CalrecClient({
host: '192.168.1.100',
port: 1337,
});
client.on('ready', async () => {
// Get console information
const consoleInfo = await client.getConsoleInfo();
console.log('Console:', consoleInfo.deskLabel);
console.log('Max faders:', consoleInfo.maxFaders);
// Set fader level (0-1000 range)
await client.setFaderLevel(1, 500);
// Set fader level in dB
await client.setFaderLevelDb(1, -10);
// Mute/unmute a fader
await client.setFaderCut(1, true);
// Get fader label
const label = await client.getFaderLabel(1);
console.log('Fader 1 label:', label);
});
client.on('ready', async () => {
// Set aux routing (route fader 1 to aux 1 and 2)
await client.setAuxRouting(1, [true, true, false, false]);
// Monitor aux routing changes
client.on('auxRoutingChange', (auxId, routes) => {
console.log(`Aux ${auxId} routing changed:`, routes);
});
});
// Monitor all fader changes
client.on('faderLevelChange', (faderId, level) => {
console.log(`Fader ${faderId}: ${level}`);
});
client.on('faderCutChange', (faderId, isCut) => {
console.log(`Fader ${faderId} ${isCut ? 'muted' : 'unmuted'}`);
});
client.on('faderLabelChange', (faderId, label) => {
console.log(`Fader ${faderId} label: ${label}`);
});
client.on('faderAssignmentChange', (assignment) => {
console.log('Fader assignment changed:', assignment);
});
// Monitor connection state
client.on('connectionStateChange', (state) => {
console.log('Connection state:', state);
});
client.on('connect', () => {
console.log('Connected to console');
});
client.on('disconnect', () => {
console.log('Disconnected from console');
});
// Manual disconnect
client.disconnect();
The main client class for communicating with Calrec consoles.
new CalrecClient(options: CalrecClientOptions)
Options:
host: string
- Console IP addressport: number
- TCP port numberautoReconnect?: boolean
- Enable auto-reconnection (default: true)reconnectInterval?: number
- Reconnection delay in ms (default: 5000)
connect()
- Connect to the consoledisconnect()
- Disconnect from the consolegetState()
- Get current client stategetConnectionState()
- Get connection state
getConsoleInfo()
- Get console informationgetConsoleName()
- Get console name
setFaderLevel(faderId: number, level: number)
- Set fader level (0-1000)getFaderLevel(faderId: number)
- Get fader levelsetFaderLevelDb(faderId: number, db: number)
- Set fader level in dBgetFaderLevelDb(faderId: number)
- Get fader level in dBsetFaderCut(faderId: number, isCut: boolean)
- Mute/unmute fadergetFaderLabel(faderId: number)
- Get fader label
setMainFaderLevelDb(mainId: number, db: number)
- Set main fader level in dBgetMainFaderLevelDb(mainId: number)
- Get main fader level in dB
setAuxRouting(auxId: number, routes: boolean[])
- Set aux routing
The client extends EventEmitter and provides the following events:
connect
- Connected to consoledisconnect
- Disconnected from consoleready
- Client fully initialized and readyerror
- Connection or protocol errorconnectionStateChange
- Connection state changed
faderLevelChange
- Fader level changedfaderCutChange
- Fader mute state changedfaderPflChange
- Fader PFL state changedfaderLabelChange
- Fader label changedfaderAssignmentChange
- Fader assignment changed
mainLevelChange
- Main fader level changedmainPflChange
- Main fader PFL state changedmainLabelChange
- Main fader label changed
availableAuxesChange
- Available auxes changedauxRoutingChange
- Aux routing changedauxOutputLevelChange
- Aux output level changed
unsolicitedMessage
- Raw unsolicited message received
The library exports comprehensive TypeScript types:
import {
ConnectionState,
CalrecClientOptions,
ConsoleInfo,
FaderAssignment,
AudioType,
AudioWidth,
StereoImage,
NakError
} from '@bitfocusas/calrec-cscp';
Utility functions for converting between different units:
import {
dbToChannelLevel,
dbToMainLevel,
channelLevelToDb,
mainLevelToDb
} from '@bitfocusas/calrec-cscp';
- Configure your Calrec console to enable CSCP over TCP/IP
- Set the appropriate IP address and port
- Ensure network connectivity between your application and the console
- TCP/IP connectivity to the console
- Port access (typically 1337, but configurable)
- Stable network connection for reliable operation
The library provides comprehensive error handling:
client.on('error', (error) => {
if (error instanceof NakError) {
console.error('Protocol error:', error.message);
} else {
console.error('Connection error:', error);
}
});
git clone https://github.com/bitfocusas/calrec-cscp.git
cd calrec-cscp
npm install
npm run build
npm run dev
npm run lint # Lint code
npm run format # Format code
npm run check # Run all checks
We welcome contributions! This library is provided free of charge by Bitfocus AS to the audio community.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Make your changes
- Add tests if applicable
- Run the linter and formatter (
npm run check
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
- Follow the existing code style (enforced by Biome)
- Add TypeScript types for all new features
- Include JSDoc comments for public APIs
- Test your changes thoroughly
- Update documentation as needed
This project is licensed under the MIT License - see the LICENSE file for details.
- Issues: GitHub Issues
- Documentation: GitHub Wiki
- Email: [email protected]
- Calrec Audio for the CSCP protocol specification
- The audio engineering community for feedback and testing
- All contributors who help improve this library
Made with ❤️ by Bitfocus AS